В этом примере показано, как записать данные с помощью двух каналов на NI 6255.
Найдите устройства соединенными с вашей системой и найдите ID для NI 6255.
d = daq.getDevices;
d = Data acquisition devices: index Vendor Device ID Description ----- ------ --------- ----------------------------- 1 ni Dev1 National Instruments USB-6255 2 ni Dev2 National Instruments USB-6363
Создайте сеанс и добавьте четыре линии от порта 0 на Dev1.
s = daq.createSession('ni'); addDigitalChannel(s,'Dev1','Port0/Line0:3ˋ','InputOnly')
ans =
Data acquisition session using National Instruments hardware:
Clocked operations using startForeground and startBackground are disabled.
Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Number of channels: 4
index Type Device Channel MeasurementType Range Name
----- ---- ------ ----------- --------------- ----- ----
1 dio Dev1 port0/line0 InputOnly n/a
2 dio Dev1 port0/line1 InputOnly n/a
3 dio Dev1 port0/line2 InputOnly n/a
4 dio Dev1 port0/line3 InputOnly n/a
Получите цифровые данные в шестнадцатеричных значениях.
binaryVectorToHex(inputSingleScan(s))
ans = C