Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

two retriggerable pulse generations after a pulse train generation

I am trying to generate 3 pulse trains (ABCABCABC...) one after another.
 
The program currently I am using generates 2 pulse trains (ABABAB.....).
 
I am using the Traditional NI-DAQ and PCI-6602.
 
I am thinking about using pulse train generation first and then retriggerable pulse generation after that.
 
I understand that the retriggerable pulse generation can generate a pulse train triggered (or gated) by other counter output.
 
I have attached a test vi.
 
It uses the pulse train generation code when the counter number is 0 and when the counter number is not 0, then it uses the retriggerable pulse generation code, which I tried to modify from the pulse train generation code.
 
First of all, I am not sure if I wrote the retriggerable pulse generation code correctly.
 
Secondly, I don't know if the whole code will generate ABCABCABC...
 
I would really appreciate your help.
 
pchemjjang
0 Kudos
Message 1 of 8
(5,107 Views)
 
pchemjjang,
 
There is a Traditional DAQ example that should be great help in this situation.  While in LabVIEW, select Help>>Find Examples and then select Browse according to: Directory Structure.  Expand the following folders: daq>>ni-tio.llb and select Finite Pulse Train(NI-TIO).vi  This vi should automatically output pulses from the coutner out pin with the specified amount of pulses at the frequency and duty cycle that you choose.  You should be able to mold the # of pulses, frequency and duty cycle to meet your finite pulse train generation.  No external connections should need to be made but two counters will be utilized behind the scenes.  As a side note, the 6602 can also work with DAQmx and could make your support of this application easier in the future.  The same example exists in DAQmx but you would need to get the DAQmx driver from the following site: https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html.  The example can then be found under Help>>Find Examples and then select Browse according to: Task.  Then expand the following folders: Hardware Input and Output>>DAQmx>>Generating Digital Pulses and selecting Gen Dig Pulse Train-Finite.vi. 
 
 
0 Kudos
Message 2 of 8
(5,096 Views)
"... select Finite Pulse Train(NI-TIO).vi  This vi should automatically output pulses from the coutner out pin with the specified amount of pulses at the frequency and duty cycle that you choose.  You should be able to mold the # of pulses, frequency and duty cycle to meet your finite pulse train generation.  No external connections should need to be made but two counters will be utilized behind the scenes."
 
 
Thanks for your help first of all.
 
I have a couple of questions and I am hoping that you could clarify on them.
 
Can the Finite Pulse Train.vi generate 3 pulse trains that look like this?
___           ___          ___           ___          ___
|     |_____|     |_____|     |_____|     |_____|     |.............................................................
 
      ___           ___          ___           ___          ___
      |     |_____|     |_____|     |_____|     |_____|     |......................................................
 
            ___           ___          ___           ___          ___
            |     |_____|     |_____|     |_____|     |_____|     |.................................................
 
Also, which two counters are used for what kind of jobs?
 
I need to send these pulses out to switch on and off three different lasers one at a time and repeatedly for about 10 minutes.
 
Each laser should be on for say 100 microseconds and off for next 200 microseconds and on for 100 microseconds and off for 200 microseconds and so on.
 
I appreciate your help again.
 
pchemjjang
0 Kudos
Message 3 of 8
(5,090 Views)
 
pchemjjang,
 
I believe I may have misunderstood your original concern.  It sounds like you want to output this finite pulse train on three different counters.  You will output these pulse trains for 10 minutes and cease your program.  The Finite Pulse Train.vi will output a pulse train from only one counter.  With this Traditional DAQ example you would need to have three of these Finite Pulse Train.vi programs running simultaneously in parallel to output from 3 counters.  I would strongly recommend using DAQmx for this application because you will only need to utilize 4 VIs.  The rest of the work is done behind the scenes.  There is an example in DAQmx which should accomplish exactly what you are looking for in one program.  You must make sure to make the number of pulses 2000000, the duty cycle as 1/3 and the frequency as 1/(300us).  The DAQmx driver can found here.  In terms of the counters, I believe that each task requiring two counters will use the counter adjacent to it.  If you would like to output on counter 0 using finite generation then counter 1 will be used as the gating counter.  When you have the DAQmx driver then you can find this example by selecting Help>>Find Examples and then expanding Hardware Input and Output>>DAQmx>>Generating Digital Pulses>>Gen Dig Pulse Train-Finite.vi.  I have included an image to show how the front panel of this example should be configured to work.  The major note to make is that you will need to configure all of the counters in the channel names list.  In Traditional DAQ this did not seem possible.  In Traditional DAQ you would need to create a subvi out of the Finite Pulse Train.vi run three copies of it, in parallel, in a larger program.  Please let me know if you will be able to utilize DAQmx in this application.     
0 Kudos
Message 4 of 8
(5,079 Views)

Thanks again for your quick reply.

I, however, want to use 1) Traditional DAQ, 2) a continuous pulse train generation, 3) two retriggerable pulse generations for two more delayed pulse trains (gated by the first pulse train generated), and 4) one counter for each pulse train.

If you could provide me some help under this restriction, I would really appreciate it.

pchemjjang

0 Kudos
Message 5 of 8
(5,074 Views)

pchemjjang,

There is a Traditional DAQ example in the same location that I have specified in my earlier e-mails called Generate Pulse Train - Start Trig (NI-TIO).vi.  This will output a continuous pulse train from one counter.  In order to output the next pulse trains in the order that you specified in a previous post (i.e. second pulse train begins at first falling edge of first pulse train, third pulse traing begins at first falling edge of second pulse traing) you could utilize the previous counter output as the trigger for the next counter.  For example, lets call the three counters used Counter 0, Counter 1, and Counter 2.  Since this is a continuous counter output operation you should only need one counter for each task.  You will then setup a start trigger on Counter 1 so that it starts on the falling edge of the Counter 0 output.  You will then setup a start trigger for Counter 2 so that it starts on the falling edge of the Counter 1 Output.  In the example there is a VI called Counter Start Trigger (NI-TIO).vi which sets up the start trigger.  This VI will be removed for the Counter 0 task and replaced for the Counter 1 and 2 tasks.  Recall that you will have to essentially have three tasks running in parallel.  I have included a vi which should accomplish the task that you were looking for.  You will obviously need to make changes but this should provide a great framework for you.  The VI will continuously output pulse trains from counters 0, 1, and 2 all triggering as I had stated above. 

0 Kudos
Message 6 of 8
(5,055 Views)

I am trying to open the file you attached but it seems that counter gate (ni-tio).vi is missing.

 

I am using LabView 8.5 and it looks like the counter gate (ni-tio).vi is too old for LabView8.5 to recognize.

 

Could you please help me on this again?

 

Thanks.

0 Kudos
Message 7 of 8
(5,040 Views)

pchemjjang,

 

The counter gate(ni-tio).vi should be located in the following directory on your machine: C:\Program Files\National Instruments\LabVIEW 8.5\examples\daq\counter\ni-tio.llb.  The counter gate (ni-tio).vi is also used in the Generate Pulse Train - Start Trig (NI-TIO).vi example that I had mentioned earlier as well.  Also, I was able to open the program in LabVIEW 8.5 so that should not be a problem. 

0 Kudos
Message 8 of 8
(5,020 Views)