SET/EQU Example
Directives highlighted in this example are:
equ
Program Functional Description
This example shows the the usage of the
set
directive, used for creating symbols which may be used in MPASM assembler expressions only. The symbols created with this directive do not occupy any physical memory location of microcontroller.Commented Code Listing
list p=16f877 ;Select the device.
#include <p16f877.inc> ;Include standard header file
;for the selected device.
perimeter set 0 ;The label 'perimeter' is
;assigned value 0.
area set 0 ;The label 'area' is assigned
;value 0.
lngth equ 50H ;The label 'lngth' is assigned
;the value 50H.
wdth equ 25H ;The label 'wdth' is assigned
;the value 25H.
perimeter set 2*(lngth+wdth) ;Both 'perimeter' and
area set lngth*wdth ;'area' values are
;reassigned.
end
Microchip Technology Inc. Microchip's Web Site Voice: (480) 792-7200 Fax: (480) 899-9210 Microchip's E-mail Address |