|
发表于 2013-7-6 00:36:20
|
显示全部楼层
Just to help you a little bit, here is what I use for the same device:
- unsigned char pcf8591_read(unsigned char ch) {
- unsigned char tmp;
- i2c_start(); //send the i2c start condition
- i2c_write(_pcf8591_addr | I2C_CMD_WRITE); //write
- i2c_write(ch); //send the control byte
- i2c_restart(); //send the restart condition
- i2c_write(_pcf8591_addr | I2C_CMD_READ);
- tmp=i2c_read(I2C_NOACK);
- i2c_stop(); //send the stop condition
- return tmp;
- }
复制代码 You obviously will have to supply those i2c routines for your target chip.
|
|