From: ian Date: Mon, 19 Dec 2005 11:47:05 +0000 (+0000) Subject: arrange to call serialrx_generalmsg at the right point X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=a85bb5d34f42ad95b262fba3b00da0321ca17f9f;p=trains.git arrange to call serialrx_generalmsg at the right point --- diff --git a/detpic/nmra-stream.asm b/detpic/nmra-stream.asm index 7105ddb..9c93b8e 100644 --- a/detpic/nmra-stream.asm +++ b/detpic/nmra-stream.asm @@ -190,16 +190,15 @@ fixme need to check both interrupt handlers here and look for refies too movlw bufferpage movwf FSR0H,0 ; set high byte of INDF0 pointer ; debug '1' - movff RCREG,INDF0 ; copy to received register -; debug '2' + mov_fw RCREG ; get received byte + mov_wf INDF0 ; copy to received register -; check whether bit 7 is set. If so, move to next buffer. - btfsc INDF0,7,0 ; check if bit 7 is set - call advance_write_buffer ; if so, move to next buffer +; check whether bit 7 is clear. +; If so, move to next buffer (or process other kind of message) + bra_nn end_message ; (STATUS N still from mov_fw RCREG) ; debug '3' ; If not, move to next byte - btfss INDF0,7,0 ; check if bit 7 is set incf fromserial,1,0 ; advance fromserial pointer by 1 byte ; debug '4' @@ -209,8 +208,16 @@ fixme need to check both interrupt handlers here and look for refies too ; *** I *think* the interrupt bit is cleared by reading out of RCREG ; but this may be something to try in debugging if stuff doesn't work +end_message +; so what's the first byte then ? + mov_lw 0xf0 + and_wff FSR0L + and_wff fromserial + com_fw INDF0 + bra_nz not_nmra_message - +; so, first byte is FF (since complement of it is zero) +; so, move to next buffer advance_write_buffer ; clear low 4 bits of fromserial and increment top 4 bits @@ -228,6 +235,9 @@ advance_write_buffer return +not_nmra_message + call serialrx_generalmsg + intrl_handled_nostack ;****************************************************************************