?? i2c.inc
字號:
* filename : i2c.inc *
* -contains all constants and flags used in program *
*I2CSTATUS Register
*Status of I2C transmission
*+---------------------------------------------------------------------------------+
*| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 5 | 4 | 3 | 2 | 1 | 0 |
*+---------------------------------------------------------------------------------+
*|DISA|CTRL|SUCC|ERR |ACK |STOP|CLKL|CLKH|Start| Mode |Addr| Pre | Pre | Cur | Cur |
*| | | | | | | | | | | | SCL | SDA | SCL | SDA |
*+---------------------------------------------------------------------------------+
K_CSDA_1 .set 0000000000000001b ;current SDA is high
K_CSDA_0 .set 1111111111111110b ;current SDA is low
K_CSCL_1 .set 0000000000000010b ;current SCL is high
K_CSCL_0 .set 1111111111111101b ;current SCL is low
K_PSDA_1 .set 0000000000000100b ;previous SDA is high
K_PSDA_0 .set 1111111111111011b ;previous SDA is low
K_PSCL_1 .set 0000000000001000b ;previous SCL is high
K_PSCL_0 .set 1111111111110111b ;previous SCL is low
K_ADDR_1 .set 0000000000010000b ;Slave address flag on
K_ADDR_0 .set 1111111111101111b ;
K_READ_FROM_SLAVE .set 0000000001000000b ;DSP read from slave
K_WRITE_TO_SLAVE .set 0000000000100000b ;DSP write to slave
K_READ_FROM_MASTER .set 0000000000000000b ;DSP read from master
K_WRITE_TO_MASTER .set 0000000001100000b ;DSP write to master
K_START_1 .set 0000000010000000b ;Start condition
K_START_0 .set 1111111101111111b ;Not start condition
K_CLKH_1 .set 0000000100000000b ;next interrupt set SCL=high
K_CLKH_0 .set 1111111011111111b ;disable this feature
K_CLKL_1 .set 0000001000000000b ;next interrupt set SCL=low
K_CLKL_0 .set 1111110111111111b ;disable this feature
K_STOP_1 .set 0000010000000000b ;Stop condition
K_STOP_0 .set 1111101111111111b ;disable this feature
K_ACK_1 .set 0000100000000000b ;Next interrupt is ACK
K_ACK_0 .set 1111011111111111b ;disable this feature
K_ERR_1 .set 0001000000000000b ;Error
K_ERR_0 .set 1110111111111111b ;
K_SUCC_1 .set 0010000000000000b ;I2C protocol enable
K_SUCC_0 .set 1101111111111111b ;disable
K_DISA_1 .set 1000000000000000b ;I2C protocol disable
K_DISA_0 .set 0111111111111111b ;enable
K_RESET_I2C .set 0
K_I2C_READ .set 1 ;Attach a R/W bit at the
K_I2C_WRITE .set 0 ;end of slave address
*ERRORMSG Register
*Error message of I2C
* +------------------------+
* | 15 3 | 2 1 0 |
* +------------------------+
* | xxxx | ERRCODE |
* +------------------------+
K_ERR_NO_ERROR .set 000b
K_ERR_NOACK .set 001b
K_ERR_UNKNOWN .set 010b
;************************
;***USER PERFERENCE SETUP
;************************
;***SETUP SLAVE ADDRESS*************************************************************
K_SLAVEADDR .set 0100100B ;set slave address (7bits)
;***********************************************************************************
;***SELECT SITUATIONS TO STOP DATA TRANSFER*****************************************
K_DISABLE_I2C .set K_SUCC_1 ;Stop after transfer is over
;K_DISABLE_I2C .set K_SUCC_1|K_ERR_1|K_DISA_1 ;Stop when error or disable occurs
;***********************************************************************************
;*******************************
;***END OF USER PERFERENCE SETUP
;*******************************
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -