From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Transient capture with three 9223 modules on an sbRIO-9602

Code and Documents

Attachment

Overview

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.

Description

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

  1. Connect an sbRIO-9602 with three 9223 modules attached.
  2. Change the address of the target to your sbRIO
  3. Probably re-compile the FPGA VI
  4. Run RT 9223 transient capture.vi

Requirements

Software

LabVIEW 2015

LabVIEW 2015 RT

LabVIEW 2015 FPGA

Hardware

1 x sbRIO-9602

3 x NI-9223

Additional Images or Video

9602 with 3 x 9223 small.jpg


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Not applicable
on

Sorry about my automatic reply..

Call.Me.Wilbur
NI Employee (retired)
on

I have good news for anyone looking to develop a similar data acquisition application on a board-only controller in the future. NI has recently released the CompactRIO Single-Board Controller with NI-DAQmx product family! These new single-board controllers are fully compatible with DAQmx in addition to the FPGA API method described in this example. Much of the custom LabVIEW FPGA code implemented here could be accomplished more efficiently through DAQmx. More information on these controllers can be found here: https://www.ni.com/documentation/en/compactrio-single-board-controller/latest/manual/manual-overview...

 

Will K.

Product Support Engineer

National Instruments

Contributors