[fpc-devel] Freepascal in microcontrollers

Michael Schnell mschnell at lumino.de
Wed Feb 27 09:44:26 CET 2008


You can avoid cryptic language constructs in the main source code.

I did not yet use the preprocessor in Pascal but a standard way to 
access memory mapped ports in C is something like this (from the top of 
my head):


#define _port = 0x87

#define ByteIO(p) *(((volatile unsigned char)*)(p))

#define port=ByteIO(_port)


now in the main code you go

 x = ByteIO(_port);

or just

 x = port;



 ByteIO(_port) = 0x55;

may look queer to some watchers, but

 port = 0x55;

should be nice.


-Michael



More information about the fpc-devel mailing list