BL4S200 User’s Manual
116
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 be-
low 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 following
code accesses will occur.
1. The user block will be read to get the calibration constants for the new gain value.
2. The D/A converter will be written to bias the A/D converter input circuit for proper opera-
tion. (The D/A converter access only applies for the single-ended bipolar A/D converter
operation.)
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
Voltage Range
Single-Ended
Unipolar
Single-Ended
Bipolar
0
GAIN_X1
0–20 V
±10 V
1
GAIN_X2
0–10 V
±5 V
2
GAIN_X4
0–5 V
±2.5 V
3
GAIN_X5
0–4 V
±2 V
4
GAIN_X8
0–2.5 V
±1.25 V
5
GAIN_X10
0–2 V
±1 V
6
GAIN_X16
0–1.25 V
—
7
GAIN_X20
0–1 V
—