Configure Script Mode

You can use OutputMode.Script to link and loop multiple waveforms in complex combinations using a script.

The procedure below provides the basic steps required to configure scripts.
  1. Set FgenOutput.OutputMode to OutputMode.Script.
  2. Write all waveforms that are referenced in the script by using FgenNamedWaveform.Allocate and the FgenNamedWaveform.Write overloaded methods.
  3. After your waveforms are written to your device, call FgenScript.Write to write the script(s) containing the generation instructions to be executed.
    The script you write can manage waveform generation based on multiple waveforms and triggers. For example, you could download waveforms A, B, C, and D into device memory. You could then write a script that would wait for a trigger to initiate generation and, upon receiving this trigger, generate waveform A three times with a marker at position 16 each time and finally generate waveforms B, C, and D twice (BCDBCD). The following is the script of this example:
    script myFirstScript
       wait until scriptTrigger0
       repeat 3
    generate waveformA marker0(16)
       end repeat
       repeat 2
    generate waveformB
    generate waveformC
    generate waveformD
       end repeat
    end script
    
    
  4. (Optional) You can write multiple scripts that exist simultaneously on your device. If you write multiple scripts to your device, you must select the one you wish to execute by setting FgenScript.ScriptToGenerate.