Basic Digital I/O Operations
Agilent 34950A 64-Bit Digital I/O and Counter Module User’s Guide
5
Writing Digital Data
To write digital data, set the channel output parameters using the
SOURce
commands. For example, sending the following SCPI commands to a Digital
I/O module in slot 1 sets a 32- bit channel to use normal polarity,
with active drive and a ‘set’ output voltage of 4 volts.
CONF:DIG:WIDT LWOR,(@1201)
CONF:DIG:POL NORM,(@1201)
SOUR:DIG:DRIV ACT,(@1201)
SOUR:DIG:LEV 4,(@1201)
The width and polarity parameters apply to both input and output
operations.
You can set a channel to output in either active drive or open collector
configurations. When set to
ACTive
, the module drives the digital lines for
both high and low. The voltage level that represents a logic ‘1’ can be set
using the
SOURce:DIGital:LEVel
command. Output voltages can range
from 1.66 V (default) to 5 V.
When the channel is set to
OCOLlector
, lines are driven low, but set to
high impedance (Hi- Z) when asserted. In the open collector mode, multiple
lines can be connected together by providing external pull- ups.
Once a channel has been configured, write digital data to the channel
using the
SOURce:DIGital:DATA
command.
SOUR:DIG:DATA:LWOR 26503,(@1201)
You may also use a hexadecimal format to represent values in the
commands. For example, to send the decimal value of 26503 in hex use
the command form:
SOUR:DIG:DATA:LWOR #h6787,(@1201)
Note that the data should match the channel width configured using
CONFigure:DIGital:DATA:WIDTh
command. The data written is masked
by the configured width so that any extra bytes will be discarded.
For example: sending the value 65531 to a byte wide channel will result
in the channel discarding the upper byte and outputting 251.
N O T E
When using external pull-ups in the open collector mode, the outputs will
not exceed 5 V.
N O T E
Writing to a channel automatically configures the channel as an output.