EmbeddedRelated.com
Forums

PIC (Microchip) assembler syntax query

Started by bruce varley January 31, 2006
Hi,  Maybe deserves an RTFM response, but I've just spent an hour on this
with no success. I appear to be trying what the various advice notes
suggest, but it isn't working.

I'm declaring data memory space (starts at 0x20), up to now have been doing
it clunkily as follows:

REG1   EQU    0x20
REG2   EQU    0x21

But with other platforms one usually declares the locations themselves, as
in:

    ORG    0x20
REG1    DB    0
REG2    DB    0


Attempting this with Microchip for 12C or 16F series results in a error
message "Overwriting previous address contents (0020)".
Would appreciate it if someone could tell me the correct syntax, and what
that error message means. TIA


"bruce varley" <bxvarley@weqstnet.com.au> a &#4294967295;crit dans le message de news: 
43df5824$1@quokka.wn.com.au...
> Hi, Maybe deserves an RTFM response, but I've just spent an hour on this > with no success. I appear to be trying what the various advice notes > suggest, but it isn't working. > > I'm declaring data memory space (starts at 0x20), up to now have been > doing > it clunkily as follows: > > REG1 EQU 0x20 > REG2 EQU 0x21 > > But with other platforms one usually declares the locations themselves, as > in: > > ORG 0x20 > REG1 DB 0 > REG2 DB 0 > > > Attempting this with Microchip for 12C or 16F series results in a error > message "Overwriting previous address contents (0020)". > Would appreciate it if someone could tell me the correct syntax, and what > that error message means. TIA
ORG 0x20 etc try to put your variables in program space, not in data space. You should use somelike like that : dataarea UDATA H'020' reg1 RES 1 reg2 RES 1 programarea CODE etc Friendly yours, -- Robert Lacoste ALCIOM - The mixed signal experts www.alciom.com
bruce varley wrote:
> ORG 0x20 > REG1 DB 0 > REG2 DB 0
I'm probably missing something but shouldn't that be ORG 0x20 REG1 DB 1 REG2 DB 1 -Mike
"bruce varley" <bxvarley@weqstnet.com.au> wrote in message
news:43df5824$1@quokka.wn.com.au...
> Hi, Maybe deserves an RTFM response, but I've just spent an hour on this > with no success. I appear to be trying what the various advice notes > suggest, but it isn't working. > > I'm declaring data memory space (starts at 0x20), up to now have been
doing
> it clunkily as follows: > > REG1 EQU 0x20 > REG2 EQU 0x21 > > But with other platforms one usually declares the locations themselves, as > in: > > ORG 0x20 > REG1 DB 0 > REG2 DB 0 > > > Attempting this with Microchip for 12C or 16F series results in a error > message "Overwriting previous address contents (0020)". > Would appreciate it if someone could tell me the correct syntax, and what > that error message means. TIA > >
I use cblock ie. cblock 0x20 reg1 reg2 endc If you do rtfm then it should make sense. hth Mike
bruce varley wrote:
> Hi, Maybe deserves an RTFM response, but I've just spent an hour on this > with no success. I appear to be trying what the various advice notes > suggest, but it isn't working. > > I'm declaring data memory space (starts at 0x20), up to now have been doing > it clunkily as follows: > > REG1 EQU 0x20 > REG2 EQU 0x21 > > But with other platforms one usually declares the locations themselves, as > in: > > ORG 0x20 > REG1 DB 0 > REG2 DB 0 > >
In your first example to are assigning memory addresses to reg1,reg2, I expect thats what your trying to do. In the second example your assigning a value to reg1,reg2, so if you havent given them an address allready it will write to address 20, the last mem address you specified, on each instruction.
> Attempting this with Microchip for 12C or 16F series results in a error > message "Overwriting previous address contents (0020)". > Would appreciate it if someone could tell me the correct syntax, and what > that error message means. TIA