CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RAM access problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Turtle



Joined: 05 May 2009
Posts: 1

View user's profile Send private message

RAM access problem
PostPosted: Tue May 05, 2009 6:03 am     Reply with quote

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







PostPosted: Tue May 05, 2009 7:36 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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