User manual

232
mikoPascal PRO for PIC32
MikroElektronika
Unlike $IFDEF, $IFNDEF checks if ag is not dened by means of $DEFINE, thus producing the opposite results.
Include Directive $I
The $I parameter directive instructs mikroPascal PRO for PIC32 to include the named text le in the compilation. In
effect, the le is inserted in the compiled text right after the {$I lename} directive. If lename does not specify a
directory path, then, in addition to searching for the le in the same directory as the current unit, mikroPascal PRO for
PIC32 will search for le in order specied by the search paths.
To specify a lename that includes a space, surround the le name with quotation marks: {$I "My le"}.
There is one restriction to the use of include les: An include le can't be specied in the middle of a statement part. In
fact, all statements between the begin and end of a statement part must exist in the same source le.
See also Predened Project Level Denes.
Linker Directives
mikroPascal PRO for PIC32 uses an internal algorithm to distribute objects within memory. If you need to have a
variable, constant or a routine at the specic predened address, use the linker directives absolute and org.
When using these directives, be sure to use them in proper memory segments, i.e. for functions it is the KSEG0 and
for variables it is the KSEG1. Linker directives are used with the virtual addresses.
Directive absolute
Directive absolute species the starting address in RAM for a variable. If the variable is multi-byte, higher bytes will be
stored at the consecutive locations.
Directive absolute is appended to declaration of a variable:
// Variable x will occupy 1 word (16 bits) at address 0xA0000000
var x : word; absolute 0xA0000000;
// Variable y will occupy 2 words at addresses 0xA0000000 and 0xA0000002
var y : longint; absolute 0xA0000000;
Be careful when using the absolute directive, as you may overlap two variables by accident. For example:
// Variable i will occupy 1 word at address 0xA0000002;
var i : word; absolute 0xA0000002;
// Variable will occupy 2 words at 0xA0000000 and 0xA0000002; thus,
// changing i changes jj at the same time and vice versa
var jj : longint; absolute 0xA0000000;