Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I generate a prescaled pulse stream using A/B encoder as input source?

I have an optical encoder that generates an A/B pulse stream and I want to generate a continuous pulse stream to drive other hardware. I want to use one counter on a PCI-6601 board to receive the A and B pulse streams, decode in X4 mode, count down N ticks (prescale the tick stream), generate an output pulse, then reload and repeat continuously.
 
I tried using DAQmxCreateCILinEncoderChan() with X4 decoding, wiring A to AUX and B to SRC (reverse wiring for counting down), wiring OUT to GATE to force a reset on TC, enabling the Z index reset, and setting the Z index reset value and initial value to the prescale tick count. Unfortunately this did not work.
 
Do you have any suggestions?
0 Kudos
Message 1 of 4
(4,036 Views)
I have tested this a little further and have found that the output pulse is generated but each counter decrement is the result of one full cycle of the A/B stream. I would expect, given the counter is set to X4 decoding, that each transition should cause the counter to count down by one, not after 4 transitions. Also, is there a way to have the Z reset occur on any A/B combination, not just one of 4 possible ones?
0 Kudos
Message 2 of 4
(4,034 Views)

I'm not certain you'll be able to get exactly the behavior you're hoping for.

1. You should be able to get the counter to decrement with each transition of A or B, making 4 decrements per full cycle.  In LabVIEW, one of the inputs for creating the position measurement channel is for specifying quad decode mode -- x1, x2, or x4.  There must be a similar call available in the direct DAQmx calls you seem to be using, but I don't know anything about the specific syntax.

2. No, unfortunately there ISN'T a way to perform z-index reload regardless of A,B state.  You have to specify a particular combo.  In your app, you'd also need your z-index reload value to represent an integer multiple of A,B cycles.  (If counting with "Ticks" for units, you'd need the z-index reload value to be a multiple of 4.)

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 4
(4,028 Views)
Thanks for the information. You are correct, it is close but it isn't exactly as I need as it requires my prescale to be a multiple of 4, and if that were the case I would use only one channel (A) of the encoder stream to begin with.
 
Instead I'll feed the encoder into a quadraturizer card and use its X4 output and direction bit to feed a 6601 counter to generate the required pulse train. Unfortunately it means more hardware. Maybe the next software revision will address this limitation.
 
Cheers...
0 Kudos
Message 4 of 4
(4,019 Views)