Digital I/O - Z-World Wildcat BL2000 User Manual

C-programmable, with ethernet
Table of Contents

Advertisement

4.4.2 Digital I/O

int digIn(int channel);
Reads the state of an input channel:
IN0–IN10—standard digital inputs, ± 36 V DC
IN11–IN14—pseudo digital inputs using A/D converter inputs ADC0–ADC3, ± 10 V DC
IN15–IN19—pseudo digital inputs using A/D converter inputs ADC4–ADC8, 0 V to 48 V DC
IN20–IN21—pseudo digital inputs using A/D converter inputs DAC0–DAC1, 0 V to 48 V DC
(BL2010 and BL2030)
The threshold is fixed at 2.40 V for channels IN0–IN10. Anything below 2.40 V is a logic 0, and any-
thing higher than or equal to 2.40 V is a logic 1.
The default threshold for channels IN11–IN21 is also set to 2.40 V. The threshold for these channels may
be changed by adding the following two lines to your program.
#undef
THRESHOLD
#define
THRESHOLD xx.xx
xx.xx
where
is the desired threshold voltage. Anything below the threshold value is a logic 0, and any-
thing higher than or equal to the threshold value is a logic 1.
PARAMETER
channel
is the input channel number (0–21)
RETURN VALUE
The state of the input (0 or 1).
SEE ALSO
brdInit, digOut
void digOut(int channel, int value);
Sets the state of a digital output (
The default setting for the function is for current-sinking outputs. To change from sinking to sourcing
outputs, add the following two lines at the beginning of your program.
#undef
OUTPUT_DRIVE
#define
OUTPUT_DRIVE
The relay is driven by PA0, which is the same Rabbit 2000 parallel port that drives OUT0 and LED DS4.
OUT0 therefore works in parallel with the relay output. Z-World therefore recommends that you do not
use OUT0 for a digital output when you are using the relay.
PARAMETERS
channel
is the output channel number (0–9).
value
is the output value (0 or 1).
SEE ALSO
brdInit, digIn
User's Manual
OUT0–OUT9)
.
SOURCING
41

Advertisement

Table of Contents
loading

Table of Contents