4 unsigned char ReadPCF8591(char address, char channel) {
6 unsigned char id=PCF8591_ID + address<<1;
9 //fprintf (stderr, "I2C bus busy, retrying.\n");
12 i2cTransmitBuffer[0]=channel&0x03 + 0x40; //output enable, not autoincrement
13 //i2cTransmitBuffer[1]=0; // dac output
15 // read 2 bytes, since the first one is the old value
16 if (I2CSendReceive(id, 1, 2))
19 return i2cReceiveBuffer[1];