Session based vs. Legacy interface in generating digital outputs via an NI device

1 view (last 30 days)
Hi, For my experiment, I transfer digital outputs from MATLAB via a National Instruments (NI) device (PCIe-6320), which has digital output ports having 8 channels each (e.g. port 0 has 8 channels: 0.0:0.7). Timing considerations are very important.
Before purchasing my current 64-bit MATLAB 2014 system, I used 32-bit MATLAB of an older version, with a different NI board - PCI-6224. For the 32-bit system I used "Legacy interface" code (putValue command) to generate outputs, and found that the average delay in execution time of a MATLAB line that updates a single channel from 0 to 1 (and vice versa) was 1.2 ms. Furthermore, the mean delay was proportional to the number of output channels simultaneously updated in the same MATLAB line, i.e. a MATLAB line that updated simultaneously 8 channels (0.0:0.7) from 0 to 1 would take 8X1.2 ms to execute.
Upon moving to the current system, A new computer with MATLAB 64-bit and PCIe-6320, I discovered that the Legacy interface set of commands (for generating and acquiring digital outputs and inputs) is not available for 64-bit, and that I must use the "Session-based" set of commands. I indeed used the outputSingleScan command to update the output lines. Surprisingly, the mean delay in executing a MATLAB line updating only one output channel was ~8 ms, and for updating 8 channels simultaneously - ~14 ms.
I have tested the new 6320 board through an external NI software and found that it is capable of updating the lines in a rate much higher than 1000 Hz (corresponding to the 1 ms delay I'd like to achieve), so I suppose that the difference between my old system and the current one has to do with the MATLAB interface - it's either the session-based vs. Legacy set of commands, which might be slower, or MATLAB 64-bit vs. 32-bit, regardless of the Digital Input/Output interface. Additionally, it could be due to heavier workload on my new current computer, although I did everything I could think of trying to reduce it.
I would really appreciate it if someone could enlighten me as to the difference between the Legacy and session-based interfaces, in a way that might explain the big delay and different behavior I see.
Thank you very much, Aviv.

Answers (0)

Categories

Find more on Digital Input and Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!