Example Code

Using TD-Scan with National Instruments High-Speed Digital Devices

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.


  • Other



Code and Documents




This example shows you how to generate WGL and STIL files using TD-Scan for National Instruments High-Speed Digital Devices.



Waveform Generation Language (WGL) and Standard Test Interface Language (STIL) are two formats which are standardized in the industry and are used with Automated Test Equipment (ATE) for testing of Integrated Circuits (ICs).
The following is a step-by-step guide for generating files of these formats using TD-Scan for National Instruments High-Speed Digital Devices. The guide walks through installing the TD-Scan software and TSSI API, and importing the WGL/STIL file using the TD-Scan software, including all the settings necessary to map the WGL/STIL data to the devices in your system. Then it will show how to generate the waveform using the resulting files and LabVIEW through the TSSI API and by using the Digital Waveform Editor.

Hardware and Software Requirements

The TD-Scan software requires a computer running Windows NT/2000/XP/Vista and it is recommended to have a configuration with 8GB RAM and a 3GHz CPU.  The TSSI API is available for LabVIEW 8.2.1 or higher and C examples are written using Microsoft Visual C++ 6.


You can apply for a trial license or purchase TD-Scan at Test Systems Strategies, Inc.


To install the TSSI API, download the needed files attached to this example.  You can then use the TSSI API for LabVIEW and C.  Refer to the Readme attachment for required software and set up instructions. The files will also include documentation for installation and setup.


TD-Scan determines the devices in your system by a list of devices in the ni_65xx.ate file in the same directory as the TD-Scan executable.  The list is in the Section Resources section of the file.  This list is set up manually, and should reflect the devices present in the system that the waveforms will be generated on.  A typical list will consist of the device model number, the number of channels in the device, and a unique device name.  Add the devices in your system in the format below.  Shown below is a system with three devices, a 6552, 6545, and a 6561.



Note: If changes are made to the ATE file, TD-Scan must be restarted to reflect those changes.

Steps to Implement or Execute Code

1. Importing a WGL/STIL file into TD-Scan

To begin importing the WGL/STIL file for use with NI-HSDIO devices, launch the TSSI TD-Scan software and create a new project. Select the WGL/STIL file that you would like to use by selecting Setup on the main interface and selecting your source file location and the ATE to which you will be outputting the data.  In this case, the ATE should be NI 65xx. Then, click Apply.



After selecting the file and the ATE name, select Import on the main interface.  The TD-Scan software will then parse the WGL/STIL file and create a timeplate for the waveforms in the file.  The status indicator next to the import button will turn green when the timeplates have been successfully read and imported.  If there are warnings or errors, the indicator will turn yellow or red, respectively.  Click on the indicator to get a list of the errors if the process was not successful.


Next, select the Signals… button under the Project Resources section of the main interface.  This will bring up a dialog that allows you to map a physical device channel to the channels in your WGL/STIL file.  You can do this manually, using the drop down menus, or by using one of the automatic configuration buttons above the channel list.  These will automatically select an instrument and subsequent channels for each signal in the WGL/STIL file. 



After importing the data and mapping the channels to a physical device channel, you can now manipulate the imported timeplates in order to ensure that the waveform can be reliably replicated on your HSDIO device.  Depending on what HSDIO device you are using, different sample rates and edge placements will be available.  Since WGL and STIL files are based on simulations, not all waveforms can be exactly duplicated by the hardware, and some data edges may need to be modified in order to fit into the constraints of the physical hardware.  No changes to the timeplate are needed for this example.  To open the timing editor, double click the timeplate name in the main interface of the TD-Scan software.  The timing editor will provide you with a method of dragging edges of a signal so that they will be able to be reproduced in hardware.



To make it easier to see where the edges of the sample clock are, it is recommended that you enable the grid in the timing editor by selecting View -> Show Grid and putting the sample clock period into the grid spacing at View -> Grid Settings…  This will enable you to easily set signal edges to correspond with the edges of the device’s sample clock.  To move an edge of the signal, click and drag at the edge of any transition.  The editor also allows you to insert new transitions or states in the timing.


