View previous topic :: View next topic |
Author |
Message |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
soft reset does not clear ram |
Posted: Wed May 16, 2012 3:15 am |
|
|
Hi,
I have strange problem.
After hard reset my board is setting itself into proper state but on occasions after I use reset_cpu(); ram is not cleared and it remembers old values.
I set my vars in the beggining of the program like for example:
int var = 0;
inside file -> #include "variables.c"
and I zero ram in the start of program:
#zero_ram
void main() { // main program
}
Any one got an idea why it may be happening?
Thnx _________________ Help "d" others and then you shell receive some help from "d" others. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed May 16, 2012 1:05 pm |
|
|
Always post your PIC and your compiler version.
The action taken by reset_cpu() is different, depending upon the PIC. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu May 17, 2012 2:23 am |
|
|
In addition, the question isn't quite clear.
#zero_ram can be expected to perform the (C standard) clearing of all global variables. It's performed in the main() preamble with CCS C.
int var = 0; defines an initialized local or global variables, for local ones the initialization is performed each time the function/block is entered. Local variables are not affected by #zero_ram, neither explicitely initialized global variables.
In my view, all of these variables would be initialized on a soft_reset(), because it's always executing main() a new.
For which kind of variable do you see missing initialization? |
|
|
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
|
Posted: Thu May 17, 2012 3:06 am |
|
|
Thank you for reply,
I need to narrow the fault and then I will be back with more data. It happens on occasions so I need to do more testing.
Thnx _________________ Help "d" others and then you shell receive some help from "d" others. |
|
|
|