PIC18C,C18 compiler restart after deep sleep just lke reset

Hi from Diego

please someone could explain me the correct way to do this?

In a Low level interrupt i go in Deep Sleep Mode,just after having set for wake up from an event(EXt Int).The datasheet says that i can trigger another interrupt from that,but it is not necessary,just the fact that an interrupt was flagged is enough to wake up. At this point i would like to put my micro in almost the same condition as reset,i mean that i would like that the Program Counter starts again at the beginning of the program,the stack is clean as it is after reset with the stack pointer pointing a sit points after reset,but i dont want to intialize register,because i want to monitor if during sleep a DSBOR (Deep Sleep Brown Out) occurred. Please, can you explain me how?

This because if during the backup VDD fails too low(...1.2V) during deep sleep it happens that the RTCC stops,leavng its hours,minute etc registers frozen,but not in default state. Once i symply gave RESET after wake up,then checking if RTCC.Year was at its default value .If yes, i considered RTCC had lost time,signalling to the user the need to reprogram it.And this is what happens if VDD goes very low,0.9 V or less. My idea is to check the DSBOR bit after wake up,if a Bown Out happened i reset the micro,regardless if the RTCC is still working.

Thanks for your attention

Any hint will be considered precious

Diego

Reply to
blisca
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.