Example Code

De-Interleaving Interleaved Data when Transfering a Varying Number of Channels through a DMA FIFO

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to de-interleave a 1D array that contains data of multiple channels.

 

Description

If you are using a DMA FIFO to transfer multiple channels of data from an FPGA VI to a host VI through an interleaving technique, you will invariably need to break that data back into the individual channels in the host VI. Traditionally, the best way to do this is using the Decimate 1D Array function to break it back down into each of the channels followed by the Build Array function which builds the data back into a 2D array. A VI Snippet which illustrates this technique is shown below.

Temp.png

The technique is fine if the number of channels of data you are transferring is fixed. If you need to vary the number of channels you are transferring without modifying the code, you can use a technique which uses the Reshape Array function which is shown in this example. The output will be a 2D array where each row contains values of one channel. If the quotient of Interleaved Data values and Number of Channels is not an integer, remaining values are ignored.


Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached file "De Interleaving data of 1D array LV2012 NIVerified.vi"
  2. Follow the instructions in the Front Panel and run the program

 

Additional Information or References

De Interleaving data of 1D array LV2012 NIVerified.vi - Front Panel.png
 
De Interleaving data of 1D array LV2012 NIVerified.vi - Block Diagram.png
 
**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

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

Comments
Harry potter
Member
Member
on

useful

JimmyKo
Active Participant
Active Participant
on

very good!  that's exactly what i'm looking for!

Jimmy Ko
A_Donfigulation_Error_Has
Member
Member
on

Code attached in the second snippet takes out the first array and moves it to the back of the 2D array. I think this is unintentional.

Product Support Engineer
National Instruments
Mauritius
Member
Member
on

As above, anyone knows why the last two blocks is there?