From: ceb Date: Sun, 15 May 2005 20:48:16 +0000 (+0000) Subject: changed morsepanic to have 2 readout routines (one for flashing a morse X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3690c15dfc7182bb2701554f686241da6d8a92cd;p=trains.git changed morsepanic to have 2 readout routines (one for flashing a morse message, 2nd for flashin the contents of a register in red(0)+blue(1)) --- diff --git a/cebpic/morsepanic.asm b/cebpic/morsepanic.asm index fb77d5b..f5daa44 100644 --- a/cebpic/morsepanic.asm +++ b/cebpic/morsepanic.asm @@ -138,21 +138,25 @@ informative_panic 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 @@ -167,15 +171,16 @@ morse_loop 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. @@ -183,29 +188,80 @@ readout ; 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