142
Chapter 5 Remote Interface Reference
Digital I/O Commands
5
Digital Input Commands
These commands read individual bits or complete ports. Some digital I/O
configuration commands may affect how these bits are read. The port
parameter is in the form snn, where s is the slot number and nn is the
first channel on the digital port. The port parameter is plug-in module
dependent. Valid port numbers for each plug-in module are shown
beginning on page 70.
SENSe:DIGital:DATA
:BIT? <bit_port>
This query reads a bit from the specified bit_port and returns either a “0”
or a “1”. bit_port is in the form of snn, where s is the slot number and nn
is the bit number. The built-in 4-bit digital I/O port has bit numbers 091
to 094. The plug-in module bit numbers are module dependent (see page
70).
SENSe:DIGital:DATA
[:<BYTE|WORD|LWORD>][:VALue]? <port>
This query reads data from the specified port and returns an integer
representing the binary-weighted value of the bits. The value returned
depends upon the first parameter as follows:
• BYTE - reads 8 bits and returns an integer between 0 and 255 (00
h
and FF
h
).
• WORD - reads 16 bits and returns an integer between -32768 and
+32767 (-8000
h
and +7FFF
h
). Negative numbers returned are 2’s
complement numbers.
• LWORD - reads 32 bits and returns an integer between -2
31
and
+(2
31
-1) (-80000000
h
and 7FFFFFFF
h
). Negative numbers returned
are 2’s complement numbers.
Numbers greater than +32767 (WORD) and +(2
31
-1) (LWORD) will be
returned as negative numbers. When the returned data is negative, you
must calculate the actual bit state from the 2’s complement form.