4.33 Idata_acs Directive
The MPASM IDATA_ACS
directive creates a section for PIC18
access bank objects that must be initialised.
Suggested Replacement
Use any of the PIC Assembler's directives that can reserve space in a suitable data memory psect, and collate the initial values in a separate psect placed in program memory.
The following PIC18 example reserves the runtime memory for the variables in the Access Bank and places the initial values for these variables in program memory. Assembler-provided psects were used in this example, but you can define you own suitable psects, if required.
#include <xc.inc>
;define space for the variables in RAM
PSECT udata_acs
vars:
input:
DS 2
output:
DS 1
;place the initial values for the above in a matching order in program memory
PSECT data
iValues:
DW 55AAh
DB 67h
Your application will need to provide code that copies the initial values
to the reserved data memory space, as shown in the following example which copies
the values at iValues
to vars
.
PSECT text,class=CODE
copy0:
movlw low (iValues)
movwf tblptrl
movlw high(iValues)
movwf tblptrh
movlw low highword(iValues)
movwf tblptru
tblrd*+
movff tablat, vars+0
tblrd*+
movff tablat, vars+1
tblrd*+
movff tablat, vars+2
return
When copying larger amounts of data, consider using a loop and FSR register to indirectly write to the variables in data memory.