From e54d76edba3fba503a9e810642a66a16ad7d8104 Mon Sep 17 00:00:00 2001 From: ceb Date: Mon, 2 May 2005 21:43:20 +0000 Subject: [PATCH] now in morse! --- cebpic/morsepanic.asm | 84 +++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/cebpic/morsepanic.asm b/cebpic/morsepanic.asm index 629d963..fb77d5b 100644 --- a/cebpic/morsepanic.asm +++ b/cebpic/morsepanic.asm @@ -22,6 +22,7 @@ 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 +MORSE_MSG_LENGTH equ 04h ; lenght of morse messages in bytes @@ -29,8 +30,8 @@ TESTFLASH equ 04h ; test LED flash pattern ; memory location definitions ERROR_BUF_PAGE equ 3 ; error codes on flash p3 -F_ERROR_U equ 30h ; upper part of error memory locations -F_SOS_H equ 00h ; high (middle) part of SOS error memory loc. +F_ERROR_U equ 00h ; upper part of error memory locations +F_SOS_H equ 40h ; high (middle) part of SOS error memory loc. F_SOS_L equ 00h ; lower part of SOS error memory loc. @@ -57,7 +58,18 @@ err_SOS equ 0 ; msg 0 = SOS org 000018h goto interrupt_low -; + +;**************************************************************************** +;ERROR MSGS + + org 4000h + dw 1110111010101000b + dw 1010000011100010b + +;--------------------------------------------------------------------------- +; Main - go to interrupt + goto interrupt_low + ;**************************************************************************** code @@ -99,40 +111,9 @@ vector_reset bsf PIE1,5,0 ; enable USART receive interrupt (p85) ;--------------------------------------------------------------------------- - -; write error code for SOS into flash memory (starting at 30 0000h) - movlw F_ERROR_H ; set table pointer to point to - movwf TBLPTRU ; start of flash p3 - movlw F_SOS_H - movwf TBLPTRH - movlw F_SOS_L - movwf TBLPTRL - -; write message into memory, incrementing tbl pointer each time - - movlw 10101000b - movwf TABLAT - tblwt*+ - - movlw 11101110b - movwf TABLAT - tblwt*+ - - movlw 11100010b - movwf TABLAT - tblwt*+ - - movlw 10100000b - movwf TABLAT - tblwt*+ - ;--------------------------------------------------------------------------- -; turn LED green if we have made it this far.... - - call led_green -main_loop_led - goto main_loop_led - +; Main - go to interrupt + goto interrupt_low ;**************************************************************************** ; INTERRUPT SUBROUTINES @@ -147,9 +128,6 @@ informative_panic 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 @@ -159,15 +137,11 @@ informative_panic bsf T0CON,1,0 ; } prescale value 1:16 (13ms x 16) bsf T0CON,0,0 ; } - clrf BLANK,0 panic_loop -; errmsg err_SOS,0 ; transmit SOS in red - movff TESTFLASH,WREG2 - rcall readout -; readout BLANK,0 ; transmit blank buffer - call led_black call waiting + call led_green call waiting + call morse_msg_start ; transmit SOS in red goto panic_loop ;**************************************************************************** @@ -177,27 +151,27 @@ morsemsg ; 8-byte msg morse_msg_start - movlw F_ERROR_H ; set table pointer to point to + movlw F_ERROR_U ; set table pointer to point to movwf TBLPTRU ; start of flash p3 movlw F_SOS_H movwf TBLPTRH movlw F_SOS_L movwf TBLPTRL - clrf WREG3,0 ; clear loop counter (WREG4) + clrf WREG3,0 ; clear loop counter (WREG3) morse_loop - movlw 8 - cpfslt WREG3,0 ; if loop counter >=8, goto start of msg - goto morse_msg_start + movlw MORSE_MSG_LENGTH + cpfslt WREG3,0 ; if loop counter >=MORSE_MSG_LENGTH, + ; retun to panic + return tblrd*+ movff TABLAT,WREG2 call readout - incf WREG3 + incf WREG3,1,0 goto morse_loop - ;-------------------------- readout ; Flashes the per-pic led red(0) and green(1) in a specified pattern. @@ -222,17 +196,15 @@ readout_loop bn readout_if_led_1 readout_if_led_0 - call led_red + call led_black bra readout_endif_led readout_if_led_1 - call led_green + call led_red readout_endif_led incf WREG4,1,0 ; increment loop counter call waiting - call led_black - call waiting bra readout_loop ;**************************************************************************** -- 2.30.2