WREG3 equ 01h ; a 3rd working reg :-)
WREG4 equ 02h ; a 4th working reg :-)
BLANK equ 03h ; register full of zeros
+TESTFLASH equ 04h ; test LED flash pattern
; VECTORS: special locations, where the PIC starts executing
; after interrupts
+
+ org 0
+ goto vector_reset
+
+
; high priority interrupt
;
; org 000008h
readout_led_on
bcf TRISD,2,0 ; make pin RD2 an output (DS100)
ifbit0 WREG3,0
- bcf LATD,2,0 ; set LED red
+ bcf LATD,2,0 ; led red
ifbit1 WREG3,0
- bsf LATD,2,0 ; set LED green
+ bsf TRISD,2,0 ; led black
incf WREG4,1,0 ; increment loop counter
call waiting
goto readout_loop
code
;****************************************************************************
+
+vector_reset
+
; serial set-up
; enable interrupts so that this can be used as a trigger for the
; panic routine
clrf INTCON,0 ; disable all interrupts EVER
bcf PORTC,1,0 ; switch off booster
+ movlw 10101100b
+ movwf TESTFLASH
+
+
; re-initialise timer0 config
bcf T0CON,6,0 ; p107 Timer0 -> 16bit mode
bcf T0CON,5,0 ; timer0 use internal clock
clrf BLANK,0
panic_loop
; errmsg err_SOS,RED ; transmit SOS in red
- readout SSPCON1,RED ; transmit contents of SSPCON1 in red
+ readout TESTFLASH,RED ; transmit contents of SSPCON1 in red
; readout BLANK,RED ; transmit blank buffer
+ call led_green
+ call waiting
goto panic_loop
;****************************************************************************