144
Chapter 5 Remote Interface Reference
Digital I/O Commands
5
SOURce:DIGital:DATA
[:<BYTE|WORD|LWORD>][:VALue] <port>,<data>
This command sets a value on the specified port. data is a decimal value
representing the desired bit pattern. The value of data depends upon the
first parameter as follows:
• BYTE - writes 8 bits to the specified port. 16- or 32-bit modules will be
used as two or four 8-bit ports respectively. data can range from 0 to
255 (00
h
and FF
h
). If writing to the built-in 4-bit digital I/O port
(port = 090), data can range from 0 to 15.
• WORD - writes 16 bits to the specified port. 16- or 32-bit modules will
be used as one or two 16-bit ports respectively. data can range from
-32768 to +32767 (-8000
h
and +7FFF
h
). Values above 32767 must be
converted to the 2’s complement form and sent as negative numbers.
• LWORD - writes 32 bits to the specified port. This parameter is only
valid on 32-bit modules. data can range from -2
31
and +(2
31
-1)
(-80000000
h
and 7FFFFFFF
h
). Values above +(2
31
-1) must be
converted to the 2’s complement form and sent as negative numbers.
SOURce:DIGital:DATA
[:<BYTE|WORD|LWORD>]:BLOCK <port>,<block_data>
This writes block data to the specified port. Block data has the form:
<#digits><length><block>, where:
•
<#digits> decides how many decimal digits are used to define
<length>;
•
<length> decides how many bytes are to be transferred in <block>;
•
<block> contains the actual data to be transferred. <block> may
contain from 1 to 2048 bytes.
Set port to 090 to write blocks to the built-in 4-bit digital I/O port.
The first parameter sets how the value of block_data is interpreted. If
you omit the parameter, BYTE data is assumed.
For example, the command below sends a block of data, “ABCDEFGHIJ”,
to 16-bit port 100. Since the ASCII characters A and B have decimal
values of 65 and 66, respectively, the binary equivalent of 65 and 66 are
written to port 100. A is written to the upper 8 bits and B to the lower 8
bits; then the C and D are written, and so on.
SOUR:DIG:DATA:WORD:BLOCK 100,#210ABCDEFGHIJ