PIC-AS DB Assembler Directive Only Building First Two Bytes Of String

Status
Not open for further replies.

Jon Wilder

Active Member
Hi all.

When building a string using the DB directive in pic-as, only the first two characters get built into flash. It's as if it wants each word on its own separate line.

Code:
        PSECT myConstant,class=CODE,delta=1
someLabel:
        DB        "This is my string",0

Only the "T" and the "h" (6854) get built into flash, while the rest of the string is ignored. The ONLY way I've been able to get it to build is -

Code:
        PSECT myConstant,class=CODE,delta=1
someLabel:
        DB        "Th"
        DB        "is"
        DB        " i"
        DB        "s "
        DB        "my"
        DB        " s"
        DB        "tr"
        DB        "in"
        DB        "g "

In the "Microchip XC8 PIC Assembler User Guide", it even states that you can place strings into a flash table the way I'm trying to do it above -


However, it is clearly not behaving how it states it should in the user guide.

Is there something I'm missing?
 
Try "class = strcode" Or "class=string" See if that helps

Actually it could just be "class=const" have a look at 5.3.1 in the XC pic assembler manual
 
Last edited:
Try "class = strcode" Or "class=string" See if that helps

Actually it could just be "class=const" have a look at 5.3.1 in the XC pic assembler manual
Hi Ian. Been awhile.

As it turns out, it's actually assembling it just fine. The MPLAB disassembly listing file, for some reason, just wasn't reflecting that. But a look into the program memory view clearly shows it there.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…