From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to read 0 count in buffered event counting mode

Hi, I am using the NI6602 board with DAQmx ANSI C. My aplication uses six counters in buffered event counting mode, 0 events is a valid value for me, but when the gate signal arrives the 0 value isn't written to the buffer. Instead the function DAQmxCreateLinScale() returns a timeout error. How can I solve it?

Thanks.
0 Kudos
Message 1 of 4
(3,214 Views)
Sorry, the function that returns with a timeout error is DAQmxReadCounterU32()
0 Kudos
Message 2 of 4
(3,208 Views)
alegrecd,
I'm afraid I don't know the syntax for doing this from C with explicit DAQmx calls. But I think you need to look into turning ON the property called "duplicate count prevention." The name isn't the most descriptive of the actual behavior.

Normally the property is OFF. In such case, the counter expects the Source signal (which increments the internal count register) to be faster than the Gate (or "sampling clock") signal. If no Source edges are seen between successive Gate edges, the count value is NOT put into the data acq buffer.

If you turn the property ON, then the count values WILL be written to the buffer, even if no source edges have occurred between successive Gate edges.

-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 3 of 4
(3,206 Views)
Kevin P.
Thank you for your answer. I found the DAQmx C function that change this property. The function is DAQmxSetCIDupCountPrevent(TaskHandle taskHandle, const char channel[], bool32 data);

Thanks,

alegrecd
0 Kudos
Message 4 of 4
(3,200 Views)