From e851b9cb7b3e7c558288f29bc6e20d0e8828922a Mon Sep 17 00:00:00 2001 From: ceb Date: Wed, 23 Feb 2005 23:42:44 +0000 Subject: [PATCH] start of informative_panic routine --- cebpic/i2c-test.asm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/cebpic/i2c-test.asm b/cebpic/i2c-test.asm index b15ccc5..6eae272 100644 --- a/cebpic/i2c-test.asm +++ b/cebpic/i2c-test.asm @@ -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 -- 2.30.2