LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate N-pulses repeatedly

Hello everyone!

 

I'm currently faced with the problem of repeatedly generating N-pulses (N-cycles of a pulse train) using the counter output of my NI USB-6211 device. What I basically want to do is to generate N-pulses at some specified frequency f, wait for a certain amount of time t (in the order of 1-2ms), and then generate the same N-pulses again. This process should continue indefinitely! I know how to generate a counter output of N-pulses. But, simply inserting this into a while loop will not solve the problem as the associated loop-delay is in the order of 70ms.

 

Thank you in advance.

0 Kudos
Message 1 of 25
(4,853 Views)

Have you tried using your device's pulse generation functionality using the Frequency and Duty Cycle? Set up a DAQmx task to generate the frequency and duty cycle that you require.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 25
(4,841 Views)

Hello,

 

Are you saying that it takes 70ms to generate your pulse train? If so, add a wait delay at the end of the pulse train inside the while loop. You can use a flat sequence.

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Wisdom is the principal thing; therefore get wisdom: and with all thy getting get understanding. Proverbs 4:7
0 Kudos
Message 3 of 25
(4,834 Views)

Hello!

 

I'm currently using the pulse generation functionality to generate an 8-cycle pulse of frequency f = 40kHz with a 50% duty cycle. However, when the finite signal has been generated, I want to wait on a zero idle-state for about 1-2ms and then generate the same signal again automatically.

0 Kudos
Message 4 of 25
(4,810 Views)

Hello,

 

No, I'm generating a pulse of 8-cycles at the f = 40kHz (or T = 25us) with a duty cycle of 50%. So the total length of the signal is 8*25us = 0.2ms. Once the signal has been generated I want to hold the output on an zero idle-state for about 1-2ms and then generate the same sequence again. Hope this clarifies things!

0 Kudos
Message 5 of 25
(4,806 Views)

Can you set up a second pulse train, on a second channel, that will act as a trigger for the first pulse train? I'm pretty sure the hardware allows this, and that's how I'd do it.

0 Kudos
Message 6 of 25
(4,784 Views)

Not able to simultaneously generate two counter outputs in which one channel acts as a trigger for the first channel but I understand your idea! Can you possibly attach some example VI? Is this even possible with the USB 6211?

0 Kudos
Message 7 of 25
(4,764 Views)

I don't know the exact capabilities of the USB-6211 and don't have a similar device for testing, but I set up a DAQmx simulated device and don't get any errors. When you set up your finite pulse train, set the start trigger to be the other counter output. Set the trigger channel so it has a rising edge as frequently as you need to retrigger the finite pulse train. Does this work? If not, what error do you get, and can you share your VI? Again, sorry I can't confirm that this definitely works, but I don't see why it wouldn't. Another option might be to use the Pause trigger instead of the Start trigger, if you want to use the second channel to pause generation of the first channel's pulse train, which would have a similar output and effect.

Retriggerable Finite Pulse Train.png

0 Kudos
Message 8 of 25
(4,748 Views)

Hello again!

 

Below is an example of the functionality that I want to ahcieve except for the modification that you purposed in which my counter output CTR1 (PFI5) is triggered by another counter CTR0 (PFI4). So far I'm able to generate a finite pulse consisting of 8-cycles at the desired frequency (the analog input channel reads the data continuously) but don't know how to add a second counter in my code as to repeatedly regenerate the sequence. My experience with LabVIEW i pretty limited so I hope that you bare with me.

0 Kudos
Message 9 of 25
(4,720 Views)
Did you look at the image I posted? You configure the second counter similar to how you configured the first. In the configuration for the first counter you currently have the trigger set to None; you'll change that to be a digital edge on the second counter channel.
0 Kudos
Message 10 of 25
(4,689 Views)