Continuous digital output in session based interface.

조회 수: 14 (최근 30일)
Kapil Chauhan
Kapil Chauhan 2017년 4월 22일
Hi,
I am using the following code for 'trying' to generate digital output across six lines. I have included an analog input channel to check if the output lines are working (and physically connected them). The code runs without any errors but there is no digital output from the NI PXI 6224 card. I can get the digital lines to output using outputSingleScan command but it just doesn't work otherwise in startForeground or startBackground mode. Help please!
DO = daq.createSession('ni');
addDigitalChannel(DO,'PXI1Slot4','port0/line0:5','OutputOnly');
addAnalogInputChannel(DO,'PXI1Slot3','ai10','Voltage')
addClockConnection(DO,'PXI1Slot3/PFI0','PXI1Slot4/PFI0','ScanClock');
DO.IsContinuous = true;
DO.Rate = 100;
OutputData = decimalToBinaryVector(sort(rem(0:999,64)),6);
DO.queueOutputData(OutputData);
DO.NotifyWhenScansQueuedBelow = 500;
addlistener(DO,'DataRequired',@(src,event) src.queueOutputData(OutputData));
DO.NotifyWhenDataAvailableExceeds = DO.Rate;
addlistener(DO,'DataAvailable',@(src,event) disp(mean(event.Data)));
DO.startBackground;
Thanks,
Kapil

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by