04-24-2009 02:16 PM
Hello-
I am running Labview Real-Time on a PXIe-1062Q chassis, with a PXIe-8130 controller and using a PXI-5422 arbitrary waveform generator, developing in Labview 8.6.
I am using script mode and an external trigger to repeatedly output a precisely timed signal. I want to use a second trigger to basically turn the output signal on and off. Thus I have implemented the following script:
script myScript
Wait until scriptTrigger0
Generate wfmDC1V
Repeat forever
Wait until scriptTrigger0
Generate wfmDC1V
Repeat until scriptTrigger0
Generate wfmDC1V
Wait until scriptTrigger1
Generate wfmFile1
Generate wfmDC1V
end repeat
end repeat
end script
The intent of this logic is to output a fixed 1 V (wfmDC1V) most of the time. ScriptTrigger1 is received on PFI0 at regular intervals (~10 msec). ScriptTrigger0 is used first to start outputting 1 V, then to “turn on” the response to scriptTrigger1. When scriptTrigger1 is received, a stored waveform (wfmFile1, ~5 msec in length) is output. ScriptTrigger0 is used to toggle the stored waveform output off and on; when the stored waveform output is off, the output stays at 1 V.
I am experiencing a timing problem whenever the stored waveform output begins, i.e. whenever the script receives scriptTrigger0 at line 5. When scriptTrigger0 is received, wfmFile1 is output immediately, without waiting for the next occurrence of scriptTrigger1 (as I intend to happen at line 9). This is often followed by another output of wfmFile1 that is out of sync with scriptTrigger1. After a maximum of these two mis-timed outputs, subsequent outputs do occur upon receipt of scriptTrigger1, as expected.
A second timing problem occurs when I reduce the interval of the scriptTrigger1 signal to be shorter than the duration of wfmFile1. In this case, I would expect for wfmFile1 to finish outputting, then proceed back through the loop (outputting wfmDC1V twice), then wait at line 9 until the next scriptTrigger1 is received. Instead, the sequence of waveforms is output at the maximum possible pace, without any synchronization with scriptTrigger1.
I have tried implementing scriptTrigger1 as both a software trigger and as a hardware edge trigger on PFI1, with the same result. I am somewhat mystified, not sure if I have a problem with my logic or if I have encountered something else. I am still a novice and could very well be making a stupid mistake.
Any help would be greatly appreciated.
Thanks,
Steve
Solved! Go to Solution.
04-24-2009 02:52 PM
Hi Steve,
I think both problems can be addressed by clearing scriptTrigger1 before waiting for the next instance of it, like this:
script myScript
Wait until scriptTrigger0
Generate wfmDC1V
Repeat forever
Wait until scriptTrigger0
Generate wfmDC1V
Repeat until scriptTrigger0
Generate wfmDC1V
Clear scriptTrigger1
Wait until scriptTrigger1
Generate wfmFile1
Generate wfmDC1V
end repeat
end repeat
end script
When a trigger appears on the PFI0 line, it is "latched" and stored so the next time it is read, it will say that it has triggered. What you want is to ignore any triggers that happen when you aren't at the "wait until scriptTrigger1" statement, which can be done by "clearing" them.
Hope this helps,
Drew Creel
Software Group Manager
NI Signal Generators
04-24-2009 03:26 PM
Thanks Drew, that did it!
Steve