12-05-2016 04:15 PM - edited 12-05-2016 04:18 PM
@CoastalMaineBird wrote:
None of the properties you mentioned are available.
I don't understand why you say that.
Here are two of them:
As I said, the RESET COUNT may not work because it's in COUNT EDGES mode.
But I would try setting COUNT = 0, using the second pic above.
Steve, theCI.Count property is read only.
edit: ... and the count reset don't seems to be settable while the task is running.
Ben64
12-05-2016 04:31 PM - edited 12-05-2016 04:35 PM
Just to build a bit on Steve's post, not all items fully relevant to the current thread:
1. The count register is natively an unsigned 32-bit int (U32). Handling +/- sign is normally as simple as passing the U32 through a "To Long Integer" node to come out as an I32. Internally, when you decrementing the count from 0, the count goes to FFFF FFFF. When you pass that value through "To Long Integer", the bits are reinterpreted as a -1 value, just as one would often want.
The overflow Steve refers to from 7FFF FFFF to 8000 0000 relates to the post-conversion I32 interpretation of the bits. The reported I32 value is changing from +(2^31)-1 to -(2^31). You can easily detect it by looking for a sign reversal across a small motion change.
2. There's a deep down advanced DAQmx property node you can query (see below) for when the internal count is about to overflow or underflow. It's referred to as "terminal count", and will return True the first time you query after a count rollover (it resets itself back to False until the next rollover event.) This happens at the transition from FFFF FFFF to 0000 0000 though. In the realm of a post-converted I32 value, this is merely a change between -1 and 0, and probably isn't the thing you want to watch for.
The property node is a nice thing for applications that count continuously in one direction. With a bi-directional encoder, you'd continue to do as Steve described.
3. Also for unidirectional counting: you can choose to export a DAQmx signal that pulses once whenever terminal count is reached. I've used this feature to cascade two counter tasks into a hardware-accurate 64-bit counter suitable for hardware-timed sampling.
-Kevin P