![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Control Code with I/O and ADC working
Diff: LTC2487/LTC2487.cpp
- Revision:
- 5:0f38a0bd4f86
- Parent:
- 2:bd118a724f03
- Child:
- 6:c980535393ed
--- a/LTC2487/LTC2487.cpp Tue Feb 13 20:30:59 2018 +0000 +++ b/LTC2487/LTC2487.cpp Thu Mar 01 21:13:55 2018 +0000 @@ -53,13 +53,14 @@ //send message to select channel i2c.write((addrI2C<<1)|(I2C_WRITE), ADC_channel, 1); //must wait, otherwise breaks... - wait(0.1); + wait(0.08); //send configuration (1 gain, autocalibration) i2c.write((addrI2C<<1)|(I2C_WRITE), ADC_config, 1); //must wait, otherwise breaks... - wait(0.1); + wait(0.08); //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); //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