please dont rip this site

PIC Microcontoller Methods

Detecting the cause of a Startup

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((((((((

See also:


file: /Techref/microchip/startcause.htm, 2KB, , updated: 2003/12/10 15:33, local time: 2024/12/21 17:02,
TOP NEW HELP FIND: 
18.224.38.176: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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/microchip/startcause.htm"> PIC Microcontoller Methods - Detecting the cause of a Startup</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .