Example Code

Fgen Arb Waveform Streaming with Script Mode

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
Use this example to stream a waveform to the AWG even in Script Mode.

Description
1) Allocate Streaming Memory using niFgen_AllocateWaveform function
2) Pass the "Waveform Handle" output of niFgen_AllocateWaveform function to "niFGEN Streaming Handle" attribute
3)Fill the Streaming Memory Buffer with data using niFgen_WriteBinary16Waveform and Streaming Waveform Handle
4) Then read the attribute "Streaming Waveform Name". You can use this name now in script
To generate these sequence of waveforms, a sample script would be:
script myscript
generate wfmA
generate wfmB
repeat <repeat count>
generate <streamingwfmname>
end repeat

5) Download the script using niFgen_WriteScript function
6) After you start the generation, inside a while loop continuously monitor the "Space Available in Streaming Wfm" and transfer the data using "niFgen_WriteBinary16Waveform and Streaming Waveform Handle.

Requirements
Software

 LabVIEW 2012 (or compatible)
 NI-Fgen driver which is compatible with your hardware and version of LabVIEW
Hardware
 Streaming/Script Mode capable AWG (54xx)
 Streaming capable PXI/PXIe controller or external PC
 Streaming capable PXI/PXIe chassis


Steps to Implement or Execute Code
1. Select the AWG Resource Name
2. Run the code and determine what the streaming waveform name should be from the Waveform Name indicator.
By default, the name of the streaming waveform on some AWGs is www10000.
3. Use the streaming waveform name returned by the waveform name indicator in the script.

wave.png

If the waveform that you have selected in your script does not exist, you will get this error. Simply read the waveform name using the property node to use as your streaming waveform name.

Additional Information or References
VI Block Diagram

127.png 

 

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

 

Product Support Engineer
National Instruments

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

Comments
RM741
Member
Member
on

Thanks a lot for the detailed comments & the example codes

Yet another example that a well documented post will help people over years