diff options
Diffstat (limited to 'software/ctr/i2c.inc')
-rw-r--r-- | software/ctr/i2c.inc | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/software/ctr/i2c.inc b/software/ctr/i2c.inc index 52c90e3..9643355 100644 --- a/software/ctr/i2c.inc +++ b/software/ctr/i2c.inc @@ -31,33 +31,33 @@ ;; ------------------------------------- i2c_start movlb .1 - bcf TRISB,I2C_SDA + bcf I2C_SDA nop - bcf TRISB,I2C_SCL + bcf I2C_SCL movlb .0 return ;; ------------------ i2c_restart movlb .1 - bsf TRISB,I2C_SDA + bsf I2C_SDA nop - bsf TRISB,I2C_SCL + bsf I2C_SCL nop nop nop - bcf TRISB,I2C_SDA + bcf I2C_SDA nop - bcf TRISB,I2C_SCL + bcf I2C_SCL movlb .0 return ;; ------------------ i2c_stop movlb .1 - bsf TRISB,I2C_SCL + bsf I2C_SCL nop - bsf TRISB,I2C_SDA + bsf I2C_SDA movlb .0 return @@ -69,27 +69,27 @@ i2c_send_byte movlb .1 i2c_send_byte_next btfss I2C_BYTE,7 - bcf TRISB,I2C_SDA + bcf I2C_SDA btfsc I2C_BYTE,7 - bsf TRISB,I2C_SDA + bsf I2C_SDA nop - bsf TRISB,I2C_SCL + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL + bcf I2C_SCL rlf I2C_BYTE,f decfsz I2C_BIT_CNT,f goto i2c_send_byte_next nop nop - bsf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bsf I2C_SDA + bsf I2C_SCL movlb .0 movf PORTB,w movlb .1 - bcf TRISB,I2C_SCL - bcf TRISB,I2C_SDA + bcf I2C_SCL + bcf I2C_SDA movlb .0 andlw b'00010000' movwf I2C_BYTE @@ -102,18 +102,18 @@ i2c_recv_byte movlw .8 movwf I2C_BIT_CNT movlb .1 - bsf TRISB,I2C_SDA + bsf I2C_SDA i2c_recv_byte_loop - bsf TRISB,I2C_SCL + bsf I2C_SCL movlb .0 - btfsc PORTB,I2C_SDA + btfsc I2C_SDA bsf I2C_BYTE,0 movlb .1 - bcf TRISB,I2C_SCL + bcf I2C_SCL decfsz I2C_BIT_CNT,f goto i2c_recv_byte_next - bcf TRISB,I2C_SDA + bcf I2C_SDA movlb .0 return @@ -125,23 +125,23 @@ i2c_recv_byte_next ;; ------------------ i2c_ack movlb .1 - bcf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bcf I2C_SDA + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL + bcf I2C_SCL movlb .0 return ;; ------------------ i2c_nack movlb .1 - bsf TRISB,I2C_SDA - bsf TRISB,I2C_SCL + bsf I2C_SDA + bsf I2C_SCL nop nop - bcf TRISB,I2C_SCL - bcf TRISB,I2C_SDA + bcf I2C_SCL + bcf I2C_SDA movlb .0 return |