LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing problem with counting edges

Hello!

I use a NI PCI-6221 DAQ card with NI-DAQmx to count edges of TTL pulses for a spectrometric application.
It is extremely important that I count the pulses for a well-defined period of time. Typically, I want to count the edges that reach the counter in the period of 400 milliseconds.

Normally, this works quite well, when I use a WHILE loop that reads and restarts the counter every 400 milliseconds. Things change when the PC I run the VI on has other programs running in the background. Expecially computing-time intensive programs delay the 400 milliseconds of the WHILE loop for up to several 100 percent, resulting in an wrong counter read.
I tried to use a timed WHILE loop but this din't change anything, regardless of the timimg source (onboard clock or PCI-6221 counter) I applied.

Has anyone encountered similar problems and found a solution? Isn't there a possibility to control the counting time by hardware?

Thanks in advance!
Eresthor

Message Edited by Eresthor on 04-07-2005 08:17 AM

0 Kudos
Message 1 of 3
(2,685 Views)
Eresthor,

You have discovered the problem with using software timing for any precision timing: It will not work consistently.

The catalog says the 6221 has two counter-timers. Set one of them to produce a 400 ms gate pulse. Use the second to count the number of input pulses/edges during the gate period. Read the data anytime after the gate pulse ends.

Lynn
0 Kudos
Message 2 of 3
(2,672 Views)
Hej Lynn,

of course your idea works, thank you. It works extremely well this way, too.

My problem with this approach is that I need both counters on the PCI-6221 to count data from my spectrometer simultaneously on two channels. That's why I would like to trigger the counter in a different way, for example with a clock.
Is there no way to trigger the counter with the timebase of a hardware clock on the card? Or ist there another possibility without wasting a counter?

Eresthor
0 Kudos
Message 3 of 3
(2,665 Views)