07-21-2006 09:48 AM
I posted it in another board by mistake, I post it here again.
I am using PXI-6561 to generate and acquire waveforum in my application. Channel 0 is used to generate fixed rate clock, channel 1 is to generate control command, channel 2 to 7 are to acquire data. I have 10 different groups of commands, I save them as mywfm0 to mywfm9 by waveform editor, each waveform file contains clock and command signals.
Here is my questions: how can I control the waveform generation flexibly? For example, in front panel, if I run the application, it will generate waveform mywfm0 continuously, when I click "generate waveform mywfmX (X=1..9)" button, it will generate mywfmX ONCE, then continue to generate mywfm0 repeatly.
I considered to use script and software trigger to control different waveform generation, but I can only have up to 4 different software triggers in script, which is less than what I need.
Another solution is to use a while loop and case structure, but in each case, I have to write different waveform to board, which will introduce some software delay.
Is there anyway I can download all of waveforms into memory once, label each waveform in memory, by default it will generate mywfm0 repeatly, whenever a button pushed, it will generate the corresponding waveform once, then go back to mywfm0 again.
Thank you very much. Please let me know if my description is too confusing.
Regards,
chc
07-21-2006 05:05 PM
You can load all waveforms using write named waveforms into the memnory on your 6561.
As for generate a particular waveform based on click of a button, you may want to look at a different way to generate the clcok (CLK OUT?). Do you have to have the clock "off" while you generate other commands?
07-21-2006 05:48 PM
Hi CT,
Thank you very much for your reply.
Actually in my application the clock has to be ON when I generate other command, the best situation is the clock is always on, I just change different command signal. If I can control clock and command individually, that would be great, but seems it is not easy to do. The hardware design has finished, which means I have to use channel0 to generate clock.
With your suggestion, I can write all of the waveforms into on board memory, the system will run mywfm0 (which just generate clock and idle command) repeatly by default, but how can I generate different waveform ONCE when I click different button, after that the system will continue to run mywfm0 repeatly?
07-21-2006 06:31 PM
07-21-2006 06:31 PM
<sorry, had to split into two posts>
We'll use the truth table above for the the first 8 waveforms, but only use the values for triggers 0, 1, and 2. ScriptTrigger 3 will be used as a synchronization signal. When ScriptTrigger 3 is asserted, we can be gauranteed that scriptTriggers 0, 1, and 2 have all been set (none are in a changing or unknown state).
script myScript
repeat forever
generate myIdleWaveform \\ this is the waveform you want to always have running
if scriptTrigger3 \\ if True, then we can read all of the triggers
if scriptTrigger2
if scriptTrigger1
if scriptTrigger0
generate myWfm0 \\ T, T, T case
else
generate myWfm1 \\ F, T, T case
end if
else
if scriptTrigger0
generate myWfm2 \\ T, F, T case
else
generate myWfm3 \\ F, F, T case
end if
else
if scriptTrigger1
if scriptTrigger0
generate myWfm4 \\ T, T, F case
else
generate myWfm5 \\ F, T, F case
end if
else
if scriptTrigger0
generate myWfm6 \\ T, F, F case
else
generate myWfm7 \\ F, F, F case
end if
end if
end if //end of start trigger event
end repeat
end script
Now in the LabVIEW application, you will need to assert scriptTriggers 0, 1, and 2 first, then set scriptTrigge3. For example, if you want to generate myWfm2, then assert triggers 0 and 2 first, then assert trigger 3. Use the "niHSDIO send softare trigger.vi" to assert the triggers.
I've included a LabVIEW VI that demonstrates how to do this with 8 waveforms. In your case you need more than eight, so you will not be able to use scriptTrigger3 as the sync trigger because you'll need all four to fill out your truth table. So instead, you can use a startTrigger event in place of scriptTrigger3.
script myScript
repeat forever
generate myIdleWaveform
if startTrigger \\ this is asserted using the "send software edge trigger.vi"
.
.
.
Oh, I almost forgot. You will need to have a generate statement before each If/Else statement in order to not get a HSDIO error. I didn't show that above because it would have made the script even more difficult to read (it is already hard enough to read). So before each if statement add "generate myIdleWaveform".
Good Luck.
07-21-2006 10:22 PM
07-24-2006 11:23 AM