Wire.begin();
Wire.beginTransmission(0x50);
Wire.write(0xA0); // Enter the command mode
Wire.endTransmission();
Wire.requestFrom(0x06, 3); // Retrieve the value of C_Config
byte a = Wire.read();
byte b = Wire.read();
byte c = Wire.read();
But what I get is 255, not the default value.
What is the problem?
I think the first bit (bit 0) of the address byte is read/write bit. So it you are writing to device then bit 0 of address byte will be 0 and the other address field has to be shifted 1 bit to left to form the address byte.
I find that Arduino only needs first high 7 bits. I think it does not need to write last bit.
But I still do not know how to enter command mode and retrieve the value of register.
Just read about using wire.requestFrom, apparently you have to use the address device as the argument which as you stated is 0x50. I am assuming the 3 registers starting from 0x06 are the registers you want to read? With the arduino wire library i dont think you can read starting from that address and you have to start from 0x00. So maybe use
Code:
byte buffer[10];// just use a large buffer
int ii = 0;
wire.requestFrom(0x50, 10);//request 10 bytes from device
for(ii =0; ii <10; ii++){
buffer[ii] = wire.read();
}
//register 0x06 is in buffer[0x06] and so on