|
刚调通1226!!
I/O口和CLK口加上拉电阻,按时序走,应该没问题!
前天我刚调通了X1226,时间读写。
送一段读写汇编程序:
I2CTX
mov.b #08h,&BITI2C
bic.b #SDA,&P6OUT
bic.b #SCL,&P6OUT
clrc
I2C_Tend
rrc.b TXI2C
jc I2C_Tend1
I2C_Tend0
bic.b #SDA,&P6OUT
jmp I2C_Tx
I2C_Tend1
bis.b #SDA,&P6OUT
I2C_Tx
call #I2CDLY
call #I2CDLY
call #I2CDLY
bis.b #SCL,&P6OUT
call #I2CDLY
call #I2CDLY
call #I2CDLY
bic.b #SCL,&P6OUT
call #I2CDLY
call #I2CDLY
dec.b BITI2C
jnz I2C_Tend
ret
I2CRX
clrc
bis.b #SDA,&P6OUT
mov.b #08h,BITI2C
call #I2CDLY
I2C_Rend
bit.b #SDA,&P6IN
jnz I2C_Rend1
I2C_Rend0
clrc
rrc.b RXI2C
jmp I2C_Rx
I2C_Rend1
setc
rrc.b RXI2C
I2C_Rx
bis.b #SCL,&P6OUT
call #I2CDLY
call #I2CDLY
bic.b #SCL,&P6OUT
call #I2CDLY
call #I2CDLY
dec.b BITI2C
jnz I2C_Rend
ret |
|