Writeio (mask, source) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 154

Advertising
background image

Section 7. Measurement Instructions

7-28

Parameter
& Data Type

Enter

Units

The Units parameter is used to specify the unit of measure for the timeout period.
An alphabetical or numeric code can be entered.

Numeric

Alpha

Description

0

usec

microseconds

1

msec

milliseconds

2

sec

seconds

3

min

minutes

WriteIO (Mask, Source)

WriteIO is used to set the status of selected control I/O channels (ports) on the
CR5000. (See Also PortSet.) There are 8 ports. The status of these ports is
considered to be a binary number with a high port (+5 V) signifying 1 and a
low port (0 V) signifying 0. For example, if ports 1 and 3 are high and the rest
low, the binary representation is 00000101, or 5 decimal. The source value is
interpreted as a binary number and the ports set accordingly. The mask
parameter is used to select which of the ports to set, it too is a binary
representation of the ports, a 1 means set the port according to the source, a 0
means do not change the status of the port. CRBasic allows the entry of
numbers in binary format by preceding the number with "&B". For example if
the mask is entered as &B110 (leading zeros can be omitted in binary format
just as in decimal) and the source is 5 decimal (binary 101) port 3 will be set
high and port 2 will be set low. The mask indicates that only 3 and 2 should be
set. While the value of the source also has a 1 for port 1, it is ignored because
the mask indicates 1 should not be changed.

Example

WriteIO (&B100, &B100) ' Set port 3 high.

Parameter
& Data Type

Enter

Mask

Constant

The Mask allows the read or write to only act on certain ports. The Mask is ANDed
with the value obtained when reading and ANDed with the source before writing.

Source

Constant
Variable

The Variable or number that is to be written to the I/O ports.

Advertising