User`s manual

50 Understanding the Agilent E1330B Digital I/O Module
Chapter 4
Inputting Data Bytes and Bits
Data input is performed using commands in the SCPI
MEASure:DIGital:DATAn subsystem. The returned value of an input will
depend upon the POLarity programmed for the port.
Input operations can involve single bits, 8-bit bytes, or multiple bytes. Single
bit input operations always return a decimal value of 0 or 1. Byte or multiple
byte input operations always return numbers in decimal format.
Both Input and Output operations will attempt to complete the handshake
mode set for the port and may "hang" if required handshake operations are
not completed. To unhang a hung transfer issue a IEEE 488 selected device
clear. In BASIC this is
CLEAR 70918.
Bit Input The SCPI command for inputting the state of a single bit on a data port is:
MEASure:DIGital:DATAn[:type]:BITm
This command instructs the Digital I/O module to return a value of either
0
or 1, indicating the condition of bit m on port n, following completion of the
input handshake. The value returned depends upon the programmed state of
the port POLarity. In the default state (POSitive polarity) a TTL high on the
data line specified by m will return a
1. For example, the following BASIC
program code will request and display the state of data line 3 (bit-3) on port
4.
120 OUTPUT @Dio;"MEAS:DIG:DATA4:BIT3?"
130 ENTER @Dio;Bits
140 DISP "State of bit 3 on port 4" &Bits
Bit numbers range from 0 to 7 for single port operations. For multiple port
operations, bit numbers can range from 0 to 31. The section “Multiple Port
Operations” beginning on page 53 describes bit numbering for multiple port
operations. For a single port, the data line numbers and bit numbers
correspond:
In this manual the physical data lines are indicated as Dn-1. The n should be
replaced with the port number for the input operation. For example, bit 3 of
port 2 affects the state of data line D2-3.
Byte Input The SCPI command requesting an 8-bit byte from a data port is:
MEASure:DIGital:DATAn[:BYTE][:VALue]?
This command instructs the Digital I/O module to return a decimal value
between 0 and 255, indicating the condition of the data lines on port n,
following completion of the input handshake. The value returned depends
upon the programmed state of the port POLarity. In the default state
Dn-7 Dn-6 Dn-5 Dn-4 Dn-3 Dn-2 Dn-1 Dn-0
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0