Programmatically Generating HWS Waveform Data in LabVIEW

Updated May 3, 2018

Reported In


  • PCI-6541
  • PXI-6541


  • Digital Waveform Editor



Issue Details

I am looking to automate the process of programming or generating HWS waveform files or data types in LabVIEW. I would like to feed in arrays of data into LabVIEW and automatically create a resulting waveform without using the Digital Waveform Editor.


There are are few different ways you can generate digital waveforms to output in LabVIEW:

1. Use the NI-HSDIO Convert Binary To WDT VI​
You can convert unsigned binary data into a digital waveform data type (WDT) and then pass this WDT into a Write function using the niHSDIO Convert Binary to WDT VI. When reading from a HWS file, LabVIEW automatically pulls the waveform out of the HWS file as a WDT.

2. Use the Build Binary Data and Build Waveform VIs
You can convert integer numbers into digital data, then convert the digital data into WDTs to pass into your NI-HSDIO Write Named Waveform VI. To set a frequency or a data rate of your waveform write a value into the dt input of the Build Waveform VI, and make sure that the Use rate from waveform parameter is set to True. Please refer to the code snippet below as an example.

3. Write the waveforms as integers directly to the Write Named Waveform VI
Lastly, you can directly input integer array data into the NI-HSDIO Write Named Waveform VI. For each individual integer value, each bit of the number corresponds to a physical output line, where the least-significant bit (LSB) corresponds to line 0, the next bit corresponds to line 1, and so on.

NI-HSDIO comes with shipping examples that show how to do this. You can find one such example in LabVIEW by going to: 

Help>>Find Examples... 

This will open up the NI Example Finder. In the middle of the window, select: 
Hardware Input and Output>>Modular Instruments>>NI-HSDIO (High-Speed Digital I/O)>>Dynamic Generation>>Non-Scripted>>Dynamic 

This example lets you select a channel list and a clock rate for your generation. The data generated in the example program is random but you can copy and modify the example to fit the data you want to write out on the lines of your digital card. 

Additional Information

WDTs contain three components, t0, dt, and Y:

t0 - a timestamp accompanying the waveform listing the time at which the first data point in the waveform was generated.
dt - specifies the amount of time in ms between elements in the binary array. Can be thought of as 1/f, where "f" is the frequency of the digital signal. 
Y - the actual byte values in each element of the array. 

Hierarchical Waveform Storage data files are proprietary file types for National Instruments. They are written as binary files, and are used for storing analog and digital waveforms with additional information such as device configuration settings and more.


Not Helpful