User Manual
ADC-20/ADC-24 User's Guide 34
Copyright © 2005-2010 Pico Technology Ltd. All rights reserved. adc20.en
Examples:
To set digital channels 1 and 2 to input and digital channels 3 and 4 to output:
directionOut =
HRDL_DIGITAL_IO_CHANNEL_4 (8) + HRDL_DIGITAL_IO_CHANNEL_3 (4) = 12
To set digital channel 4 high and digital channel 3 low:
digitalOutPinState = HRDL_DIGITAL_IO_CHANNEL_4 (8) = 8
To set only digital channel 3 high:
digitalOutPinState = HRDL_DIGITAL_IO_CHANNEL_3 (4) = 4
To turn both digital channels 3 and 4 on:
digitalOutPinState =
HRDL_DIGITAL_IO_CHANNEL_4 (8) + HRDL_DIGITAL_IO_CHANNEL_3 (4) = 12
Example bit patterns for directionOut parameter:
Decimal
Bit
Pattern
Digital
Channel 4
Digital
Channel 3
Digital
Channel 2
Digital
Channel 1
1
0001
Input
Input
Input
Output
10
1010
Output
Input
Output
Input
12
1100
Output
Output
Input
Input
13
1101
Output
Output
Input
Output
The above is a selection of the 16 different options available for the directionOut
parameter. When a digital channel has been selected as an output, it can then be set
on or off with the digitalOutputPinState parameter, again using binary bit patterns
to represent the different digital channels.
The default setting for the digital channels is "output, off".