Continue to Site

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

#### 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?

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
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:

#### Jon Wilder

##### Active Member
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.

Replies
10
Views
1K
Replies
2
Views
2K
Replies
24
Views
955
Replies
5
Views
909
Replies
15
Views
1K