Chiptype as compiler-directive
Chiptype as compiler-directive
As different chips need different initialisations it might be handy to have the chiptype available for use in conditional compiling. It can be done now by {$DEFINE } , {$IFDEF} etc but this depends on the programmer. In reality the compiler knows at compiletime for which processor it is compiling . In order to make things easy i would like to have {$IFCHIP xxx} or something similar. Even better would be some kind of ($CASE < list of chips > } as certain peripherals are identical on a range of chips.
Re: Chiptype as compiler-directive
{$IFCHIP xxx} sounds relatively easy to implement. We will probably do it, not in the incoming version, but soon afterwards it may appear.
While you are patiently waiting, try to use {$I} directive:
And the contents of SomeFile.txt would be
It is fairly easy, I just wonder how you could not remember it. {$I} is often used in programming.
Code: Select all
program MyProgram;
{$I SomeFile.txt}
begin
{$IFDEF MyChip}
// do something
{$ENDIF}
{$IFDEF SomeOtherChip}
// do something else
{$ENDIF}
end.
Code: Select all
{$DEFINE MyChip}