BL4S200 User’s Manual
114
anaIn
int anaIn(int channel, int gaincode);
FUNCTION DESCRIPTION
Reads the state of an A/D converter input channel. If the access is for an A/D converter
single-ended bipolar channel and the gain code for the given channel has changed from
the previous cycle, the user block in the flash memory 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 (use a gain code of 4 for 4–20 mA operation)
channel
Single-Ended
Differential
4–20 mA
0
+AIN0
+AIN0 -AIN1
+AIN0
1
+AIN1
—
+AIN1
2
+AIN2
+AIN2 -AIN3
+AIN2
3
+AIN3
—
+AIN3
4
+AIN4
+AIN4 -AIN5
5
+AIN5
—
6
+AIN6
+AIN6 -AIN7
7
+AIN7
—
Gain Code
Macro
Voltage Range
Single-Ended
Unipolar
Single-Ended
Bipolar
Differential
Bipolar
0
GAIN_X1
0–20 V
±10 V
± 20 V
1
GAIN_X2
0–10 V
±5 V
± 10 V
2
GAIN_X4
0–5 V
±2.5 V
± 5 V
3
GAIN_X5
0–4 V
±2 V
± 4 V
4
GAIN_X8
0–2.5 V
±1.25 V
± 2.5 V
5
GAIN_X10
0–2 V
±1 V
± 2 V
6
GAIN_X16
0–1.25 V
—
± 1.25 V
7
GAIN_X20
0–1 V
—
± 1 V
electronic components distributor