Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting pulses using PCI 6602

Hi Siana,

 

Thank you for the reply.I am getting error 89136 now instead of 50103. But when I keep the timebase on 20MHz I don't get the same error I get another error called overflow error.I have attached the snippets of both the errors.Please check the attachment.

 

I read about the error in the knowledge base from here http://digital.ni.com/public.nsf/allkb/B3A73388A3968E0F86257156007F7E3E

It suggested to check the routes using NI max, which I did.I saw that the 80 MHZ internal timebase does not have any direct route to gate of any of the 7 counters on the PCI 6602 board.While all sources do.

 

What I want o implent is, Count photons when the signal at the gate port of 6602 is the 80MHz internal timebase and the source signal is the output of the APD (whose photon count I want to measure).If none of the counters get 80MHz at the gate port the how am I suppose to start the counting?Is there anyways to reroute the timebase signal or connect the pins which have the signal to the gate port of the?Please help!

 

Thank you,

 

snh

Download All
0 Kudos
Message 11 of 28
(6,257 Views)

Hello snh22,

 

It seems like the input to the CtrTimebaseSrc property should instead be used for the Period.Term input and vice-versa. You are setting your PFI line as the timebase, and setting the 80 MHz timebase as the input terminal for the counter.  Usually period measurements are made by taking the number of timebase clock ticks per high and low time on the input terminal signal. Could you explain why you have it set up the way you do? 

0 Kudos
Message 12 of 28
(6,236 Views)

 

Ok, I'd like to take a nice deep breath and step back for a moment to a couple conceptual things that should pay off in the long run.

 

1. You're setting up a Period measurement where the APD pulses act as the timebase (the counter's 'Source' signal) and you want to sample at a fixed rate with another clock.

  Every APD pulse will increment the internal count register and every active clock edge will (1) store the instantaneous count value in your task buffer and (2) reset the count register to 0.

 

2. The net effect is to perform a "binning" measurement where you can read the "periods" in U32 format to find out how many APD pulses happened within each interval of the sample clock.

 

3. The 6602 has a very tiny onboard FIFO for counter measurements and is thus pretty limited for sustained or high-speed buffered tasks.  It's unlikely you'll find success with either the 80 MHz or the 20 MHz onboard clock.  It's much more possible (but less than guaranteed) that you can pull this off with the 100 kHz onboard clock.

  However, that still would still give you 10 microsecond resolution for you binning measurement.  You'd have an accurate count of exactly how many APD pulses occur within every 10 microsec time bin.  My guess is that the photo emission behavior might be variable enough that much shorter time bins would have dubious value anyway. 

 

 

Let me suggest that you use a second counter task to generate the clock signal you'll use for this binning measurement.  Just use an example program for generating a continuous pulse train.  Try it on ctr7 at 10 kHz.

 

Then change your measurement program and select 'Ctr7InternalOutput' as the signal that acts as 'CI.Period.Term'.  Note: you may need to right click on the constant, pick "I/O Name Filtering...", then enable the box for "Include Advanced Terminals".

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 13 of 28
(6,163 Views)

Hi All,

 

   Let me add myself to this conversation, I am trying to do the same task, I use 20MHz Timebase as input counter and I use PFI39 connected to 1MHz spring terminal on BNC2121 to reset counting every 1 micro second. Couplicate counte preventation is active so I should see something (zero or some small number due to dark count) in the output but I see nothing. Any help is highly appreciated. I attached my vi file and a snippet.

  Would you please let me know more about input terminal, it is not clear for me what it is doing.

 

Best,

Milad

Capture.PNG

0 Kudos
Message 14 of 28
(6,155 Views)

I think I could solve my problem in another way.

Would you please look at the snippet and let me know what you think. PFI38 (gate of counter0) is connected to 1MHz signal and PFI39 in source of counter 0, it supposed to count number of pulse every 1 micro sec (because of 1MHz pulse). It kinda make sense, because when I expose my PMT with light it goes up and when I turn of the light it decrease but I prefer to know your opinion. I really appreciate your help.

 

Best,

Milad

 

cntr-tst.PNG

0 Kudos
Message 15 of 28
(6,148 Views)

I'm sorry for asking a lot of question, only 1 more, how I can fix the rate of keeping data?

I fixed the gate frequency to 10Hz but to see a reset in counting I have to get lots of data,  for example in attached figure you can see that each reset happened after almost 230000 data point. (X axis is index of data points)

Actually I want to measure number of pulse over a time window, lets say 5 micro seconds and record data each 5 micro second, because If I don't do that, number of data points becomes huge and it is a problem for my application.

I think counting in a period for a given number of period is what I need but I couldn't understand why my vi file doesn't work.

 

Regards,

Milad

untitled.jpg

0 Kudos
Message 16 of 28
(6,142 Views)

Hello Kevin,

 

I did what you suggested now I have a another counter which has a frequency of 250KHz with duty cycle of 80% and so the signal is on for 3.2microseconds and this counter is connected to CI. Perid Terminal.Currently the APD pulses are counted for the 3.2 microsecond period and the program works properly for frequency less than 20Mhz.But now the new issue is when the APD signal goes above 20 Mhz the program doesn't show proper counts. For my application the APD input signal is going to be around 40Mhz.According to the specifications, PCI 6602 can count any input signal for upto 80Mhz.So why is this happening then?How can it be rectififed?

 

Thank you.I appreciate your help 🙂

 

snh22

Download All
0 Kudos
Message 17 of 28
(6,077 Views)

@snh22 wrote:

 

...But now the new issue is when the APD signal goes above 20 Mhz the program doesn't show proper counts.


 

I didn't read the whole history here so maybe it's already been mentioned, but using duplicate count prevention limits you to a 20 MHz source (1/4 the 80 MHz timebase) as per the 660X user manual.  Try a CI Edge Count task using a sample clock and no duplicate count prevention.

 

 

Best Regards,

John Passiak
0 Kudos
Message 18 of 28
(6,053 Views)

Couple quick things.  First, follow John's advice and switch over to edge counting without duplicate count prevention so you can get measurements on >20MHz APD pulses.  You'll now use your 250 kHz counter as a (non-implicit) sample clock and your APD pulses as your input terminal.  The hardware will then give you a cumulative total # of pulses, sampled at a constant 250 kHz.  A software finite difference will get you back to your binning measurement.

 

Be aware that you're using a 32-bit counter that will eventually rollover back to 0.  It'll take less than 2 minutes at a constant APD rate of 40 MHz for example.  (Calculation: seconds = 2^32 counts / 40e6 counts/sec).

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 19 of 28
(6,033 Views)

Thank you for prompt replies John and Kevin.I will implement your suggestion and let you know if it works

 

Kevin-I am sorry but I don't understand what a  software finite difference is and how to implement it to get my binning values?Could you please help me out?

Thank you very much.

 

-snh22

 

 

0 Kudos
Message 20 of 28
(6,030 Views)