Explainer
Why a PCI 6014 counter cannot reset from an encoder Z pulse
Short answer
The PCI 6014 counter has no hardware index-reset trigger, so the encoder Z pulse must be read on a digital input and the counting task stopped and restarted in software. The reference error is the count rate times the measured detection-and-restart delay: at 40,000 counts per second and 5 milliseconds, 200 counts. Reference at rest, or move to hardware with a documented index reset when referencing on the fly.

On this page
- Why won't the encoder Z pulse reset the counter on a PCI 6014?
- What does the encoder Z index pulse actually give you?
- Does the counting task measure position or just count edges?
- What is the software workaround for resetting the counter on Z?
- How much position error does the software reset add?
- How do you measure the real detection and restart delay on your own setup?
- How do you avoid double resets and missed Z pulses?
- When should you change hardware instead of working around it?
- Questions asked
The direct answer first: a PCI 6014 cannot reset its counter from the encoder Z pulse, because the counter on this E-Series card has no digital-trigger reset function. The index has to arrive on a digital input, and the counting task is stopped and restarted in software with an explicit initial count. That workaround has a price you can calculate before you build it: the reference error in counts equals the count rate in counts per second times the measured detection-and-restart delay in seconds. This article covers what the Z pulse is for, why the card lacks the function, what the software sequence looks like, how large the error gets at worked numbers, and when to change hardware instead.
Why won't the encoder Z pulse reset the counter on a PCI 6014? #
The counter subsystem has no hardware reset trigger: on this E-Series generation the counter counts edges on its configured source and the index reset that later device families build into the counter is simply not implemented, so a Z pulse wired to any input changes nothing.
The function does not exist in that card generation to be enabled or configured away. The National Instruments E-Series user manual documents a counter that tallies edges on a selected source and takes its initial count under software control; nothing in that counter watches a second input and reloads the count at an external edge. Dedicated counter and timer devices do implement a digital-trigger counter reset, which is why the capability question is about the device family and not about the driver version. The manufacturer's Measure Angular Position example makes this visible: it publishes the list of devices it runs on, and a card absent from that list has no encoder functions for the example to configure. Finding index-related inputs on the example's front panel proves nothing about a given card; the supported-device list is the evidence, and this card is not on it.
What does the encoder Z index pulse actually give you? #
A Z pulse marks one known mechanical position per shaft revolution: it tells you where the shaft was at that instant, and it resets nothing by itself, because the counter uses Z only if hardware or software is built to catch it.
An incremental encoder carries three signals with three different jobs. A and B are the motion signals: their edge count gives displacement and their phase relation gives direction. Z, usually called the index, emits one pulse per revolution at a fixed mechanical angle, so it is a repeatable mark rather than a command. A servo axis makes the same point structurally: the index supports homing only inside the drive's homing routine, which is why an encoder Z index alone cannot home a servo axis without that logic.
Before the Z line goes anywhere, two datasheet facts decide the design: the active level, because index outputs can be high-active or low-active, and the pulse width, which the datasheet of the exact part states. Some encoder families, among them three-channel reflective types, specify that width in electrical degrees of the encoder cycle rather than in time, and the pulse-width check below converts it to time at your speed.
Does the counting task measure position or just count edges? #
A Count Digital Events task counts transitions on one source and has no idea of direction: it is an event tally, not a quadrature decoder, so wiring A and B to the card does not turn it into a position measurement that tracks reverse motion.
The two tasks behind the original question are different instruments. Count Digital Events tallies transitions of the source you configure, in one direction, at the counter's full rate. The angular-position example configures a quadrature measurement, in which the counter evaluates A and B together and produces four counts per line with direction included. The card runs the first; the second belongs to hardware whose counter supports it, which is exactly why the example's supported-device list leaves this card out. If the axis moves one way between references, the edge count together with a known number of counts per revolution is a usable position. If it reverses, the tally cannot follow it, and what each kind of input measures — and what direction costs — is its own decision, covered in the incremental encoder vs counter input: speed and direction comparison.
What is the software workaround for resetting the counter on Z? #
Read the Z line on a digital input, and when it enters its active state, stop the counting task and start the same task again with an explicit initial count: the counter then restarts from your chosen value shortly after the index edge instead of at the edge itself.
Configure the counting task once, with its source and the initial count you want after a reference — zero, if the reference is meant to read zero. Configure one digital input for Z and confirm its terminal and active level from wiring and measurement, not from the signal name. Detect the transition into the active state and raise one reset request per index event. On a request, stop the task and check the returned status, then start the same configured task again and check that status too, then read the first count back before anything downstream treats the position as referenced. Transitions that arrive while the task is stopped are not preserved; they are the cost the next section puts a number on. A published example named Count Digital Events with Option to Reset Counter shows the stop-and-restart pattern end to end.
Keep the reset handling serialized so a second request cannot overlap a restart already in progress, and keep error handling in the control path: a failed stop or start must never leave a stale count presented as a freshly referenced position.
How much position error does the software reset add? #
The reference error equals the count rate times the detection-and-restart delay, and with the example inputs of 40,000 counts per second and a 5 millisecond delay the reference lands 200 counts late, which is 18 degrees of shaft angle on that 4,000-count encoder.
Worked example, calculated for these inputs and not measured on hardware. Take a task that produces 4,000 counts per shaft revolution — for example a 1,000-line encoder counted at four counts per line — referencing while the shaft turns at 600 rpm, which is 10 revolutions per second, with a measured detection-and-restart delay of 5 ms.
- Count rate: 10 rev/s × 4,000 counts/rev = 40,000 counts/s
- Delay: 5 ms = 0.005 s
- Reference error: 40,000 counts/s × 0.005 s = 200 counts
- In angle: 200 counts ÷ 4,000 counts/rev = 0.05 rev, and 0.05 rev × 360 degrees/rev = 18 degrees
Two inputs move the result. Halve the delay and the error halves; drop the shaft to 60 rpm and the same 5 ms leaves 20 counts, or 1.8 degrees, on the reference. Reference with the shaft at rest and the delay contributes zero counts, because no motion occurs during it. Motion during the stopped interval is not delayed but lost entirely — the same lost-count mechanism described in counting encoder pulses on a PLC without losing position — so at constant speed the formula is the best case, not a guaranteed total.
How do you measure the real detection and restart delay on your own setup? #
Time-stamp the moment the digital input first reads active and the moment the restarted counter returns its first valid count, and take the worst case over at least fifty index events, because a single lucky measurement will understate a software latency by a wide margin.
The delay has three parts and all three belong in the measurement: detection, which is how long after the edge the application first reads the line active and is bounded below by the digital read period; the stop call; and the start call plus the first count readback. Stamp a clock when the line is first read active, stamp it again when the restarted task returns its first count, and record the difference on every index event through at least a minute of running at the speed at which references will actually happen. Use the worst case in the error formula, not the average: a reference that occasionally lands late is a reference that occasionally lands wrong. If the measured worst case will not fit the budget at operating speed, that is the finding, and the levers are a slower referencing speed, referencing at rest, or different hardware.
How do you avoid double resets and missed Z pulses? #
Detect one transition into the active Z state and rearm only after the line returns inactive, and check the datasheet index pulse width against your digital-input read period, because a short pulse that rises and falls between two reads is never seen at all.
Reset-on-level logic restarts the task again and again through one long index pulse; reset-on-transition with rearm-after-inactive fires once per pulse. Decide explicitly what happens at application startup when the line is already active: either that counts as a reference event or the next transition is required, and write the choice into the logic instead of letting the first loop iteration decide it.
The pulse-width check, with arithmetic. Encoder datasheets state index width in electrical degrees — three-channel reflective encoder families specify it that way — so convert the width to time at your speed. Illustrative example: a 318-cycle encoder at 600 rpm produces 10 rev/s × 318 cycles/rev = 3,180 electrical cycles per second, so one cycle lasts 1 ÷ 3,180 = 0.31 ms; if that part's datasheet lists the index high for half of the cycle, Z is high for about 0.16 ms, and a digital line polled every 1 ms can miss it completely. Take the width from the datasheet of the exact encoder, keep the read period well inside it, or use a buffered change-detection read instead of polling.
When should you change hardware instead of working around it? #
Change hardware when the axis keeps moving through the index and the measured delay puts more counts into the reference than the application tolerates: a counter whose hardware implements index reset latches the Z edge internally and needs no software in the loop.
Run the budget as a decision. Suppose the application tolerates a reference error of 1 degree. On the 4,000-count encoder that is 4,000 ÷ 360, about 11 counts, so the delay budget is 11 ÷ 40,000 counts/s = 0.275 ms. A stop-and-restart loop measured at 5 ms misses that budget by roughly eighteen times, so for that case the decision is a device whose documentation states encoder-index support in the counter, or referencing at rest.
Per case: referencing at rest, or slow roll with a tolerance wider than the measured error — keep the card, and log or subtract the offset. Referencing on the fly against a tight tolerance — change to a later multifunction family or a dedicated counter and timer device with documented index reset, read from that device's documentation, not from the example library. One-direction motion only — the edge-counting task as configured is enough. Reversing motion with position required — the counting task cannot follow it; handle direction explicitly or move to hardware that decodes quadrature.
The computer that runs the read loop and the restart sequence becomes part of the measurement chain once this workaround is in service, and on a machine floor that machine is specified for the environment rather than borrowed from a desk — typically a fanless industrial mini PC in the cabinet next to the drive.
Questions asked
Can DAQmx reset the counter without a stop and start on this card?
No. The E-Series counter takes its initial count when a task starts and has no trigger input that reloads it while running, so stop and start is the only software path. Index-related inputs that appear in examples or APIs belong to devices whose counters implement the function, and a device missing from an example's supported list cannot be given the function by a setting.
Why does the reference sit at a fixed offset even though the reset logic works?
Because the reset completes after the index edge. The restarted counter begins from its initial count only when the start call finishes, so the counts accumulated during the detection-and-restart delay show up as a constant offset at a given referencing speed. Log the shaft speed with every reference: an offset that scales with speed is timing, and one that stays constant across speeds is wiring or a mechanical mark problem.
What initial count should the restarted task use?
The value you want the counter to read immediately after the reference, which is usually zero. Set it in the task configuration before the start call. Stopping and starting reinitializes counting from the configured initial count, and pulses that arrived while the task was stopped are neither preserved nor replayed, so read the first count after the restart and confirm it before publishing the reference.
Does quadrature decoding change the size of the reference error?
Yes, through the count rate in the error formula. A decoded quadrature task produces four counts per line while counting one channel's edges produces one, so the same delay puts four times as many counts of error into a decoded reference as into an edge count. Always use the rate the running task actually produces, confirmed from a counted motion of a known angle.
Can the application miss a Z pulse completely?
Yes. A polled digital input only shows the state at the moment of the read, so a pulse that enters and leaves the active state between two reads is lost, and short index pulses on a slow loop are the usual cause of a reference that never arrives. Compare the pulse width from the encoder datasheet with the read period, or switch to a buffered change detection.


