View previous topic :: View next topic |
Author |
Message |
simonb
Joined: 05 Feb 2007 Posts: 6
|
restart_cause() can only be used once. Please add to manual. |
Posted: Tue Nov 13, 2007 4:06 am |
|
|
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
|
|
Posted: Tue Nov 13, 2007 5:01 am |
|
|
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 support@ccsinfo.com |
|
|
simonb
Joined: 05 Feb 2007 Posts: 6
|
|
Posted: Tue Nov 13, 2007 5:35 am |
|
|
Oops. It's so embarrassing when I miss the very, very obvious
Just sent email.
Well, at least you all get to know in advance of any manual update :-) |
|
|
Ttelmah Guest
|
|
Posted: Tue Nov 13, 2007 5:40 am |
|
|
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 |
|
|
|