UDATA_ACS Example
Directives highlighted in this example for PIC18CXXX devices are:
Program Functional Description
This program demonstrates the utility of the
udata_acs
directive, which is used when generating an object file. This directive declares the beginning of a section of uninitialized data.Commented Code Listing
list p=18c452 ;Select device.
#include <p18c452.inc> ;Include standard header file
;for the selected device.
group1 udata_acs 0x20 ;group1 data stored at access
;RAM locations starting at 0x20.
group1_var1 res 1 ;group1_var1 located at 0x20.
group1_var2 res 1 ;group1_var2 located at 0x21.
group2 udata_acs ;Declaration of group2 data. The
;addresses for data under this
;secton are allocated
;automatically by the linker.
group2_var1 res 1 ;All addresses be will allocated
group2_var2 res 1 ;in access RAM space only.
RST CODE H'0' ;The code section named RST is
;placed at H'0'. The instruction
;'goto start' is placed in code
;section RST.
goto start ;Jumps to the location labelled
;'start'
INTRT CODE H'8' ;The code section named INTRT is
;placed at H'4'. The instruction
;'goto service_int' is placed in
;code section INTRT.
goto service_int ;Jumps to the location labelled
;'service_int'.
PGM CODE ;This is the begining of the code
;section named PGM. It is a
;relocatable code section since
;no absolute address is given along
;with directive 'CODE'.
start
clrf group1_var1,A ;group1_var1 initialized to zero
clrf group1_var2,A ;group1_var2 initialized to zero
clrf group2_var1,A ;group2_var1 initialized to zero
clrf group2_var2,A ;group2_var2 initialized to zero
goto $
service_int
retfie
end
Microchip Technology Inc. Microchip's Web Site Voice: (480) 792-7200 Fax: (480) 899-9210 Microchip's E-mail Address |