Manual PCIe-DA16-6
15
Chapter 6 Software
These cards are straightforward to program. The following example is in C, but sample
code is also provided on the CD in Pascal and four Windows languages: Delphi,
VisualBASIC, and Visual C++.
To output an analog value with 16-bit resolution, a corresponding decimal number N
between 0 and 65535 is calculated (2
16
= 65536).
double spanVolts = 10.0; // for ±5V; use "20.0" for ±10
double offsetVolts = spanVolts / 2; //use "0.0" for unipolar
double targetVolts = 1.3; // change to any desired output voltage
counts = (targe offsetVolts) / spanVolts * 65536.0;
Next the data are written to the selected analog output channel. (See the preceding I/O
Address Map.)
RelOutPort(DeviceIndex, DAC * 2, counts);
For simplicity, it was assumed that the simultaneous-update capability was not used.
Examples of this routine are installed with the software package along with examples in
other languages.
See Chapter 7: Calibration for the equivalent command for outputting calibrated data.