Specifications
mikroElektronika | Free Online Book | PIC Microcontrollers | Appendix A: Programming a Microcontroller
EQU directive
This directive is used to replace a numeric value by a symbol. In this way, some a specific location in memory is assigned a
name. For example:
MAXIMUM EQU H’25’
This means that a memory location at address 25 (hex.) is assigned the name "MAXIMUM". Every appearance of the label
"MAXIMUM" in the program will be interpreted by the assembler as the address 25 (MAXIMUM = H’25’). Symbols may be
defined this way only once in a program. That this directive is mostly used at the beginning of the program.
ORG directive
This directive specifies a location in program memory where the program following directive is to be placed. For example:
ORG 0x100
START ... ...
...
ORG 0x1000
TABLE ...
...
This program starts at location 0x100. The table containing data is to be stored at location 1024 (1000h).
END directive
Each program must be ended by using this directive. Once a program encounters this directive, the assembler immediately
stops compiling. For example:
...
END ;End of program
$INCLUDE directive
The name of this directive fully indicates its purpose. During compiling, it enables the assembler to use data contained in
another file on a computer hard disc. For example:
...
#include <p16f887.inc>
CBLOCK and ENDC directives
All variables (their names and addresses) that will be used in a program must be defined at the beginning of the program.
Because of this it is not necessary to specify the address of each specified variable later in the program. Instead, it is
enough to specify the address of the first one by using directive CBLOCK and list all others afterwards. The compiler
automatically assigns these variables the corresponding addresses as per the order they are listed. Lastly, the directive
ENDC indicates the end of the list of variables.
CBLOCK 0x20
START ; address 0x20
RELE ; address 0x21
STOP ; address 0x22
LEFT ; address 0x23
http://www.mikroe.com/en/books/picmcubook/appa/ (4 of 21)5/3/2009 11:35:35 AM