I'm trying to write a code like it's adviced in the LTC2485 ADC.
It's easy in C language but in PICBasic pro I have some promblems with the I2CRead command with 4 bytes and also to convert the complement's 2. Anyone can help me?
The C model:
Code:
x ^= 0x80000000; // Invert MSB, result is 2ís complement
voltage = (float) x; // convert to float
voltage = voltage * 5.0 / 2147483648.0;// Multiply by Vref, divide by 2^31
My code start, but I'm not sure that the I2CRead is right:
Code:
I2CREAD PORTC.4,PORTC.3,adr_can1,[voltage.byte3,voltage.byte2,voltage.byte1,voltage.byte0]
...
...