Hi all,
Have been playing with ByVac 10ch 10-bit I2C A-D Converters.
Managed to get them working under Arduino (despite the datasheet/code examples being a bit crytic).
Here's my code, seems to work fine:-
unsigned int AI_RawBV4205[10];
for (int AIi=0;AIi<10;AIi++){ // scan round all 10 AI channels
Wire.beginTransmission(0x31); // join I2C, talk to BV4205 by Addr 31 (7bit) = 62 BV addr.
Wire.send(0x01); //select channel command
Wire.send(AIi); //ch. 0 to 9
Wire.endTransmission();
Wire.beginTransmission(0x31);
Wire.send(0x02); //do conversion
Wire.endTransmission();
Wire.beginTransmission(0x31);
Wire.send(0x04); //result of conversion
Wire.endTransmission();
Wire.beginTransmission(0x31);
Wire.requestFrom(0x31, 2); //get 2-byte
while(Wire.available() < 1);
for (int i=0;i<2;i++){
data[i]=Wire.receive();
}
Wire.endTransmission(); // leave I2C bus
AI_RawBV4205[AIi] = ((unsigned int)data[0] << 8) | data[1]; // combine 2 bytes into 1 unsigned int, value 0-1023
}
And if you want to change the I2C address embedded in EEprom within the BV4205, as follows:
//change address of BV4205 I2C address
//change address from default (0x31) to 0x32
Wire.beginTransmission(0x31); // join I2C, talk to BV4206 by id
Wire.send(0x99); //change address command
Wire.send(0x32 << 1); //new address (7 bit)
Wire.send(0x55); //check code - do not change
Wire.send(0xaa); //double check code - do not change
Wire.send(0x31 << 1); //current address (7 bit)
Wire.endTransmission();