02-01-2012 05:24 PM
02-02-2012 12:52 PM
Hi sox,
Looking at this, you have two nested loops, but nothing is in the first loop. As you said, you're generating Signal A 15 times and then repeating these 15 signals 20 times. Is there any reason you can't just put them together and do something like:
script genMyWaveforms
repeat 300 (this is 15 times 20)
generate SignalA marker1(0)
end repeat
end script
Just roughly typed out of course. Hope this helps!
02-02-2012 01:12 PM
Sorry, I forgot to add something else.
The NI Script Editor Help clarifies this a bit further. You can do:
repeat forever
<instructions>
repeat <N>
<instructions>
end repeat
<instructions>
end repeat
or:
repeat forever
<instructions>
repeat until scripttrigger0
<instructions>
end Repeat
<instructions>
However, our scripting editor does not support doing two finite loops nested within eachother. If you're using LabVIEW, you might be able to put a for loop around what you're putting in the script, but anything that's in that for loop and not in the script will have to be coded into LabVIEW.
Hope this helps/clarifies further.
02-02-2012 02:06 PM
Lea,
Thank you, but ....
I need to generate a trigger every 15 times. I thought about just doing a repeat 300, but how do I generate a trigger every 15 times without some complicated formula trying to figure out how many samples will have occurred etc.
I used 20, and 15 in my example, but in reality these will be variables that get put into the script.
Thanks in advance,
Go Sox (and Patriots)
02-02-2012 03:09 PM
Hi Go Sox
Will the following script do as you wish?
script myScript1
Repeat 20
Generate SignalA marker0(0)
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
Generate SignalA
end repeat
end script
If so, I know it seems to be a brute force approach, but the only method I know of to create the functionality that you desire. The script can be created programatically by creating a program that includes all the possible ways that you may need to generate a script. A little bit of work up front, but pretty easy afterwards.
I've attached a simple VI to generate your scrip[t with the ability to vary the number of times the trigger is generated and the number of times the waveform repeats between triggers. Youc an expand on this to create some fairly complex scripts.
One more note, there is a limit to how many times you explicitly put generate statements in a row. Unfortunately, I'm do not know what that is, but I think you can get to 128 or 256 without an issue.
I hope this helps.
Jerry (Go Giants)
02-02-2012 03:40 PM
A small clarification. Two snippets written above:
Apparently Labview doesn't allow these 2 nested loops.
However, our scripting editor does not support doing two finite loops nested within eachother.
Just to clarify something: The nested-loop limitation is not in LabVIEW nor in the Script Editor (either one would sound very silly). The limitation is in the SMC (Synchronization and Memory Core) board, the digital engine in your signal generator. The driver compiles your script into SMC-specific instructions. Because of how the SMC fetches data from memory and the speed requirements on this, there are limits on what it can do.
02-02-2012 04:36 PM
Thank you all (even the Giants fan ). I will try the brute force approach with the long script.
Hopefully National Instruments will add the "nested loop ability" to it's Signal Generators, as well as being able to generate a marker (ie trigger output) before a waveform.
Thanks again
Go Sox (and Pats)