User’s Manual
52
5.2.8.2 Analog Inputs
zb_adc_in
int zb_adc_in(int dio);
DESCRIPTION
Reads the analog input on the designated pin and return its 10-bit value. To convert the reading
to millivolts perform the following calculation.
AD (mV) = (ADIO reading / 1023) × 1200 mV
PARAMETER
dio
the Dynamic C analog input pin number (0–3) set up in
zb_io_init()
.
NOTE:
The pin number is not the same as the
DIO_xx
macros described in
zb_io_init()
,
which are used to configure the function of the pin only.
RETURN VALUE
0–1023 — valid data.
–EINVAL
— error (pin not configured as an analog input).