generate signals on both analog and digital channels
this example shows how to generate signals when the dataacquisition contains both analog and digital channels.
discover ni devices connected to your system and find the id for the ni 6255.
d = daqlist("ni")
dev = 3×4 table deviceid description model deviceinfo ________ ___________________________________ __________ _______________________ "dev1" "national instruments(tm) usb-6255" "usb-6255" [1×1 daq.ni.deviceinfo] "dev2" "national instruments(tm) usb-6363" "usb-6363" [1×1 daq.ni.deviceinfo]
create a dataacquisition and add two digital output lines from port
0
on dev1
.
d = daq("ni"); addoutput(d,"dev1","port0/line0:1","digital")
add an analog output channel from dev1
, then view all
channels.
addoutput(d,'dev1',0,'voltage') d.channels
ans = index type device channel measurement type range name _____ _____ ______ _____________ _____________________ __________________ __________________ 1 "dio" "dev1" "port0/line0" "outputonly" "n/a" "dev1_port0/line0" 2 "dio" "dev1" "port0/line1" "outputonly" "n/a" "dev1_port0/line1" 3 "ao" "dev1" "ao0" "voltage (singleend)" "-10 to 10 volts" "dev1_ao0"
output a single scan of data on both the digital and analog channels.
write(d, [decimaltobinaryvector(2), 1.23])