Measurement Computing Data Acquisition Systems rev.10.4 User Manual
Page 27

Programmer’s Manual
988594
API Programming, General Models 2-17
Assuming the voltage reference is connected to the internal default of 5 V, the next function will set
channel 0 to an output voltage of 5 V. The values are set for a digital-to-analog converter with 16 bit
resolution; 65535 represents full-scale. Channel 1 is equal to 0.
ret& = VBdaqDacSetOutputMode&(handle&, DddtLocal&, 0, DdomVoltage&)
ret& = VBdaqDacWt&(handle&, DddtLocal, 0, 65535)
The
daqDacWtMany
writes to both analog outputs simultaneously. The following lines sets channel 0 to 5
V and channel 1 to 2.5 V. At full-scale, a digital value of 65535 corresponds to 5 V; a digital value of
49152 corresponds to ½ of 5 V.
Dim deviceTypes&(1)
Dim chans&(1)
Dim dataVals%(1)
The VBdaqSetOutputMode puts the channel in a voltage mode.
ret& = VBdaqSetOutputMode&(handle&, DddtLocal&, 0, DdomVoltage&)
ret& = VBdaqSetOutputMode&(handle&, DddtLocal&, 1, DdomVoltage&)
deviceTypes&(0) = DddtLocal&
deviceTypes&(1) = DddtLocal&
chans&(0) = 0
chans&(1) = 1
dataVals&(0) = 65535
dataVals&(1) = 49152
ret& = VBdaqDacWtMany&(handle&, deviceTypes&(), chans&(), dataVals&(),2)
The following sets the outputs to 0 V.
Dim deviceTypes&(1)
Dim chans&(1)
Dim dataVals%(1)
deviceTypes&(0) = DddtLocal&
deviceTypes&(1) = DddtLocal&
chans&(0) = 0
chans&(1) = 1
dataVals&(0) = 32768
dataVals&(1) = 32768
ret& = VBdaqDacSetOutputMode&(handle&, DddtLocal&, 0, DdomVoltage&)
ret& = VBdaqDacSetOutputMode&(handle&, DddtLocal&, 1, DdomVoltage&)
ret& = VBdaqDacWtMany&(handle&, deviceTypes&(), chans&(), dataVals&(),2)