A class to control the TI ADS1262 and ADS1263 analog to digital converters. This basically includes all functions of these two chips. Check the examples if it seems too complicated.
Note that all commands dealing with ACD2 are for the ADS1263 only, and have not been tested by me.
I tried to keep all commands in the order the datasheet is written in for ease of reading. Basic commands are on page 85, the register map is on page 88.
- Initialization
- General Commands
- Analog Read Functions
- Calibration Functions
- Power Functions
- Checksum Functions
- Status Functions
- Mode0 Functions
- Mode1 Functions
- Mode2 Functions
- GPIO Functions
Starts the class.
Sets up the chip and Arduino for usage. It also resets the chip.
uint8_t chip_select
is the Arduino pin used to start communication with the chip.
The same as the above function, but without the chip select. If you use this, tie the CS pin on the chip to ground. I don't recommend using this.
Optional. Designate an Arduino pin to start ADC1. If not used, a command will be sent instead.
Tells the chip to stop everything. Future commands will wake it back up.
Resets the chip.
Starts conversion on ADC1.
Stops conversion on ADC1.
Starts conversion on ADC2.
Stops conversion on ADC2.
Reads the 32 bit voltage between the two pins pos_pin
and neg_pin
.
These can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
ADS126X_AINCOM |
Pin AINCOM |
ADS126X_TEMP |
Temperature sensor monitor positive/negative |
ADS126X_ANALOG |
Analog power supply monitor positive/negative |
ADS126X_DIGITAL |
Digital power supply monitor positive/negative |
ADS126X_TDAC |
TDAC test signal positive/negative |
ADS126X_FLOAT |
Float (open connection) |
Reads the 24 bit voltage between the two pins pos_pin
and neg_pin
.
These can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
ADS126X_AINCOM |
Pin AINCOM |
ADS126X_TEMP |
Temperature sensor monitor positive/negative |
ADS126X_ANALOG |
Analog power supply monitor positive/negative |
ADS126X_DIGITAL |
Digital power supply monitor positive/negative |
ADS126X_TDAC |
TDAC test signal positive/negative |
ADS126X_FLOAT |
Float (open connection) |
Calibrates the system offset on ADC1. Short the pins externally, then run this command. Options can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
Calibrates the PGA on ADC1.
vcc_pin
should be connected to the maximum analog voltage,gnd_pin
to analog ground.
Options can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
Calibrates the self offset on ADC1.
Calibrates the system offset on ADC2. Short the pins externally, then run this command. Options can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
Calibrates the PGA on ADC2.
vcc_pin
should be connected to the maximum analog voltage,gnd_pin
to analog ground.
Options can be:
Option | Description |
---|---|
0 or ADS126X_AIN0 |
Pin AIN0 |
... | ... |
9 or ADS126X_AIN9 |
Pin AIN9 |
Calibrates the self offset on ADC2.
I didn't know what else to call this category. All functions have to do with the POWER register.
Indicates ADC reset has occurred. If 1, a new reset has occured. This should be 1 at start.
Sets the reset bit to 0.
Enables the internal level shift voltage to the AINCOM pin. Default disabled. VBIAS = (V_AVDD + V_AVSS)/2
Disables the internal level shift voltage to the AINCOM pin. Default disabled. VBIAS = (V_AVDD + V_AVSS)/2
Enables the 2.5V internal voltage reference. Note the IDAC and temperature sensor require the internal voltage reference. Enabled by default.
Disables the 2.5V internal voltage reference. Note the IDAC and temperature sensor require the internal voltage reference. Enabled by default.
If enabled, the chip will send a checksum during a voltage read to verify the data was sent correctly. These functions will set the mode, and return the verification.
Disable the checksum.
Make the device return a checksum value.
Make the device return a CRC value.
Return the computed last checksum/CRC value. If 0, the data was transmitted correctly.
If enabled, the chip will send the status of various parameters as part of each voltage read. All functions below will use the most recent status sent from the chip.
Enables the chip sending the status. Default enabled.
Disables the chip sending the status.
Returns the most recent status byte. More for debugging than anything.
If 1, ADC2 data is new since the last ADC2 read operation.
If 1, ADC1 data is new since the last ADC1 read operation.
If 0, ADC clock is internal. If 1, ADC clock is external.
This is the low reference voltage alarm of ADC1. The alarm bit is set if V_REF <= 0.4V, typical. If 0, no alarm. If 1, low reference alarm.
This is the ADC1 PGA absolute low voltage alarm. The bit is set if the absolute voltage of either PGA output is less than V_AVSS + 0.2V. See the PGA Absolute Output-Voltage Monitor section of the datasheet. If 0, no alarm If 1, PGA high voltage alarm
This is the ADC1 PGA absolute high voltage alarm. The bit is set if the absolute voltage of either PGA output is greater than V_AVDD - 0.2V. See the PGA Absolute Output-Voltage Monitor section of the datasheet. If 0, no alarm If 1, PGA high voltage alarm
This is the ADC1 PGA differential output range alarm. This bit is set if the PGA differential output voltage exceeds +105% FS or -105% FS. See the PGA Differential Output Monitor section of the datasheet. If 0, no alarm If 1, PGA differential range alarm
Indicates device reset. Device reset occurs at power-on, by the RESET/PWDN pin or by the reset command. This bit is the same as the RESET bit of the POWER register. If 0, no reset occurred since the RESET bit in power register last cleared by the user. If 1, device reset occurred
Functions having to do with the MODE0 register.
Puts the device into continuous read mode. Default.
Puts the device into pulse read mode. Normally you would need to call the startADC* function before every readADC* in this mode, but I have it automatically called.
Enables the ADC chop and ICAD rotation options.
Option | Description |
---|---|
ADS126X_CHOP_0 |
Input chop and IDAC rotation disabled (default) |
ADS126X_CHOP_1 |
Input chop enabled |
ADS126X_CHOP_2 |
IDAC rotaion enabled |
ADS126X_CHOP_3 |
Input chop and IDAC rotation enabled |
Provides additional delay from conversion start to the beginning of the actual conversion. Default no delay.
Option | Delay |
---|---|
ADS126X_DELAY_0 |
No delay |
ADS126X_DELAY_8700 |
8.7 s |
ADS126X_DELAY_17000 |
17 s |
ADS126X_DELAY_35000 |
35 s |
ADS126X_DELAY_69000 |
69 s |
ADS126X_DELAY_139000 |
139 s |
ADS126X_DELAY_278000 |
278 s |
ADS126X_DELAY_555000 |
555 s |
ADS126X_DELAY_1_1 |
1.1 ms |
ADS126X_DELAY_2_2 |
2.2 ms |
ADS126X_DELAY_4_4 |
4.4 ms |
ADS126X_DELAY_8_8 |
8.8 ms |
Functions having to do with the MODE1 register.
Configures the ADC digital filter. Detailed description can be found starting on page 45.
Option | Description |
---|---|
ADS126X_SINC1 |
Sinc1 mode |
ADS126X_SINC2 |
Sinc2 mode |
ADS126X_SINC3 |
Sinc3 mode |
ADS126X_SINC4 |
Sinc4 mode |
ADS126X_FIR |
FIR mode (default) |
Selects the ADC to connect the sensor bias.
Option | Description |
---|---|
0 or ADS126X_BIAS_ADC1 |
Sensor bias connected to ADC1 mux out (default) |
1 or ADS126X_BIAS_ADC2 |
Sensor bias connected to ADC2 mux out |
Selects the sensor bias polarity for pull-up or pull-down
Option | Sensor bias pull-up mode |
---|---|
0 or ADS126X_BIAS_PULLUP |
AIN_P pulled high, AIN_N pulled low (default) |
1 or ADS126X_BIAS_PULLDOWN |
AIN_P pulled low, AIN_N pulled high |
Selects the sensor bias current magnitude or the bias resistor
Option | Description |
---|---|
ADS126X_BIAS_MAG_0 |
No sensor bias current or resistor (default) |
ADS126X_BIAS_MAG_0_5 |
0.5 A sensor bias current |
ADS126X_BIAS_MAG_2 |
2 A sensor bias current |
ADS126X_BIAS_MAG_10 |
10 A sensor bias current |
ADS126X_BIAS_MAG_50 |
50 A sensor bias current |
ADS126X_BIAS_MAG_200 |
200 A sensor bias current |
ADS126X_BIAS_MAG_10M |
10 MOhm resistor |
Enables the PGA, default
PGA bypassed
Selects the PGA gain
Option | Gain |
---|---|
ADS126X_GAIN_1 |
1 V/V |
ADS126X_GAIN_2 |
2 V/V |
ADS126X_GAIN_4 |
4 V/V |
ADS126X_GAIN_8 |
8 V/V |
ADS126X_GAIN_16 |
16 V/V |
ADS126X_GAIN_32 |
32 V/V |
Selects the ADC data rate. In FIR filter mode, the available data rates are limited to 2.5, 5, 10, and 20 FPS. This class does NOT make sure you set that up right.
Option | Speed |
---|---|
ADS126X_RATE_2_5 |
2.5 SPS |
ADS126X_RATE_5 |
5 SPS |
ADS126X_RATE_10 |
10 SPS |
ADS126X_RATE_16_6 |
16.6 SPS |
ADS126X_RATE_20 |
20 SPS |
ADS126X_RATE_50 |
50 SPS |
ADS126X_RATE_60 |
60 SPS |
ADS126X_RATE_100 |
100 SPS |
ADS126X_RATE_400 |
400 SPS |
ADS126X_RATE_1200 |
1200 SPS |
ADS126X_RATE_2400 |
2400 SPS |
ADS126X_RATE_4800 |
4800 SPS |
ADS126X_RATE_7200 |
7200 SPS |
ADS126X_RATE_14400 |
14400 SPS |
ADS126X_RATE_19200 |
19200 SPS |
ADS126X_RATE_38400 |
38400 SPS |
Selects the positive and negative references.
Option - Negative | Reference |
---|---|
ADS126X_REF_NEG_INT |
INTERNAL |
ADS126X_REF_NEG_AIN1 |
AIN1 |
ADS126X_REF_NEG_AIN3 |
AIN3 |
ADS126X_REF_NEG_AIN5 |
AIN5 |
ADS126X_REF_NEG_VSS |
VSS |
Option - Positive | Reference |
---|---|
ADS126X_REF_POS_INT |
INTERNAL |
ADS126X_REF_POS_AIN0 |
AIN0 |
ADS126X_REF_POS_AIN2 |
AIN2 |
ADS126X_REF_POS_AIN4 |
AIN4 |
ADS126X_REF_POS_VDD |
VDD |
These all pertain to the gpio pins on the chip.
For all of them, there is an input uint8_t pin
.
This is the gpio pin that you want to use. Map:
PinCode (uint8_t pin ) |
External Pin |
---|---|
0 |
AIN3 |
1 |
AIN4 |
2 |
AIN5 |
3 |
AIN6 |
4 |
AIN7 |
5 |
AIN8 |
6 |
AIN9 |
7 |
AINCOM |
Connect the gpio pin to the external pin
Disconnect the gpio pin from the external pin
Configures the pin as output or input. All are set to output by default.
Option | Description |
---|---|
0 or ADS126X_GPIO_OUTPUT |
Configure pin as output |
1 or ADS126X_GPIO_INPUT |
Configure pin as input |
Writes a value to a pin configured as output.
Option | Description |
---|---|
0 or ADS126X_GPIO_LOW |
Set pin low |
1 or ADS126X_GPIO_HIGH |
Set pin high |
Reads the value of a pin configured as input.
Returns 0 if low Returns 1 if high