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((((((((
See also:
file: /Techref/microchip/startcause.htm, 2KB, , updated: 2003/12/10 15:33, local time: 2024/11/17 10:46,
3.137.164.139:LOG IN
|
©2024 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://massmind.ecomorder.com/techref/microchip/startcause.htm"> PIC Microcontoller Methods - Detecting the cause of a Startup</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.