Several queries recently have been regarding the 9223 module and how many could be used on a cRIO or an sbRIO. This example extends the shipping example to capture the data from 3 x 9223 modules at full speed for 1 second. The modules were connected to an sbRIO-9602 (once their cases were removed) and the program transfers it's data into a DMA buffer that is large enough for the entire capture. There is thus no dependency on the RT controller other than for the memory allocation.
The program is actually quite simple but it took far longer get it working reliably than would at first appear. The FPGA acquires data from all channels of the three connected 9223 modules, controlled by the rate at which it generates a sample clock. The top loop in the middle does this and it also checks that in the process it isn't overwriting existing data. Leave these checks in place if possible as it was surprisingly easy to have timeouts or overwrites when dealing with this much data.
Anyway, the second loop waits for new data to appear and reads it, passing the resulting array into a local FIFO. The advantage of doing this is due to the way in which we are reading the data. The default for these modules is to read calibrated measurements from each channel. The problem is, that generates more data per second than we can DMA back to the host. In this example, we avoid the problem by reading the raw data which only takes up 2 bytes per sample.
The bottom loop takes two of the arrays of I16 values and joins then to pack them into U32s. This speeds up the DMA transfer but does add a little complexity when we read the data out of the DMA FIFO.
Once the data has been paired up, we DMA the data back for the number of channels requested. The DMA buffer on the RT controller is set large enough to hold all of the data, removing any dependency on the RT controller handling the data.
Of course, if we are feeding back raw binary data, we need to apply the relevent calibration values and this is done as the data is read and processed. The cal data is read at the very start of the program but it could be made into a separate bitimage, to save space, and called before the acquisition code.
There are several improvements that could be made to this code but hopefully it gives a starting point when using multiple 9223 modules.
Steps to Implement or Execute Code
Connect an sbRIO-9602 with three 9223 modules attached.