BL4S100 User’s Manual
83
anaIn
int anaIn(int channel, int gaincode);
FUNCTION DESCRIPTION
Reads the state of an A/D converter input channel.
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
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