Data Acquisition Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Kevin_Price

Hardware-Triggered Count Reset

Status: Implemented

Implemented in DAQmx 9.2.0 for X Series devices and 2nd generation cDAQ chassis (NOT the 9172).

To save a bunch of typing, the following is copied verbatim from a post I made years ago: 

While the thread is fresh and FWIW, I'd like to add my own additions to a counter/timer wishlist:

1.  Hardware-reload of count register based on signal edge.  Currently, the only feature that's fairly close is the "Z-index reload" feature for encoder position measurement.  There are many limitations and at least one quirk as presently implemented.

 

A. It only works in "position measurement" (a.k.a. "encoder") mode.   At minimum, it should also be supported in edge-counting mode provided the other limitations/quirks are addressed.  I've done a lot of measurements with an encoder mounted to a step-and-dir stepper motor.  The step-and-dir motor must be measured as an edge-counting task with hw-controlled direction.  The encoder's z-index pulse CAN'T be used to hw-reload the count of the edge-counting task in sync with the encoder task.  It'd be GREAT if it could.  Hw-reload of count could also be useful in other counter tasks, especially pulse(train) generation.  I can imagine some clever tricks in the other modes (such as period measurement) as well.

 

B. It must be programmed to be "active" only during a specific 1 of the 4 possible states of encoder channels A & B -- LL, LH, HL, HH.  This works out fine for real-life encoders that supply their own z-index signal.   However, I've had numerous occasions where I would have logically preferred to reset the count value based on some other system pulse signal (can you say "Limit switch"?).   I'd have liked to say, "perform hw-reload on rising edge of Z-index signal regardless of A&B state".  But no such designation exists.  I'd rather have the choices {Low, High, Either} for both A & B config.

 

C. The Z-index signal must be hard-wired to the counter's default GATE pin on the 6602 board.  I *think* but haven't verified that it's user-selectable on the M-series.  Dunno if it supports just PFI inputs or also RTSI signals.  I would like to see a next-generation Counter/Timer allow user-programmable inputs for Z-index as well as encoder A & B channels.

 

D. At least on the 6602, the Z-index behavior is STATE-driven rather than EDGE-driven.  Z-index reload happens whenever A&B are in the programmed state and Z is High.  I tested by hard-wiring the Z-index signal to +5V and my X4 quadrature task counted 0,1,2,3,0,1,2,3,0,1...   I don't recall this being spelled out clearly in the documentation -- I remember expecting it to be sensitive to a rising edge rather than a high state.  I would very much like the option of making the hw-reload sensitive to an EDGE -- ideally {Rising, Falling, Either}.

Note: wishlist item "1C" has been fulfilled in M-series counters and probably also in X-series which I haven't yet tried.

 

-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).



3 Comments
ZachHindes
Member

Very interesting; I like the idea a lot.  I was thinking, and you can get something close to this by doing an Implicit Period or Frequency measurement.  At that point, the behavior is almost what you describe.  The Gate pin causes the counter to latch the current value into the FIFO and reload from 0.  You can query the value by reading the Channel Property Counter Input:General:More:Count while the task is running.  This has the benefit of also preserving the count before reload in the FIFO which can be read with a DAQmx Read.  However, it doesn't have the Edge Counting benefits of a preset initial count or Up/Down counting or anything.  It does have me thinking, though, so I'll let it stew a bit.

 

 And yes, X Series has separate signals for A, B, and Z.

------
Zach Hindes
NI R&D
John_P1
Trusted Enthusiast
Status changed to: In Development
We are working on adding this feature to the driver for X Series devices--X Series hardware already supports this so it's just a matter of implementing it in the driver. The proposed addition should affect Edge Count tasks and would allow you to set the counter to a user-defined value on the rising/falling edge of a PFI line.
Message Edited by John P on 04-07-2010 01:38 PM
John Passiak
John_P1
Trusted Enthusiast
Status changed to: Implemented

Implemented in DAQmx 9.2.0 for X Series devices and 2nd generation cDAQ chassis (NOT the 9172).

John Passiak