Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

nesting generated waveforms, multiple initiate calls?

Hi,
 
 
I am generating a digital pattern with a PXI-6542 that uses scripting to generate one pattern followed by 500+ repeats of another pattern.   I used a software start trigger to begin the generation.  But now I need to tell the 6542 to do this whole pattern some number of times, i.e. 2 to 20.  Scripting won't support this additional nesting.  I tried using a for loop: In the for loop "send software start trigger" is followed by a while loop that checks for generation complete before the next iteration.  This resulted in only one triggering of the generation.  I got it working by putting the HSDIO Initiate VI inside of the for loop, but that doesn't seem right (additional delay? hiccupping in the timebase?).  Is it a bad idea to do it this way and is another solution obvious to anyone out there?  Do I need to send advance triggers after the first start trigger?
I also have two marker events generated near the start of the first pattern that I need to retain (they are exported to start a high speed digitizer, which will also need to trigger as many times as the generation).
 
Thank you for any help,
 
Bill M
 
Message 1 of 6
(3,909 Views)
Hi Bill,

I would suggest that you move you move the repeats to your hardware script. This way there will be no software interaction and the pattern will repeat without any sort of delay. Here is a quick example of an script that you could use:


script myScript1
Repeat 20
Generate WfmA marker0(0) marker1(1024)
Repeat 500
Generate WfmB
end repeat
end repeat
end script


If you need to control your repeats in software, you can add a "wait for trigger" statement and generate a script trigger in software. This will be quicker than calling initiate. Here's the modified example:


script myScript1
Repeat 20
Generate WfmA marker0(0) marker1(1024)
Repeat 500
Generate WfmB
end repeat
Wait until scriptTrigger0
end repeat
end script


If you need multiple values for your repets, you can donwload a bunch different scripts to the hardware and then have your software select the right script to generate before initiating.

Let me know if this helps.

Juan Carlos
NI
0 Kudos
Message 2 of 6
(3,888 Views)

Juan,

Thanks for the reply.  I am almost positive I tried this as first thing long ago, and got an error saying the device (PXI-6542) does not support two levels of repeat nesting. Will try again and verify.  But I'm pretty sure that's why I originally put my start trigger in a loop.

Bill

0 Kudos
Message 3 of 6
(3,882 Views)

Juan,

Yep, just tried doing what you suggested. I get an HSDIO error that says to unroll one of the repeat/end repeats, as the device allowed number of levels of nesting is 1.

Thanks anyway!  It is a pain, this limitation. My workaround is to explicitly duplicate my statements in the script, and only start trigger once (no multiple initiate calls).

Bill

0 Kudos
Message 4 of 6
(3,878 Views)
Bill,

You are right, I tried this now in an actual device and it does errors out. What the devices does allow, is to nest a repeat within a "repeat forever" statement. So, you could could run something like this:

script myScript1
Repeat forever
Generate WfmA marker0(0) marker1(1024)
Repeat 500
Generate WfmB
end repeat
Wait until scriptTrigger0
end repeat
end script

And have software generate the script trigger and keep the total count. It's not completely hardware timed solution, but it's better that calling init.

Juan Carlos

Message Edited by JuanCarlos on 05-21-2007 01:06 PM

0 Kudos
Message 5 of 6
(3,877 Views)

Thanks Juan,

I may give this a shot.  Right now I'm having trouble using TClk with a 6542 gen session, a 6542 acq session, and a 5122 session.

 

Bill

0 Kudos
Message 6 of 6
(3,867 Views)