Hi, I'm using MC68HC908AP64.My question is, is the RAM data will be cleared to 0 after MCU Reset from watchdog or RAM can memorize the data value after MCU reset?
I don't know that micro variant, but typically the Ram memory is not affected by a reset.
Only a low supply voltage will corrupt it.
don
Thx a lot!
And if I declare a variable without initialization. In the program,the value of this variable is set to 0 by default or it will be assigned to a random value?
Hello,
After a POR or LVD reset, the state of each RAM location will be undefined. After other types of reset, the RAM will retain the state that existed prior to the reset. This is what the hardware does.
Following any type of reset, what then happens will depend on whether ANSI initialisation was enabled or disabled when the project was first created. If enabled, the global and static variables will be initialised within a "copydown" process. Any variables that do not have an explicit initialisation value will be zeroed. This does not apply to any local variables which reside on the stack.
If ANSI initialisation was disabled, the copydown process does not occur, so all variables will remain undefined, even if explicitly initialised in the variable defininition. In this case, you would need to assign a value to each variable when it is first used.
Regards,
Mac