User`s manual
BL4S100 User’s Manual 85
anaInVolts
float anaInVolts(int channel, int gaincode);
FUNCTION DESCRIPTION
Reads the state of a single-ended A/D converter input channel and uses the previously
set calibration constants to convert it to volts. The voltage ranges given in the table
below are nominal ranges that will be returned. However, values outside these ranges
can often be seen before the return of a
BL_OVERFLOW error.
If the gain code for a given channel has changed from the previous cycle, the user block
will be read to get the calibration constants for the new gain value.
PARAMETERS
channel analog input channel number (0 to 7) corresponding to AIN0–AIN7
gaincode the gain code of 0 to 7; the table below applies for single-ended
modes only
Gain Code Macro
Value Range
Voltage
Range
Single-Ended
Unipolar
Differential
Bipolar
0 GAIN_X1 0–20 V ± 20 V 0–20 V
1 GAIN_X2 0–10 V ± 10 V 0–10 V
2 GAIN_X4 0–5 V ± 5 V 0–5 V
3 GAIN_X5 0–4 V ± 4 V 0–4 V
4 GAIN_X8 0–2.5 V ± 2.5 V 0–2.5 V
5 GAIN_X10 0–2 V ± 2 V 0–2 V
6 GAIN_X16 0–1.25 V ± 1.25 V 0–1.25 V
7 GAIN_X20 0–1 V ± 1 V 0–1 V