Continuous digital output in session based interface.
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Analog Signal Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!