Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

pci6602

Hi
I`m using a PCI-6602 board . Each counter of the board should measure a single pulse-width.
The incoming pulses, may be long, up to 3 hours. Is it possible to achieve a counter's reading (counting result), while it still counts?
If yes, please tell me how.
 
I'm using C++ Visual Studio.
 
The pulse is entered to the counter, through the gate.
 
 
Thankfully
 
Zifman Menahem
 
0 Kudos
Message 1 of 2
(3,422 Views)
Hi Zifman -

The short answer is no, but there are a couple of workarounds you can employ:

The terminal count of your counter chips is 2^32.  This, combined with the rate of your timebase clock, determines how long a pulse you can measure without rollover:  2^32 / (Clock speed) = (Max pulse width).  If we reverse that equation, we can find the maximum clock speed allowed to measure a 3-hour pulse: 2^32 / 10800sec = 397.682 kHz.  Any timebase under this speed will be able to measure a 3-hour pulse without the counter rolling over.

If you know the required resolution of your measurement, you can figure out how slow a clock you can stand to generate.  There is a 100 kHz timebase available on the board.  If that's too slow for your measurement, you can use a second counter to generate your own clock using the 80 MHz timebase (using a Continuous Pulse Train Generation task), then wire that output to the source pin of the pulse width counter.


Another option also requires two counters, but allows the maximum possible resolution.  When a counter rolls over, it generates a pulse called the Counter Output Event.  You can route this event to a pin and use it as a signal, in this case a trigger.

So set up a Pulse Width Measurement with the 80 MHz timebase, then route the Counter Output Event to a PFI pin.  Set up a second counter to Count Edges, and have it watch that PFI pin.  Every time the first counter rolls over, you'll get an edge on the second counter.  When the first counter returns its final time value, you can read the second counter's count and add that number of ticks to the first counter's value.  For example:

At the end of the pulse, the Pulse Width measurement (using the 80 MHz timebase) returns 5.603 seconds.  The Count Edges measurement returns a value of 5.  This value represents five rollovers, so we find out how many timebase ticks that represents: 5 * 2^32 / 80M = 268.435456 seconds.  Adding the two measurements yields 274.038456 seconds, the width of the full pulse.

David Staab, CLA
Staff Systems Engineer
National Instruments
Message 2 of 2
(3,412 Views)