08-14-2008 03:52 PM
What is the fastest way to transition from a complex script already using markers and triggers to a known constant voltage level on the 5421 using c functions?
Is it to load a second script in advance with a single voltage level and activate it using the following 3 steps?
-niFgen_AbortGeneration
-Set NIFGEN_ATTR_SCRIPT_TO_GENERATE attribute to the single voltage script
-niFgen_InitiateGeneration
How long should these 3 steps take?
Is there a faster way?
08-15-2008 04:02 PM
tomkor,
I believe that the fastest approach involves embedding the DC Generation script into the script that you have at the moment. You could allow this part of the script (DC Generation) to start at a specified script trigger and generate a pre-made DC waveform forever. The script that exhibits this behavior is as follows:
Wait until scriptTrigger0
Generate DCwfm
Repeat Forever
Could you attach the script that you have at the moment to clarify the issue further?
08-15-2008 05:58 PM
tomkor,
I made a mistake in my last post concerning the repeat forever in the script. The script should look as follows:
wait until scriptTrigger0
repeat forever
generate waveform
end repeat
Hope this helps.
08-15-2008 06:07 PM
08-18-2008 08:15 AM
The desired behavior is to execute the complex script, until an external software event occurs.
Wait until script trigger will not continue to execute the script, it will stop at a single value.
08-18-2008 11:37 AM
tomkor,
I have listed another idea, below, that you may wish to use. The "repeat until scripttrigger" should be able to constantly loop over your complex script until the appropriate software edge occurs.
repeat until scripttrigger0
<place your complex script here>
end repeat
generate DCwaveform
As psisterhen had suggested, "the generator should maintain the DC level of the last sample of the last waveform it was generating" is absolutely true. You would only want to use the repeat forever with the DC waveform if you would like to control when the generation ceases. Please let me know if you have further concerns.
08-19-2008 02:04 PM
The script can take many seconds to complete a repeat cycle. I am interested in interruping and transitioning to the DC level in the shortest time.
The repeat until won't interrupt until completion of an entire multisecond cycle.
I expect that niFgen_AbortGeneration is an immediate termination. But I'm trying to get a feel for how long it would takefor the 3 steps:
-niFgen_AbortGeneration
-Set NIFGEN_ATTR_SCRIPT_TO_GENERATE attribute to the single voltage script
-niFgen_InitiateGeneration
And Is there a faster way to achieve this transition in less time?
08-19-2008 02:32 PM
The easiest way to transition to a known DC value after a generation is aborted is to use the "Idle Behavior" and "Idle Value" attributes - these are new in NI-FGEN 2.6. Set NIFGEN_ATTR_IDLE_BEHAVIOR to NIFGEN_VAL_JUMP_TO_VALUE and set NIFGEN_ATTR_IDLE_VALUE to whatever DC level you want, and when generation finishes or is aborted, the output will automatically go to and remain at that level. So for your application, you could set these attributes and call AbortGeneration to have it transition instantly to the "idle value".
NI-FGEN 2.6 can be downloaded from http://www.ni.com (just search for "fgen 2.6" ).
As a side note, when AbortGeneration is called, the script will interrupt after the currently generating waveform finishes. So, if you only have one really long waveform in your repeat cycle, it won't abort until that entire waveform is finished. But if you have a bunch of small waveforms in your repeat cycle, it will abort immediately after whichever one it is currently on finishes. This is faster than waiting on a script trigger, which as you correctly stated will only jump out of the repeat loop when it completes the entire cycle.
Drew Creel
NI Software Group Manager
Signal Generators Group
08-19-2008 04:14 PM