Example Code

Load Large HWS Waveform File

Code and Documents

Attachment

Overview

There may be a need to load a large HWS file onto 1 or multiple HSDIO cards. The hardware has enough on-board memory, but LabVIEW could run out of memory because of the way the HWS Read and Retrieve Waveform VIs convert the channels and number of samples into the waveform data type (WDT). By loading a certain number of samples at a time and dynamically creating scripts, this memory issue can be avoided.

Description

This example consists of 3 VIs. The top level VI is named Multi-Device Dynamic Generation (TClk) - Large HWS File.vi. This is a stand-alone application that will synchronize multiple HSDIO cards and then split the HWS file across each card and generate the waveform. It includes the initialization of each instrument, as well as some configuration (specifically, clock rate and Scripted mode).

There are 2 subVIs that are included:

1. Read Large HWS File.vi - Reads the HWS file and creates an array of WDT. Each element has a certain number of samples. The inputs for this VI include the HWS File Handle, Sample Subset Size, and Channel List. The Sample Subset Size allows the user to select how large the sample subsets should be. Typical values should be around 1M samples. Note: 32-bit Windows could possibly support reading a larger number of samples, but this requires a large amount of contiguous memory. It also depends on how many channels there are in the waveform. The default value of 1M samples was based on a system with 72 channels and 10,000,000 total samples.

****Channel List must be comma separated. Dashes/colons cannot be used****

This VI assumes that the channel order of the HWS file is in the correct order (so it only uses the number of channels in the channel list to create the array of channels to pull out of the HWS file).

For example, if there are 2 HSDIO cards and each channel list consists of 24 channels, the HWS file should contain 48 channels. For HSDIO1, the array of channels that will be pulled from the HWS file are 0-23. For HSDIO2, the array of channels that will be pulled from the HWS file are 24-47.

If the channel list for the HSDIO should be used to create the array of HWS channels to be pulled, then a channel mapping VI needs to be created based on the card and the channel list. The top-level VI as well as Read Large HWS File VI may also need to be modified to support this use case.

2. Build Script for Large HWS File - This VI takes a Script Name input and the array of sample subsets from the Read Large HWS File VI. It creates a script based on the number of sample subsets so that when the script name is called to be generated, it generates all subsets successively.

Once the HWS file is split and the script is created, the waveforms are loaded onto the hardware and the script is written to hardware. TClk is used to synchronize the cards and the session is initiated. Once the generation is complete, the hardware resource is released and the HWS file reference is closed.

Steps to Implement or Execute Code

  1. Select HWS File path
  2. Choose the number of HSDIO resources that are needed.
  3. Create the channel list for each HSDIO resource (array size of this input needs to match the array size of HSDIO Resources)
  4. Select a clock rate
  5. Run

If the HWS file has 72 channels and 9,500,000 samples and this is to be output across 3 HSDIO cards, each card would have written to it:

1 script named TestVector

1 array of waveforms with 10 elements. The waveforms would be named Section0-Section9

     The script will generate Sections 0-9 successively

     Sections 0-8 will have 1,000,000 samples, and Section9 will have 500,000 samples

     Each waveform will have 24 channels (this is based on the channel list)

Requirements

Software

niHSDIO

LabVIEW 2012SP1 or newer

Hardware

HSDIO card

Applications Engineering Specialist - Semiconductor Test
National Instruments

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

Contributors