|
|
View previous topic :: View next topic |
Author |
Message |
Turtle
Joined: 05 May 2009 Posts: 1
|
RAM access problem |
Posted: Tue May 05, 2009 6:03 am |
|
|
Hi,
I use the PCWH compiler V3.215 (!)
for a PIC 18C252.
I observe a strange RAM access problem.
A 16 bit variable happens to be located
at the addresses 0x01FF / 0x0200.
When this variable is decremented
x--;
the byte in 0x01FF is decremented.
When this byte underflows, not the byte
at 0x0200 but the byte at 0x0100 (!) is
decremented.
I do not know if this is a compiler bug or
a hardware bug in the microcontroller.
My workaround is to put one dummy byte
before my 16 bit variable to move it to an
even address. It works but this is not nice
because I do not want to check the symbol
table for odd addresses after every software
change.
There must be a compiler switch, pragma or so,
that tells the compiler to put 16 bit variables to
even addresses, but I can not find it (I know
the answer to this must be very simple, but
nevertheless I need a hint...)
Please help. |
|
|
Ttelmah Guest
|
|
Posted: Tue May 05, 2009 7:36 am |
|
|
3.215, really predates the 3. compilers working 'right' for the 18 chips. It probably is a compiler bug.
I can't think of a configuration to give even alignment of variables. Just use a #locate statement, to put the variable at an even address. Since the problem presuably only applies at the end of the bank, there can't be many variables that will need moving.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|