Example Code

NI-HSDIO Stream from Disk: Queue Binary File I/O

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.

    Hardware

  • Modular Instrumentation

    Software

  • LabVIEW

    Driver

  • Other

Code and Documents

Attachment

Overview
    This example allows a user to stream an output from disk to an HSDIO device (654x/655x/656x).

 

Description
    This example uses a queues as a buffer between a file and an HSDIO device.  The code is composed of two phases: 
    1.  Initialization
          a. Calculate number of samples per block/queue container
          b. Calculate the total number of blocks
          c. Generate a script to output all blocks/queue containers
          d. Fill the onboard memory and the queue prior to starting generation
          e. Optimize MITE for streaming

    2. Generation
          a. Consumer loop:
               i. Check available space in onboard memory repeatedly
               ii. When enough space for one block exists, dequeue first element in queue and write to the                 onboard memory
          b. Producer loop:
                i.  Write the next element from file to queue
               ii. Queue will block adding additional elements if queue is full
     More in-depth details can be found on the Block Diagram of the VI. 

 

Requirements
    Software
         LabVIEW 2012 (or compatible)
        NI-HSDIO driver which is compatible with your hardware and version of LabVIEW
    Hardware
        NI HSDIO device (654x/655x/656x)

 

Instructions

1. From the project explorer, open niHSDIO Stream from Disk Queue Binary File IO.vi
2. Set the values on the front panel (Resource Name, Channel List, Buffer/File Configuration, Clock and Play Mode)
3. Run the VI

 

Additional Information or References

 

  

Stream from disk binary.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

 

Customer Education Product Marketing Manager
National Instruments

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