Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Create bursts of pulses

I would like to create a repeating burst of TTL pulses. Something like a burst of 500 1us pulses every second. I have been able to create a continuous pulse train and a single burst of pulses but I'm not sure how to repeat the bursts while having the timing run independently of the application. That is, it would be better if the program did not need to initiate each burst; rather that, once started, the burst train could be free-running until halted.
Thanks for any ideas.
Peg
0 Kudos
Message 1 of 7
(5,085 Views)
I should mention that I would like to do this with the NI6034.
Thanks, Peg
0 Kudos
Message 2 of 7
(5,081 Views)
Hello Peg,

I believe that you can use a pause trigger and an extra counter to do this. You would have one counter (counter 0) output a continuous pulse train of 1us pulses. Then you would configure the second counter (counter 1) to output a pulse train that has a period of 1 second with a duty cycle that is high for the length of time you want pulses to be generated on counter 0. For example, for 500 1us pulses the counter 1 output should be high for 500*1us=500us and low for 1s-500us=0.9995s. you can then use the output of counter 1 to be the pause trigger for counter 0. You can configure the counter operation to pause when the pause trigger is low. This means that counter 0 will only be outputing pulses when counter 1 output is high (the first 500 us of counter 1's pulse train output). An example of how to implement pause triggering can be found in the LV example finder. The actual location of the file is here:
C:\Program Files\National Instruments\LabVIEW 7.1\examples\DAQmx\Counter\Generate Pulse.llb\Gen Dig Pulse Train-Continuous-Pause Trigger.vi
Using this example and what you already know about generating continuous pulse trains, I think you should be able to successfully accomplish your task!

Take care,
E.Lee
Eric
DE For Life!
0 Kudos
Message 3 of 7
(5,073 Views)
Dear E. Lee,
Thank you for your suggestions. I had thought I could use Counter 1 as a gate but I don't understand how the example you referenced works. My device is under Traditional Ni-DAQ in Measurement and Automation. The DAQmx configurations are foreign to me, though maybe that is something I need to learn. Does the Counter 1 output need to be physically wired to the Counter 0 gate and then I set Counter 0 to continuous 1 us pulses and Counter 1 to continuous 500 us on, .9995 s off pulses?
I haven't tried that because I don't want to damage the DAQ by wiring something I shouldn't.
Thanks again,
Peg
0 Kudos
Message 4 of 7
(5,063 Views)
Hello Peg,

I would highly reccommend switching to DAQmx! Just to show you how much easier it is to program using DAQmx, I wrote an example that outputs 500 1us pulses every second. I hope you find this example useful. It's pretty self-explanatory, but you can change it to suite your needs. You do not have to physically connect anything based on the way I set up the program (you have to make sure though that ctr1 is the one generating your desired pulse train and ctr0 is the one generating the reference trigger signal, this is how the controls are setup by default). Let me know how it goes 🙂

Thanks,
E.Lee
Eric
DE For Life!
0 Kudos
Message 5 of 7
(5,049 Views)
Dear E. Lee,
Thank you for the vi and sorry to take so long getting back to you. I had to divert to another project for a while. Your vi works if I want my pulses on Ctr 1 but I cannot seem to switch to Ctr 0; that is, swap the two counters so that I can use the counter 0 pin (which is the pin wired to our power supplies). It brings up error 89136.
I am struggling to understand the DAQmx code - it is totally foreign to me. All my vis for controlling an electron gun power supply are in traditional NI-DAQ using many analog input and output channels on two devices. Can I use DAQmx with the traditional or do I have to completely reprogram everything?
One thing I notice is that the NI6036 is Device 1 under Traditional NIDAQ in MAX but is Device 2 under DAQmx. Why would this be the case?
Also, your vi sets the pulse length, but where does it set the duty cycle? It seems to always produce 50%.
I feel like I should be able to understand the DAQmx but I don't. When I try to use the traditional DAQ, it appears that I need to physically connect ctr 1 to ctr 2. Here is an instruction from "Generate Pulse Train": You must externally wire counter-1's OUT pin to counter's GATE pin for a finite-length pulse-train.
Sorry for the rambling questions. I just don't really know where to begin.
Thanks,
Peg
0 Kudos
Message 6 of 7
(4,997 Views)
Hello Peg,

Sorry it took so long for me to respond. I never got notified that there was a new post to the thread! Ok, let's get to the questions:

1) It looks like you have to have the pulses on Ctr 1. If you switch the counters, the routes cannot be completed.

2) You can use both the DAQmx and the NI-DAQ driver as long as each DAQ device is only using one of the drivers. For example, you cannot have dev1 use DAQmx for Analog Input and Traditional DAQ for Analog Output. However, dev1 can use DAQmx and dev2 can use Traditional DAQ.

3) There might be a couple of reasons why the 6036 is listed as a different device number in Traditional than in DAQmx. Do you have any other DAQ hardware installed? You can always change the name of the device by right-clicking on it in MAX and choosing "Rename" for DAQmx or "Properties" for Traditional DAQ.

4) If you go to the block diagram of the VI, there is a VI called "DAQmx Create Channel (CO-Pulse Generation-Time).vi" There are two inputs on the top called "high time" and "low time". As you can see, they are hard-coded to be the same value, giving the pulses a 50% duty cycle. You can change these values to change the duty cycle.

5) One nice thing about DAQmx is that it can do a lot of internal routing for you with little configuration. You can see that we use the counter output pulse terminal and wire it directly to the source input for the pause trigger. This is why we don't have to do any external wiring using DAQmx.

I hope this helps!
Eric
DE For Life!
0 Kudos
Message 7 of 7
(4,943 Views)