bsf T0CON,0,0 ; }
panic_loop
+ call led_black
call waiting
- call led_green
+ call morsemsg ; transmit SOS in red
+ call led_black
call waiting
- call morse_msg_start ; transmit SOS in red
+ call registermsg ; transmit contents of TESTFLASH in
+ ; red(=low) and blue(=high)
goto panic_loop
;****************************************************************************
; PANIC SUBROUTINES
+
morsemsg
-; wrapper round readout to flash the per-pic led red&blue for an
-; 8-byte msg
+; wrapper round readout to flash the per-pic led red for a
+; (currently 4-byte) morse msg
morse_msg_start
movlw F_ERROR_U ; set table pointer to point to
- movwf TBLPTRU ; start of flash p3
+ movwf TBLPTRU ; start of msg
movlw F_SOS_H
movwf TBLPTRH
movlw F_SOS_L
return
tblrd*+
movff TABLAT,WREG2
- call readout
+ call morse_readout
incf WREG3,1,0
goto morse_loop
;--------------------------
-readout
-; Flashes the per-pic led red(0) and green(1) in a specified pattern.
-; (black gap between each bit)
+morse_readout
+
+; Flashes the per-pic led red(0) in a specified pattern.
+;
; The pattern is specified as the state for 8 identically-long time
; periods each as long as a morse `dot', encoded into a byte with
; most significant bit first.
; W any undefined
; WREG2 flash pattern preserved
; WREG4 any undefined
-;
+
clrf WREG4,0 ; clear loop counter (WREG4)
rrncf WREG2,1
-readout_loop
+morse_readout_loop
movlw 8
cpfslt WREG4,0 ; if loop counter >=8, return
return
rlncf WREG2,1 ; top bit goes into N flag, ie Negative if 1
- bn readout_if_led_1
+ bn morse_readout_if_led_1
-readout_if_led_0
+morse_readout_if_led_0
call led_black
- bra readout_endif_led
+ bra morse_readout_endif_led
-readout_if_led_1
+morse_readout_if_led_1
call led_red
-readout_endif_led
+morse_readout_endif_led
incf WREG4,1,0 ; increment loop counter
call waiting
- bra readout_loop
+ bra morse_readout_loop
+
+;--------------------------
+;--------------------------
+registermsg
+
+ mov_ff TESTFLASH,WREG2
+ call register_readout
+ return
+;--------------------------
+
+register_readout
+
+; Flashes the per-pic led red(0) and green(1) in a specified pattern.
+; (black gap between each bit)
+;
+; The pattern is specified as the state for 8 identically-long time
+; periods each as long as a morse `dot', encoded into a byte with
+; most significant bit first.
+; On entry On exit
+; W any undefined
+; WREG2 flash pattern preserved
+; WREG4 any undefined
+
+ clrf WREG4,0 ; clear loop counter (WREG4)
+ rrncf WREG2,1
+
+register_readout_loop
+ movlw 8
+ cpfslt WREG4,0 ; if loop counter >=8 (register length), return
+ return
+
+ rlncf WREG2,1 ; top bit goes into N flag, ie Negative if 1
+ bn register_readout_if_led_1
+
+register_readout_if_led_0
+ call led_red
+ bra register_readout_endif_led
+
+register_readout_if_led_1
+ call led_green
+
+register_readout_endif_led
+ incf WREG4,1,0 ; increment loop counter
+ call waiting
+ call led_black
+ call waiting
+ bra register_readout_loop
+
+
+
+
;****************************************************************************
; GENERAL SUBROUTINES