Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse-width measurement stops on PCI-6602 when input is interrupted

Hi,

Using an NI PCI-6602 card, we try to measure the pulse widths of a digital signal.
We use all 8 counters of the card in parallel, connected to a digital output port
of the same card.
An external application controls the output port and generates a 200 Hz signal with
pulse widths about 2ms/3ms for high/low, resp..
The counters are controlled by a small test program showing the presence of
"interrupts" from the NI hardware. Each counter triggers an interrupt when
another 100 samples have been received. Periodically the numbers of interrupts
are displayed as well as the state of the counters ("-" indicating that a counter
doesn't advance currently).

Here we found these issues:

Normally, the counters run correctly, i.e. we see interrupts from each of the
counters. But if the connection between the output port and the counters' inputs is
disconnected momentarily (using an on-off switch), some or all of the counters
will stop sending interrupts anymore. Mostly the 5 counters which must operate in
interrupt mode are broken first, but if more/longer dis-/reconnections are done,
all counters will fail eventually. (I.e. the 3 counters operating in DMA mode
are also susceptible to this failure.)

If a counter stopped sending interrupts, its DAQmxStopTask call at the end
of the program returned error code (-200141) == DAQmxErrorCounterOverflow.

Occasionally one or more of the counters (Ctr 0) show about twice as many interrupts
as the others.

Attached you will find our test program, the configuration set up with MAX, and

sample output.
We used NI-DAQmx 8.5.0f3 and MAX 4.2.0.3001.

Best regards
Manfred

 

0 Kudos
Message 1 of 4
(4,318 Views)

Hi Manfred

 

We try to reproduce your problem with a simple counting acquisition with LabVIEW, so from time to time we got the same error like you did.

So there are some proposals to handle this case:

 

1. Please switch the counter inputs to ground level when you switch it off, so the inputs have a defined zero level

 

2. Place a timeout for your acquisition that is enough, it should be longer than the period you switch the input signal off

 

3. Can you measure the behavior of your switch with an oscilloscope, perhaps the switch is chattering and so you will get some peaks or something like this which disturb the acquisition

 

We got your error when we hard switch the signal source off from the inputs. But we coudn´t reproduce it continuous, so it is really difficult to find an explanation.

Hope this will help you.

 

Kind regards

0 Kudos
Message 2 of 4
(4,311 Views)
Hi Pixar

thank you for the interesting reply. I have some queries concerning your proposals:

1. In order to switch the inputs to ground level, are you thinking of some external wiring, e.g. a resistor (value?) between inputs and ground?

2. I'm not sure whether I set up the timeout thing correctly. I use DAQmxReadCounterF64(..., DAQmx_Val_WaitInfinitely,...) in my program. Do I need still another setting?

3. Probably our switch *is* chattering, but then I'd expect a number of wrong sample values when switching. Is there a known reason why the acquisition is terminated instead?

Best regards
Manfred

0 Kudos
Message 3 of 4
(4,289 Views)

Ok I try to give you some further informations.

 

for point

 

1. You can use a switch with three pins, something like a toggle switch or a double throw switch. So you can route your signal to the data acquisition device and when you switch it off, you route the ground to the data acquisition device.

 

2. With your programming in C (I suggest) I can´t give you some help because we only support the NI software like LabVIEW etc.

 

3. For dechattering your switch look in the internet, there are tons of informations about it. Here a good explanation but it is in german. I am sure you will findalso many informations in english.

 

http://www.mikrocontroller.net/articles/Entprellung

 

So I hope you will find a solution and let me know about it.

 

Kind regards

 

 

0 Kudos
Message 4 of 4
(4,276 Views)