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

reset_cpu() Inquiry

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



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

reset_cpu() Inquiry
PostPosted: Tue Jan 27, 2004 5:32 pm     Reply with quote

Hi,

I understand that CCS has a reset_cpu() built-in function. What will happend to my RAM and EEPROM if reset cpu is initiated? does it erase the contents or retains the content? provided after resetting no initialization of variables?

Comments please...

Thankx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 27, 2004 6:31 pm     Reply with quote

For the PCM compiler:

Reset_cpu() jumps to the start of the program, at address 0x0000.

So if you are using the #zero_ram pre-processor statement in your
program, then that code will be executed and the ram will be cleared,
when the program re-starts.

The compiler also puts in code to clear static variables, so if you
have declared any variables as static, they will be cleared, as well.

EEPROM is not affected, unless you have code in your program
that writes to EEPROM.

===============================
For the PCH compiler:

Reset_cpu() executes the software RESET instruction.
This does a \MCLR reset. In the 18F data sheet, it says this:

"Most registers are unaffected by a RESET. Their status
is unknown on POR and unchanged by all other
RESETS".

So this implies that RAM is not changed by executing the
reset_cpu() function for the PCH compiler.

EEPROM is also not affected.
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