When the file is exported, the signals will be placed as accurately as the device will allow.  For most devices, the signals can go on a rising edge, falling edge, or delay from the rising edge of the clock.  If two channels require to be delayed from the sample clock by different amounts, and they are both the same direction, one will be coerced to the nearest edge and a warning will be displayed.  It is best to be able to increase the sampling rate so that the edges of a signal can occur on the rising or falling edge of the clock, but if this is not possible the TD-Scan software will utilize the device’s data delay to generate more accurate timing.


Once the timeplates have been adjusted, you can view the expected output data using the cyclized waveform viewer.  To open the waveform viewer, select View -> Cyclized Waveform… in the main interface.  This will open a viewer that allows you to see what transitions will happen and at what time they will happen in the final waveform. 


The waveform data created is a factor of two parts, the timeplate, and the data.  The timeplate defines when edges can occur.  It contains a usually short period of time that is repeated throughout the file.  Some files contain a number of timeplates, with each timeplate defining different parts of the end waveform.  Some states in the timeplate, such as Force State, will output the state found in the vector file, and others always indicate that the signal should be high or low.  This data is represented in the waveform viewer as the reference and waveform data.  Waveform data shows the transitions indicated by the timeplate, and the reference shows the actual data output by the WGL/STIL file.



Above is an overlay of the waveform data, zoomed to show a single time cycle, along with the corresponding timeplate for that cycle.  As can be seen, the transition occurs at a time defined by the timeplate, and the transition to low or high is defined by the data file.


Finally, select the TesterBridge tab and select ATE Options… under the Setup section.  This will allow you to set the clock rate for the device, and also enable or disable some optional features.  It is important to set the clock rate to be the same rate as the grid when editing the timeplates, in order to ensure that the edits to the timeplate will not be coerced due to a sample clock that has edges in different locations.  Another option here is to output user comments in vectors.  This will output a comment every few lines in the waveform file indicating the time at which that sample occurs.  This is useful for debugging when certain samples in the waveform are occurring, and you do not have the Digital Waveform Editor to view the data.  However, files exported using this option will not be able to be imported correctly by the Digital Waveform Editor or read by the TSSI API for LabVIEW and C.



Once all settings are complete, click the TesterBridge button under the Run section to begin the conversion from WGL/STIL to a file able to be used with NI-HSDIO devices.  If the indicator turns green, the output has been successful, and you can click on the indicator to see where the files have been output to.  If the indicator is yellow, you can click to see any warnings that occurred when exporting the data, and if the indicator is red, a fatal error occurred and the waveforms were not able to be exported and clicking on the indicator will display the errors.


The TD-Scan software will output two files, an XML file that contains device configuration information, and an ASCII text file, containing the data for the waveform to be downloaded to the HSDIO device.  There are two different ways to use this data with your devices, either by importing the waveform using the Digital Waveform Editor, or by importing the instrument configuration and waveform data using the TSSI API written for LabVIEW and C. The recommended method is to import the waveform using the TSSI API, which is discussed below.


2. Importing Data Using the TSSI API

Using the TSSI API, you can import not just the waveform data, but also device configuration information like device names, channel lists, and data positions corresponding to the data.  The TSSI API allows for a more automated way of generating the data exported by the TD-Scan software, and it can be used with LabVIEW or text-based languages.  The TSSI API includes several examples of how to generate data or use hardware compare to verify the expected inputs.  One such example is shown below.

(1) The TSSIOpenFile.vi takes in a path to the XML file generated by the TD-Scan software, and parses the device setup within the file.   

(2) The user then initializes a generation session for their HSDIO device.  

(3) The TSSIGetInstrumentNames.vi then gets the names of all the instruments within the XML file, and the first name in the array is selected using the Index Array function. 

(4) The TSSIGetChannelList.vi then gets the channels that will output data, and assigns these channels to be dynamic using the niHSDIO Assign Dynamic Channels.vi.  

(5) The TSSIGetClockRate.vi uses the same instrument name and returns the clock rate of the output channels in the XML file, and this information is used to configure the HSDIO device’s sample clock.

The TSSI API can also configure properties such as data position and data delay, shown above. 

(6) The TSSIGetDataPositions.vi returns an array of clusters that contain a position, along with a string representing the channels that correspond with that data position, either rising, falling, or delay from rising edge.

(7) This array is indexed and each channel is configured to occur on the rising, falling, or delay from falling edge of the clock. 

