User`s manual

224 digi.com Keywords
#GLOBAL_INIT
Syntax: #GLOBAL_INIT { variables }
#GLOBAL_INIT sections are blocks of code that are run once before main() is called. They should
appear in functions after variable declarations and before the first executable code. If a local static variable
must be initialized once only before the program runs, it should be done in a #GLOBAL_INIT section,
but other inititialization may also be done. For example:
#error
Syntax: #error "…"
Instructs the compiler to act as if an error was issued. The string in quotes following the directive is the
message to be printed
#funcchain
Syntax: #funcchain chainname name
Adds a function, or another function chain, to a function chain.
// This function outputs and returns the number of times it has been called.
int foo(){
char count;
#GLOBAL_INIT{
// initialize count
count = 1;
// make port A output
WrPortI(SPCR,SPCRShadow,0x84);
}
// output count
WrPortI(PADR,NULL,count);
// increment and return count
return ++count;
}