|
|
View previous topic :: View next topic |
Author |
Message |
eric
Joined: 16 Sep 2003 Posts: 21
|
Variables in ram being overwritten |
Posted: Mon Apr 30, 2007 9:02 am |
|
|
Ram variables being overwritten in my 18F2525 code (or 18F2520)
in the .lst file the Compiler make this assignment
.................... MY_IP_BYTE4=210;
1710: MOVLW D2
1712: MOVWF xFB <- MY_IP_BYTE4 assigned to ram location xFB
Looking though the .lst file there is only 2 more uses of this register. Both are just reading the location.
Yet after about an hour, or several hours, the value this location has changed to x54 (from xD2)! This over written value has been consistently changed to x54.
This also can happen to other variables but the "adjusted" values are not as consistent. I am assuming that I have only one problem but it may be more than one effect. Focusing on the this one since the altered value is repeatable.
All interrupts are off (I think)
#fuses H4,NOWDT,PROTECT,NOWRT,NOLVP
CCS PCH C Compiler, Version 3.249, 31890
ROM used: 31182 bytes (65%)
Largest free fragment is 15568
RAM used: 590 (15%) at main() level
699 (18%) worst case
Stack: 16 location
I am using my code, which has been solid for a year, combined with the some CCS example code for driving the ENC28J60. The example code, or my code when run alone did not seem to have this problem.
ANY suggestions on what might be happening here?
Eric |
|
|
Ttelmah Guest
|
|
Posted: Mon Apr 30, 2007 9:47 am |
|
|
Are you using pointers anywhere?.
What array accesses are you using?.
What is listed in the sym file, immediately in front of the corrupted value(s)?. Is this accessed by either a pointer, or as an array?.
The commonest cause of this, is failure to 'bounds check' an index value for an array, or used with a pointer (the compiler does not do this, and the chip has no hardware protection for this), so the wrong value gets accessed.
Best Wishes |
|
|
eric
Joined: 16 Sep 2003 Posts: 21
|
|
Posted: Mon Apr 30, 2007 10:07 am |
|
|
Thanks for the reply- I will check out your suggestions today.
Eric |
|
|
|
|
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
|