View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
Do I manually must set RCON register or the compiler do it? |
Posted: Thu Apr 07, 2016 8:39 am |
|
|
My first code line inside Main is
Code: | LastRestart=RESTART_CAUSE(); |
Do I manually must set RCON register or the compiler do it?
µC is PIC18F67J50, Compiler version is 5.048. _________________ Electric Blue |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Apr 07, 2016 9:21 am |
|
|
the answer is in the datasheet
go back and READ section
4.1 RCON Register
and your question will be answered.
learn too make the datasheet your primary source and much time will be saved. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Thu Apr 07, 2016 9:46 am |
|
|
I already did it, the datasheet say yes; but since the compiler has some automated function I don't wanna do something that is already handled by the compiler and maybe cause some interference on the program behavior. _________________ Electric Blue |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Apr 07, 2016 11:06 am |
|
|
look at the .LST file your program generates -
then find any reference to the RCON register address in the listing
to see what the compiler does |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Apr 07, 2016 11:07 am |
|
|
Restart-cause does everything. It reads the register, and updates it.
But _big caveat_ some bits in the register change when other things are configured, so restart_cause must be called before any major configuration changes after boot, otherwise the value may be invalid. |
|
|
|