Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I control the sampling rate of a PCI-6602 counter

Labview version: 7.1

Processor: Pentium 4 1.8 GHz

 

Hello All,

 

I have two avalanche photo diodes connected to two counter entrances on a 6602 (ctr 0 and ctr 1).

 

As can be seen in the attached VI, I'm generating a signal on ctr2 and using that as an external clock for the counters.

 

My objective is to accurately read the counter values at a rate of ~100KHz (i.e. 0.01 ms between measurements) and to be able to control the rate via the front panel. This should be possible (80MHz timebase), however when I run the program it is only able to actually sample at ~5 ms intervals. Also I'm encountering error 200141 even though I set the rate in the counter to 1M, which should buffer enough.

 

What am I doing wrong? Any help would be greatly appreciated.

 

Thanks a lot,

 

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

Hello Aadam,

 

After looking at your code, I would not use the DAQ assistants to implement this. The DAQ assistant are best to be used for simple acquistion and since you are looking to use more lower level properties of you card, I would suggest to move to use the lower level VIs. It will be easier to understand where the problem is occurring at and will run better than using the DAQ assistant.

 

I have done some initial research for you to implement this design. I have described each of them below and how they will assist you.

 

The first example I have found is the Change Counter Output Frequency While the Task is Running. In this example, it will show you how to change the frequency and duty cycle of a counter output frequency task. One thing to remember about these counters are that the frequency will not change until the period has finished. For example, if you changed the frequency in the middle of a period of frequency of 1 Hz, it has to complete the 1Hz period before changing it to the next frequency.

 

The next example I would investgate is in the NI Example Finder called Correlated Dig Write With Counter.vi. The NI Example Finder can be found in Help » Find Examples... This VI will explain how to use the counter as a clock for another task. You will need to combine the concepts of the first example with this to make sure that you can vary the sample clock.

 

Finally, in the NI Example Finder, there is an example how to count digital events with an external clock called Count Digital Events-Buffered-Continuous-Ext Clk.vi. With this example, I first suggest to add the counter task and make sure you can get the external clock to work. After this, I would then implement changing clock.


Jim St
National Instruments
RF Product Support Engineer
0 Kudos
Message 2 of 2
(6,341 Views)