Configure Script Mode
- Updated2025-10-10
- 2 minute(s) read
You can use Script mode to use scripting to link and loop multiple waveforms in complex combinations using a script.
LabVIEW Example
The procedure below provides the basic steps required to configure Script mode. To see a more detailed example of the use of Script mode in LabVIEW, refer to the Fgen Arb Script.vi example for LabVIEW.
- Call the niFgen Configure Output Mode VI with Output Mode set to Script.
- Write all waveforms that are referenced in the script by calling the niFgen Write Named Waveform VI and associate the proper names to them.
- After your waveforms are written to your device, call the
niFgen Write
Script VI 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
- (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 the Script to Generate property.
C Example
The procedure below provides the basic steps required to configure Script mode. To see a more detailed example of the use of Script mode in C, refer to the ArbitraryScript example for CVI.
- Call the niFgen_configureOutputMode function with outputMode set to NIFGEN_VAL_OUTPUT_FUNC.
- Write all waveforms that are referenced in the script by calling the one of the niFgen Write Named Waveform functions (niFgen_WriteNamedWaveformF64 , niFgen_WriteNamedWaveformI16 , niFgen_WriteNamedWaveformComplexF64 , niFgen_WriteNamedWaveformComplexI16) and associate the proper names to them.
- After your waveforms are written to your device, call the
niFgen_WriteScript function 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
- (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 the NIFGEN_ATTR_SCRIPT_TO_GENERATE attribute.
Related Information
- Script Mode
Script mode allows you to use scripting to link and loop multiple waveforms in complex combinations using a script.