Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
237
Include Directive #I
The 
#I
 parameter directive instructs mikroBasic PRO for dsPIC30/33 and PIC24 to include the named text file in the 
compilation. In effect, the file is inserted in the compiled text right after the 
#I
 filename directive. If 
filename
 does not 
specify a directory path, then, in addition to searching for the file in the same directory as the current unit, mikroBasic 
PRO for dsPIC30/33 and PIC24 will search for file in order specified by the search paths.
To specify a filename that includes a space, surround the file name with quotation marks: 
#I “My file”
.
There is one restriction to the use of include files: An include file can’t be specified 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 file.
See also Predefined Project Level Defines.
Linker Directives
mikroBasic PRO for dsPIC30/33 and PIC24 uses internal algorithm to distribute objects within memory. If you need to 
have a variable or routine at the specific predefined address, use the linker directives 
absolute 
and
 org
.
Directive absolute
Directive 
absolute
 specifies 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 0x32
dim x as word absolute 0x32
‘ Variable y will occupy 2 words at addresses 0x34 and 0x36
dim y as longint absolute 0x34
Be careful when using 
absolute
 directive, as you may overlap two variables by accident. For example:
dim  i as word absolute 0x42
‘ Variable i will occupy 1 word at address 0x42;
dim jj as longint absolute 0x40
‘ Variable will occupy 2 words at 0x40 and 0x42; thus,
‘ changing i changes jj at the same time and vice versa