Chiptype as compiler-directive

Post your requests and ideas on the future development of mikroPascal.
Post Reply
Author
Message
jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Chiptype as compiler-directive

#1 Post by jpc » 27 Jan 2006 10:16

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.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: Chiptype as compiler-directive

#2 Post by zristic » 27 Jan 2006 10:41

{$IFCHIP xxx} sounds relatively easy to implement. We will probably do it, not in the incoming version, but soon afterwards it may appear.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#3 Post by jpc » 06 Apr 2006 17:49

may i gently remind you ....

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 07 Apr 2006 10:39

While you are patiently waiting, try to use {$I} directive:

Code: Select all

program MyProgram;

{$I SomeFile.txt}

begin

{$IFDEF MyChip}
  // do something
{$ENDIF}

{$IFDEF SomeOtherChip}
  // do something else
{$ENDIF}

end.
And the contents of SomeFile.txt would be

Code: Select all

{$DEFINE MyChip}
It is fairly easy, I just wonder how you could not remember it.:? {$I} is often used in programming.

Post Reply

Return to “mikroPascal Wish List”