Can Instrument Control Toolbox use NI-SCOPE driver to acquire from two devices in parallel?

2 views (last 30 days)
Clay
Clay on 19 Apr 2017
Answered: Ankita Nargundkar on 26 Apr 2017
We have two PXIe NI digitizers using the NI-SCOPE platform. We are able to acquire from one individually in MATLAB but would like to coordinate acquisition with both at the same time in parallel. Is this possible with MATLAB?

Answers (1)

Ankita Nargundkar
Ankita Nargundkar on 26 Apr 2017
You can use features of Parallel Computing Toolbox to achieve this. On the limitation of hardware with PARFOR,as long as the interfaces are not talking to the same device on the same channel, it is possible to use acquire data from two devices simultaneously using parfor.
In the past users have tried reading from two NXT bricks (LEGO programmable bluetooth devices) via the Targus Bluetooth-USB adaptor, in a PARFOR loop. They were able to perform reads and writes successfully in parallel, with no gaps. There could be gaps in receiving data depending on the devices.
Writing to hardware interfaces in parallel should not be a problem in general. However, this may vary between specific cases. As long as the adaptor supports connecting to multiple devices, it should be fine. The Targus adaptor used in the above example supports connecting to multiple bluetooth devices at a time.
In case the adaptor supports connecting to multiple bluetooth devices at a time, it is important to note that MATLAB will only be able to read the data from the interface at a maximum rate of 20 Hz (OS limitation). Also, there should be no assumptions as to how fast consecutive loops will execute as one depends on the OS's scheduler for this.
In case the code is using FREAD to get the data from the instrument, it would be better to specify the maximum number of bytes to be read as an argument to FREAD. If this is not specified, FREAD will wait for the entire buffer to fill up, and may time out. While one read is waiting, the other device may be outputting packets that may be dropped if the second worker's buffer fills up and so this could result in the "gaps". Note that the number of bytes available to the interface from the device is given in the BytesAvailable property. Read up to a maximum of bytes available in each loop.

Community Treasure Hunt

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

Start Hunting!