chiark / gitweb /
start of informative_panic routine
authorceb <ceb>
Wed, 23 Feb 2005 23:42:44 +0000 (23:42 +0000)
committerceb <ceb>
Wed, 23 Feb 2005 23:42:44 +0000 (23:42 +0000)
cebpic/i2c-test.asm

index b15ccc5de60b8a4669d0e910b83ab4ea21bdbadd..6eae272d0007adc5c4bb80b3ea889b8434809915 100644 (file)
@@ -521,7 +521,44 @@ panic
 
 panic_loop
        goto    panic_loop
+
+
+;----------------------------------------
+informative_panic
+; switch off interrupts and power
+; reconfigure timer0 for writing diagnostic msg to the LED
+; 
        
+       clrf    INTCON,0        ; disable all interrupts EVER
+       bcf     PORTC,1,0       ; switch off booster
+
+; re-initialise timer0 config
+        bcf     T0CON,6,0       ; p107 Timer0 -> 16bit mode
+        bcf     T0CON,5,0       ; timer0 use internal clock
+        bcf     T0CON,3,0       ; use prescaler
+        bsf     T0CON,2,0       ; }
+        bcf     T0CON,1,0       ; } prescale value 1:32 (13ms x 32)
+        bcf     T0CON,0,0       ; }
+
+; 
+
+
+
+
+;----------------------------------------
+waiting
+; wait for timer0 interrupt
+        bcf     INTCON,2,0      ; clear timer0 interrupt bit (p109)
+        clrf    TMR0H,0         ; p107 set high bit of timer0 to 0 (buffered,
+                                ; only actually set when write to tmr0l occurs)
+        clrf    TMR0L,0         ; set low bit o timer0 - timer now set to 0000h
+loop
+        btfss   INTCON,2,0      ; check whether timer0 interrupt has been set -
+                                ; skip next instruction if so
+        bra     loop
+        return
+
+
 ;****************************************************************************
 
        end