LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Syncing loops

Hello All:

I have a rather simple problem. I have two loops; one is a timed loop and the other is a counter source picking up random signals. The algorithm is:

- I have a stream of signal coming in thru the source.

 

- I have a times loop that is used for a trigger.

- The setup is such that after 5 sec (determined by the timed loop) I want to wait for the next immediate random signal (high state) and when they are both true to I want to generate a pulse train for 20 sec.

 

What I have done so far is attached. The problem is when they are both true and while I am generating the pulse train, there will still be state when they both are true but we wont do anything during the pulse train generation.

So far I have created global variables to transport the signals outside the loop but now what?

This is that simple but my simple mind cannot solve this problem. I am stuck! Any help?

Thanks in advance.



 

 

 

0 Kudos
Message 1 of 6
(2,863 Views)

Hi sha33,

What hardware are you using?  You've given some good information on your software issue but if you can explain the hardware (pci cards etc.) it will be easier to solve this.  Depending your hardware you may not even need to use a timed loop.  Thanks.

 

Stephen S.
National Instruments
1 Test is worth 1000 expert opinions
0 Kudos
Message 2 of 6
(2,828 Views)
Thank you very much for your reply. I forgot to mention the board. Its PCI 6601. I am using this board for some other projects too. I can detect the ttl pulse coming in and I have tested it but the problem is to get that sync thing right - whenever I reach my time I start the pulse train at the next pulse coming from the input (the ttl pulse)

Thanks
0 Kudos
Message 3 of 6
(2,788 Views)
To give you a better understanding :


0 Kudos
Message 4 of 6
(2,774 Views)
Any idea guys?
0 Kudos
Message 5 of 6
(2,750 Views)
Hi Sha33,
It seems like you are using the loops to essentially act as a trigger for the generation of your pulse.  I think you will be better off if you use a counter task and set up the triggers in hardware.  You can create a counter task that has an initial delay of 30 seconds, meaning that it will wait 30 seconds before starting.  Once that task starts it generates a pulse train that you can define by the number of ticks, high time/low time etc.  As soon as the pulse generation is done it goes back and waits for 30 more seconds.  There is an example in the NI Example finder called Gen Dig Pulse-Retriggerable.vi.  Go to the example finder and search for trigger or triggering to find that example.  You migh also consider posting this question on the DAQ forums to get further help implementing this in hardware, which I think will be substantially easier than trying to use timed loops to act as timers for you hardware.  Thanks and have a great day. 
Stephen S.
National Instruments
1 Test is worth 1000 expert opinions
0 Kudos
Message 6 of 6
(2,734 Views)