(8) TSSIGetDataDelays.vi performs a similar act, returning an array of clusters that have a data delay and a corresponding channel list.

(9)  Each channel is then configured to have a specific data delay value.  Any channels with a data delay of 0 are not represented in the array, since those signals would fall on a data position that is not delay from rising edge.


(10) TSSIGetSignalNamesForInstrument.vi will return an array of signal names for an instrument in a particular direction.  For the above example, it will return an array of all of the output signals for the first device in the XML file. 

(11) This array can then be input into the TSSIReadWaveformData.vi, which will return a Digital Waveform of the data for certain signals.  This VI can read certain sections of the data, enabling the user to read the data from the file in chunks.  With the inputs left as default, this VI will return a waveform with all signals in the file.

(12)  This waveform is then downloaded to the device and

(13) generated.

(14)  Then the VI waits until the generation is complete,

(15) and closes the session to the HSDIO device.

(16)  Finally, the XML file generated by TD-Scan is closed and any errors are handled.


The API provides information to use with the HSDIO driver such as the resource name in the system, the channels used, the waveform data, and data positions and delays.  The general flow of the TSSI API follows the HSDIO API so that there is an almost one for one mapping of the properties configured by the HSDIO driver with the data returned from the XML file.  Please refer to the examples included with the TSSI API for different properties and configurations for HSDIO devices using the TSSI API.

3. Importing Data using the Digital Waveform Editor


The waveform file exported by the TD-Scan software can be imported directly into the Digital Waveform Editor (DWE).  However, the XML file and the configuration information contained inside cannot be imported.  Therefore, all information regarding device names, channel lists, and data delays will be lost.  The DWE can import the waveform, where the user can possibly make more edits, then save the waveform to an HWS file, which can be natively used with the NI-HSDIO driver to generate the waveform.  To import the waveform data, open the DWE and select File -> Import -> From ASCII…



Select the text file generated by the TD-Scan software and an import wizard will begin.  In step 1, change the start row for the file so that the signal names line up with the column names.  Once the data preview looks as expected, click Next.



In step two, all of the signals will consist of 1 bit interpreted as binary data.  Set the options as thus, and click Next. 



In the final step, select the sample clock rate that was configured when using the TD-Scan software and click Finish. 



The DWE will then parse the rest of the file and display the waveform.  This waveform can then be edited, saved, expanded, or any other function that the DWE can normally perform. 



You can then save the waveform as an HWS file and use the functions in the NI-HSDIO driver to generate your waveform on a HSDIO device.  The waveform can also be generated in SignalExpress by selecting the play button in the Digital Waveform Editor.  The new "Single-Device-Output-High-Performance.vi" example illustrates how to do this using the niHSDIO Write Named Waveform VI as shown below.  

4. Conclusion

With the TD-Scan for National Instruments software, you now have the ability to import IC design simulation files such as WGL and STIL to National Instruments hardware and software.  You can use the TD-Scan for NI to edit timing parameters and optimize vectors for the National Instruments NI 654x, 5x and 6x series.  Devices such as the NI 6545, capable of up to 200 MHz and programmable data delay are ideal for such vectors.


The vectors can be used in LabVIEW, text-based languages, and with the Digital Waveform Editor.  For automated tests, the TSSI API is recommended to generate the vectors, since it allows complete device setup information as well as waveform data.  For enhanced control of edge placement, the Digital Waveform editor can be used to edit the edges of data within the waveform.


Additional Information or References

More LabVIEW and C examples are included with the TSSI API.  Each demonstrates a different method of configuring one or multiple HSDIO devices.  

More information about the Digital Waveform Editor and its features can also be found on ni.com.


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


Is anyone get  success on trying the example vi? 

I have tried two method to output Waveform on PXIe-6556, but both got error on niHSDIO write Name Waveform.vi. 

NI distributor near me,  tell me to move to PXIe-6570, but I had 2pcs of PXIe-6556 on hand.

TSSI API VI is locked to debug, so I ask help here.


I have inform this error message to TSSI, through their agent in Taiwan , and get possibility to fix API by NI  technical team.

I hope to get new API release ASAP, and I like to test it.  

Thanks for every body to help fixing this issue.

Attached is my error message during running  API to drive HWS file, which is WGL file converted to txt, and txt file converted to HWS , by NI-DWE.