chiark / gitweb /
die correctly if _lack_ of ack; debug values right way round
authorian <ian>
Mon, 14 Feb 2005 02:48:17 +0000 (02:48 +0000)
committerian <ian>
Mon, 14 Feb 2005 02:48:17 +0000 (02:48 +0000)
cebpic/i2c-test.asm

index 86f54c810a48681f6d40378cff387ae7f28bb9ce..fa92b70aa8aae9ecd3c6f422099350beb5d69e69 100644 (file)
@@ -118,18 +118,18 @@ debughf macro register
 
 debughf_subroutine
        call    debughf_digit
-       swapf   DEBUGHF_VALUE,1,0
        call    debughf_digit
        return
 
 ;--------------------
 debughf_digit
-;      transmits bottom nybble of DEBUGHF_VALUE in hex
-;      through serial port, as above
+;      transmits top nybble of DEBUGHF_VALUE in hex
+;      through serial port, as above, and swaps nybbles
 ;                      Before          After
 ;      W               any             undefined
-; DEBUGHF_VALUE                xxxxDDDD        preserved
+; DEBUGHF_VALUE                BBBBaaaa        aaaaBBBB        (BBBB was sent)
 
+       swapf   DEBUGHF_VALUE,1,0
        movf    DEBUGHF_VALUE,0,0
        andlw   0x0f
        sublw   10
@@ -263,11 +263,11 @@ serial_rx_isr
 
        debug   'f'
 
-       btfss   SSPCON2,ACKSTAT,0       ; check for ack from slave (=0), if no
+       btfsc   SSPCON2,ACKSTAT,0       ; check for ack from slave (=0), if no
        goto    panic                   ; then panic, else
        movff   RCREG,SSPBUF            ; copy byte from serial to i2c buffer
        call    wait_for_i2c_interrupt
-       btfss   SSPCON2,ACKSTAT,0       ; check for ack from slave (=0), if no
+       btfsc   SSPCON2,ACKSTAT,0       ; check for ack from slave (=0), if no
        goto    panic                   ; then panic, else
        bsf     SSPCON2,PEN,0           ; i2c STOP
        call    wait_for_i2c_interrupt