I'm looking for a example code/sketch to read
from an ADS1100 16bit ADC using Wire-library.
thx wally
OK , works nice now
/*
* Arduino reads ADS1100 I2C 16bit diff ADC
*/
/*
SDA ==> analog 4 PC4
SCL ==> analog 5 PC5
set register: STBY 0 0 SC DR1 DR0 PGA1 PGA0
default 1 0 0 0 1 1 0 0 0x8C
i want 1 0 0 0 1 1 0 0
ign 0 0 con 8SPS GAIN 1
STBY, only for single mode to start conversion
SC 1= single , 0=continuous
DR1:0 datarate 00 = 128sps, 12 bit -2048 to 2047
01 = 32sps, 14 -8192 to 9191
10 = 16sps, 15 -16384 to 16383
11 = 8sps, 16 -32768 to 32767
PGA1:0 Gain 00 = *1, 01 = *2, 10 = *4, 11 = *8
*/
#include <Wire.h>
// AD0 1001 000 r/w AD1 1001 001 r/w ; r=1. w=0
#define AD0 B1001000 // 7bit address
#define AD1 B1001001 // 7bit address
#define options B10001100 // 0x8C
uint8_t reg = 0;
int16_t result = 0;
void setup() {
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(AD1);
Wire.write(options);
Wire.endTransmission();
}
void loop() {
Wire.beginTransmission(AD1);
Wire.requestFrom(AD1, 3); // request 3 bytes from AD1
while(Wire.available()) {
result = Wire.read();
result = result << 8;
result += Wire.read();
reg = Wire.read();
Serial.print(result, DEC);
Serial.println("\t");
Serial.print((5000.00 * result)/ 0x7FFF, 2);
Serial.println(" mV");
Serial.println("_______________________");
}
Wire.endTransmission();
delay(2000);
}