4.11 Da Directive
The MPASM DA
directive packs each sequence of two ASCII
characters within a string into a 14-bit word in program memory.
Suggested Replacement
The PIC Assembler's DB
directive inside a suitable
psect performs a similar function, but note that packed strings are not supported by
the PIC assembler and that each character will appear as a full byte in memory.
IRPC
and/or DB
directives in the data
psect that is provided once you include
<xc.inc>
, for
example:#include <xc.inc>
PSECT data
myString:
IRPC char,ABC
DB ’char’
ENDM
but
note that each character will consume one entire byte of memory.Alternatively, you can define your own psect and allocate it to program
memory. Ensure that the psect's space
flag is set to 0 (the default
value). It can be assigned an address by associating it with a suitable linker class
(e.g. CONST
for PIC18 devices, or STRCODE
for
other devices), or by explicitly positioning the psect using the linker's
-P
option (accessible from the driver using the
-Wl
option), as in the following PIC18 example.
PSECT romData,space=0,class=CONST
myString:
DB ’A’, 'B', 'C'