Manual PCIe-DA16-6
12
Chapter 5: Programming
The cards’ DACs and Digital I/O use 18 I/O addresses. Programming these cards is very
straightforward as there are only two operating modes and four range-selection switches
per channel. The basic operation of a Digital-to-Analog card is to write a 16-bit value to a
Digital to Analog Converter (DAC) where it is buffered and loaded by an update
command to a DAC active register. Outputs of that register control a "ladder" network
which produces the analog output. The output voltage range is defined by settings of the
range-selection switches for that channel. For example:
double spanVolts = 10.0; // for ±5V; use "20.0" for ±10
double offsetVolts = spanVolts / 2; //use "0.0" for all unipolar ranges.
double targetVolts = 1.3; // change to any desired output voltage
counts = (targe offsetVolts) / spanVolts * 65536.0;
RelOutport(DeviceIndex, DAC * 2, counts);
Upon power-up, or hardware reset, the DAC registers are restricted to a safe value and
the card is set in Simultaneous Update mode.
Simultaneous Update Mode
is the power-up or default mode of operation for the DAC
card. When a value is written to a DAC address the output does not change until an
output update is commanded via a read from Base 8. (Alternatively, a read of
Base A will update the DAC registers and switch the board to Automatic
Update Mode.) While in Simultaneous Update Mode, a single read will load all DAC
registers with the value waiting in the pre-load registers, causing all outputs to be
updated and changed simultaneously. In other words, the outputs of all D/As may be
updated simultaneously by first enabling simultaneous updating for all outputs,
preloading the low and high bytes of each DAC, and then initiating a simultaneous
update by software command or external update falling edge.
Automatic Update Mode
is the configuration that changes a DAC output immediately
after the high-byte of the new value is written to the DAC address.
(Each channel is updated individually when new data are written to the related high-byte
base address)
If the card is in Simultaneous Update Mode a read of Base 2 will change the
card back to Automatic Update Mode without updating the outputs. A read of Base
A will update all outputs simultaneously and then place the card in Automatic
Update Mode.
Restrict-Output-Voltage
limits the output of all DAC channels to 0V and is active at
power-up. Since the pre-load register defaults to its min-scale value, known values can
be written to the preload registers before using a "Clear Restrict-Output-Voltage"
command. Those written values will then be output to the connector when a "Clear
Restrict-Output-Voltage" command is issued by a read of Base AF.
External Trigger Update Mode
allows a negative level at pin 25 of the I/O connector to
cause the DACs to be updated. A read of Base A5 will enable this mode, a read
of Base A6 will disable it. Note that this pin is shared with the External Interrupt
signal.