Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow counting(PCI-6601)

Dear friends
 
I wish to count TTL pulses from my device(Avalanche Photo Doide) by using PCI-6601 for a certain time. Thus, I tried to use "Measure Period.vi" with "for loop" configuration.
And the gate frequency from another counter is 100 Hz ( 10 ms time binning). Unfortunately, the acquition time is so slow considering binning time (10 ms).
 
 We tried to modify this vi and found that the acquisition speed cound be fast when we remove "while loop" with "0" counting. As I know, the "while loop" function is to check  whether arming acutally occurs, which is quite questioning why this kind of function exist even though the control code already do it. 
 
 Can you guys help me ? ^_^
 
P.S. Pulse train has a role to generate gate pulse with 100 Hz.
0 Kudos
Message 1 of 14
(5,738 Views)
Confocal,

You would be much better off starting with NI-DAQmx, rather than Traditional NI-DAQ (Legacy), which is what you are currently using. After installing NI-DAQmx, I would start with the Count Digital Events-Buffered-Continuous-Ext Clk.vi example, located in the LabVIEW Example Finder (Help->Find Examples). In this example, you will count pulses on your source. Rising edges on your gate will then buffer the count value, effectively binning the number of pulses at the source. As for the pulse train generation, you can use another counter and the Gen Dig Pulse Train-Continuous.vi example. In this case, you can specify CtrXInternalOutput as the pulse counting gate, where X is the counter on which you are running the pulse train generation example. Please let us know if you have any questions!

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 14
(5,725 Views)
HI,

I am actually trying to do a similar thing with the apd. I am using ni daqmx 8.6.1 and got the two vis Gen Dig Pulse-Train.vi and Count digital events.vi. The only thing is being relatively new to daqmx i cant figure out how to combine the two vis. What i need is to use the counters to count wid a resolution of 50 ns. For the the counter with a sample clock of 20 Mhz would do. But then i need to stop the counter after a certain time has elapsed for which i need to get the counter measurement back. any suggestions would be helpful 🙂

Thanks,
Yatin
0 Kudos
Message 3 of 14
(5,347 Views)
Yatin,
 
I have made an example code to assist you with your problem.  The internal output of counter 1 is used as the source for counter 0's sample clock in order to gate the signal.  Also, this code is just reiterating what Ryan had previously stated.
0 Kudos
Message 4 of 14
(5,317 Views)
Hi,

thanks for the vi. But I still can't understand when does the counter increment to the next value. Is it after each loop or is it incrementing by itself once started.. If the second is the case is it possible to retrieve the counter count operating at 20 Mhz. And also what is it the read task reading back . Sorry, i am a bit new to daqmx so any help would be appreciated.

thanks ,

Yatin
0 Kudos
Message 5 of 14
(5,296 Views)

Hi yatintyagi,

This VI has two tasks, one for edge counting and one for pulse generation. When doing Edge Counting the task counts the rising or falling edge of your input signal using a counter channel. The read VI is reading the value of the counter task. In this case a Buffered Edge Counting is performed, so the actual count will be updated with every edge of the sample clock. I think the image on the Edge Counting of the LabVIEW Help might be really helpful, you can also find it here. The counter output task is generating a signal that is defined by the frequency and duty cycle specified in the “Create Channel – Co Pulse Freq” VI. This pulse train generated is used as the sample clock for the Edge Counting task. I hope this is helpful,

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 6 of 14
(5,272 Views)
Hi,

Thanks a lot, I think that cleared most of the doubts i had. There is just one more thing. What is the input signal to Ctr0 ? And can i change it so that output of another counter is the input to Ctr0? What I have understood is that the pulse generation vi generates the a continuous pulse at Ctr1 which acts as the sample clock for Ctr0.

Thanks,
Yatin
0 Kudos
Message 7 of 14
(5,265 Views)

Hi yatinyagi,

In the VI previously posted, BufferedCounting2, the pulse train generated in Ctr1 is used as the sample clock for the Edge Counting task (in Ctr0). In this application, the input signal to Ctr0 is what you physically connect there. You can connect the Ctr1 out, that will depend on what exactly you are trying to accomplish in your application. I hope this is helpful,
Ana P
National Instruments
Applications Engineer
0 Kudos
Message 8 of 14
(5,245 Views)
Hi,

I basically want to accomplish two things.

One is getting the APD count which would need a counter.

The other is to make a clock of 20 Mhz and be able to count the time at  the software level. So if I apply the output of a counter to the input of another can this be accomplished. What this would do is increment the second counter each time at a rate of 20 Mhz. So, by multiplying the counter data by the time period i.e. 50 ns I can measure the time.

Or can this be done using only on counter?

So, I am correct?

Thanks,
Yatin
0 Kudos
Message 9 of 14
(5,241 Views)

Hi,

I basically want to accomplish two things.

One is getting the APD count which would need a counter.

The other is to make a clock of 20 Mhz and be able to count the time at  the software level. So if I apply the output of a counter to the input of another can this be accomplished. What this would do is increment the second counter each time at a rate of 20 Mhz. So, by multiplying the counter data by the time period i.e. 50 ns I can measure the time.

Or can this be done using only on counter?

So, I am correct?

Thanks,
Yatin
0 Kudos
Message 10 of 14
(5,227 Views)