Forceing a hardware reset
Alice Campbell [acampbell at SCSENGINEERS.COM] says:
This one traps WDT, MCLR, Cold boot, warm boot, deliberate timeouts, sleep, and other things.
Reqires a flag register called mflag here. This router dumps all mystery states to the wmbt routine which initializes everything and puts selected registers on the rs232 output line for analysis.;; org 0 nop ; goto top ; org 0x004 top call init CLRF PORTA CLRF PORTC clrf PORTB ; clrf mflag ;for debugging purposes especially simulator ;parse the big guys btfsc status,TO ;status,4 GOTO TO1 ;to=1 wmbt or startup GOTO TO0 ;to=0 wdt in sleep or wdt TO0 btfss status,PD ;this actually is used goto wmbt ;to=0 pd=0 reset+clrwdt goto wozat ;to=0 pd=1 wdt TO1 btfss status,PD ;hello? hello? goto main ;to=1 pd=1 powerup goto wmbt ;to=1 pd=0 sleeeeeeeep ;parse out the flags next ;sort of a state machine i guess wotrst btfsc mflag,0 ;mclr+sleeping? not done, dump goto wmbt;zzz ;decrement lsb of sleep or continue t_6 btfsc mflag,6 ;err goes to dump goto wmbt ;dont clear this in wmbt t_7 btfsc mflag,7 ;decrement sleep loop goto woof t_0 btfsc mflag,0 ;main sleep goto zzzz t_2 btfsc mflag,2 ; during readout goto mopup ;restore old address and goto readlp t_1 btfsc mflag,1 ;flag for end of write loop goto disp t_4 btfsc mflag,4 ;setup area goto loopw t_5 btfsc mflag,5 goto loopw dunno goto wmbt ;dont know why were here ;))))))))main starts((((((((
|file: /Techref/microchip/startcause.htm, 2KB, , updated: 2003/12/10 15:33, local time: 2018/2/19 11:44,
|©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/microchip/startcause.htm"> PIC Microcontoller Methods - Detecting the cause of a Startup</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20180219 RussellMc, Sean Breheny, Van Horn, David, Darron Black, Harold Hallikainen, Isaac M. Bavaresco, David C Brown, Mario, alan.b.pearce, Bob Blick,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!