Rivian Irvine Team
/
TCTF_Control_Main
Control Code with I/O and ADC working
Diff: LTC2487/LTC2487.cpp
- Revision:
- 6:c980535393ed
- Parent:
- 5:0f38a0bd4f86
- Child:
- 7:8a5e65e63e2a
--- a/LTC2487/LTC2487.cpp Thu Mar 01 21:13:55 2018 +0000 +++ b/LTC2487/LTC2487.cpp Wed Mar 07 18:50:10 2018 +0000 @@ -53,14 +53,14 @@ //send message to select channel i2c.write((addrI2C<<1)|(I2C_WRITE), ADC_channel, 1); //must wait, otherwise breaks... - wait(0.08); + wait(0.1); //send configuration (1 gain, autocalibration) i2c.write((addrI2C<<1)|(I2C_WRITE), ADC_config, 1); //must wait, otherwise breaks... - wait(0.08); + wait(0.1); //Read data from selected channel --> 24bits --> 23bit=SIGN 22bit=MSB 21-7bits=DATA 5-0bits=JUNK i2c.read((addrI2C<<1)|(I2C_READ), ADC_data_rx, 3); - wait(0.08); + wait(0.1); //Stitch together the bytes into a 24bit value unsigned long data = (ADC_data_rx[0] << 16) | (ADC_data_rx[1] << 8)| ADC_data_rx[2]; //Delete SIGN bit and MSB bit and remove 6 JUNK bits