Hello
I'm using a Arduino Nano to accessing via I2C.
my Commands are:
const byte extADDR = 0x40;
bool write(uint8_t addr, uint8_t reg, uint8_t data) { uint8_t _adr = extADDR | addr; //addiere Adresse und Offset durch I2CADDR Wire.beginTransmission(_adr); //Start Wire.write(reg); //Register Wire.write(data); //Daten return (Wire.endTransmission() == 0); //Übertragung beginnen } uint8_t read(uint8_t addr, uint8_t reg) { uint8_t _adr = extADDR | addr; //addiere Adresse und Offset durch I2CADDR uint8_t ret; Wire.beginTransmission(_adr); //Start Wire.write(reg); //Register Wire.endTransmission(); //Stop Wire.requestFrom(_adr | 1, 1); //nochmal Start & Leseadresse ansprechen (+1) while (Wire.available()) ret=Wire.read(); return ret; //byte Lesen }
When i diasable COMPENSATION RESET
write(0x0, 0x0C, 0b00000011);
i'm able to accessing the pure PADC Values with Register 20 to 22
long getData()
{ uint8_t byte1, byte2, byte3; byte3 = read(0x2, 0x20); //LSB byte2 = read(0x2, 0x21); byte1 = read(0x2, 0x22); //MSB long ausgabe = byte1; ausgabe <<= 8; ausgabe += byte2; ausgabe <<= 8; ausgabe += byte3; if (ausgabe > 0x7FFFFF) ausgabe -= 0x1000000; //falls Vorzeichenbit gesetzt (an bit24), 2er Komplement beachten return ausgabe; }
this works fine and the data make sense and are usable.
when i try to use the compensated values i just getting rubbish.
after disabling COMP_CONTROL
write(0x0, 0x0C, 0b00000000);
i tried to get data like described on page 33 table 9.
it seems that byte1 is the MSB and every X conversation there is a 0b01111111 (=dec127) on byte2. the datas are also very noisy.
is there a way to get a compsated value out of the device? so i cant use all the fine compensation functions?
i'm able to accessing the eeprom, i made a dump of a fresh device, it's attached.
i read from 00 to 7F, the outputs are in binary format.
0 = 0 1 = 0 2 = 100000 3 = 0 4 = 0 5 = 0 6 = 0 7 = 0 8 = 0 9 = 0 A = 0 B = 0 C = 0 D = 0 E = 10000 F = 0 10 = 0 11 = 0 12 = 0 13 = 0 14 = 0 15 = 0 16 = 0 17 = 0 18 = 0 19 = 0 1A = 0 1B = 0 1C = 0 1D = 0 1E = 0 1F = 0 20 = 0 21 = 0 22 = 0 23 = 0 24 = 0 25 = 0 26 = 0 27 = 0 28 = 0 29 = 0 2A = 0 2B = 0 2C = 0 2D = 0 2E = 0 2F = 0 30 = 1100110 31 = 1 32 = 0 33 = 1000 34 = 1 35 = 10000000 36 = 10 37 = 1000011 38 = 0 39 = 1 3A = 0 3B = 0 3C = 0 3D = 0 3E = 11111111 3F = 111111 40 = 0 41 = 0 42 = 11111111 43 = 111111 44 = 1 45 = 0 46 = 0 47 = 0 48 = 0 49 = 0 4A = 0 4B = 0 4C = 0 4D = 0 4E = 0 4F = 0 50 = 0 51 = 0 52 = 0 53 = 0 54 = 0 55 = 0 56 = 0 57 = 0 58 = 111 59 = 1110011 5A = 11111111 5B = 111111 5C = 11111111 5D = 111111 5E = 1 5F = 0 60 = 0 61 = 0 62 = 0 63 = 0 64 = 0 65 = 0 66 = 0 67 = 0 68 = 1 69 = 0 6A = 11111111 6B = 11111111 6C = 11111111 6D = 11111111 6E = 11111111 6F = 11111111 70 = 11111111 71 = 11111111 72 = 11111111 73 = 11111111 74 = 11111111 75 = 11111111 76 = 11111111 77 = 11111111 78 = 11111111 79 = 11111111 7A = 11111111 7B = 11111111 7C = 11111111 7D = 11111111 7E = 11111111 7F = 10010000