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

restart_cause() can only be used once. Please add to manual.

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



Joined: 05 Feb 2007
Posts: 6

View user's profile Send private message

restart_cause() can only be used once. Please add to manual.
PostPosted: Tue Nov 13, 2007 4:06 am     Reply with quote

I just discovered (the hard way) that restart_cause(), at least on a PIC18F2520, will always return 15 after it's first use. This is because the various bits need to be manually set to 1 otherwise they will stay 0 through the next reset, even if that bit isn't the cause. The compiler takes care of this task transparently but this does mean that restart_cause can only be called once.

Could this please be made clear in future editions of the reference manual?

Thanks,
SimonB
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Nov 13, 2007 5:01 am     Reply with quote

It's a good suggestion but reporting it here will not get it added to the manual. Check the text box at the top right on every page of this forum: 'This forum is for customer to customer communications. CCS does not monitor this forum on a regular basis'.

All bugs and suggestions should be reported to [email protected]
simonb



Joined: 05 Feb 2007
Posts: 6

View user's profile Send private message

PostPosted: Tue Nov 13, 2007 5:35 am     Reply with quote

Oops. It's so embarrassing when I miss the very, very obvious Embarassed

Just sent email.

Well, at least you all get to know in advance of any manual update :-)
Ttelmah
Guest







PostPosted: Tue Nov 13, 2007 5:40 am     Reply with quote

However, though it is something that a caveat about, is worth adding (in fact the caveat, should point out that quite a few things, _will_ destroy the value - such as watchdog configuration on some chips), it really ought to be obvious, if you read the chip data sheet, and reflect on what the operation must do (read the status bits, and re-initialise them for the next pass)...

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