Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a pulse train using a count from a quadrature encoder as the clock

I am trying to generate a pulse train with the same frequency as my quadrature encoder.  Every time the encoder counts, I want the pulse to go high until the next count and then go low and so on.  I am using a 6602 PCI card and a BNC 2121 accessory.
0 Kudos
Message 1 of 6
(6,042 Views)
Gene Z.

Thanks for posting to the NI Forums.  Does your encoder include a A, B, and Z index?  If so does your quadrature encoder move in both directions?  Are you always counting up or are you counting in both directions?  If so, would you like the output to reflect this change in direction in some way?  Is the encoder an X1, X2, or X4?  If the encoder is an X1 and you are only counting up then the A index reflects the frequency of the encoder.  However, if I understand your post it sounds like you would like a signal at half the rate of the encoder.  If the signal were to toggle on each count of the encoder than the overall period of the output would be 1/2 the frequency of the counts.  If you provide some additional details I will be happy to see if there is a way to accomplish what you desire.  Also let me know if you have further questions about this application.

Regards,

Neil S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(6,031 Views)

Thank you for your interest in helping me.  Let me explain what it is I am trying to do.  I have a differential encoder that has and A, B and Z (index) with 9000 line counts.  I need to run it in quadrature mode, which will give me a 36000 count per revolution.  I am using this encoder (a reference encoder if you will) to measure the accuracy of a manufactured magnetic encoder (manufactured encoder) with 88 poles for example.  Traditionally, I would do this by making manufactured encoder (88 pole) the gate and the reference encoder (36000 count) the source and do period measuraments of the 88 pole manufactured encoder.  To do this I have to convert the reference ecoder to a quadrature TTL pulse train.  This has to be done outside of LAB VIEW environment.  I am trying to bring this function in to LAB VIEW.  When I use LAB VIEW quadrature vi, I no longer get a TTL pulse train, get a count.

So, the way I see it there are two ways to acomplish what I need to do.  One, when the manufactured encoder switches from high to low, I can record the count (or position) of the reference encoder.  I'm not sure how accurate this will be.  Two, I can convert the count (position) of the encoder to a pulse train and use the gate source method to do period measurament.

To answer your other questions, I do not care about direction, idealy I would go through a period every encoder count, I need to run the ecoder in X4 mode.

Thank you,

I've been working on this for some time with no luck.

0 Kudos
Message 3 of 6
(6,024 Views)

Over the years there have been a lot of threads looking for a way to capture data on every quadrature state change, and it's only recently become convenient as of DAQmx 8.0  

Also, there was recently a long thread here about a similar app.  The consensus was that the best platform would be an M-series board that's configured to capture on digital state changes.  This allows the hardware boards to capture true position from the reference encoder on each transition of the test device.  It's sort of like time-stamping the state transitions but is actually position-stamping them.  Here's a link.

An alternative using only the 6602 might be to create an external quadrature decode circuit that can be used as a sampling clock.  Look for chips with #'s like LS-7083 / LS-7084 I think, or their replacement if they've gone obsolete.  The difficulty with using only the 6602 is that you don't get to perform hardware-timed capture of the test devices bits.

-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 4 of 6
(6,020 Views)

The thread you referenced was not much help.  It sounds like I'm further along in doing what he is trying to do.  I am using an external quadrature decode circit now (LS7184) with a differential receiver.  I am having noise issues and using NI devices seems to take care of that.  That is why I am still pursuing this fix.  Plus, it is a much cleaner set up and allows me do achive a much higher frequency (I need 3.6 MHz) and the quad chips are not able to handle that kind of frequency. 

It sounds like there is no way to prduce a pulse train with the encoder count as the timebase.  Is this correct?

I have a M-series card (PCI 6022).  Is it capable of doing what I need to do?  I am not clear on what my aproach should be.  Can you explain in general terms what I'm trying to accomplish with the M-series device.  I've been using traditional DAQ and am not too familiar with DAQmx.

0 Kudos
Message 5 of 6
(6,017 Views)
Maybe I'm not understanding your app, but I *think* you and I are approaching it from two very different directions.

As I understand it, you'd like to emit a pulse with each quad state change.  Then that pulse would act as a counter Source signal.  The counter will then increment on each pulse, to keep track of accumulated position.  Further, you'd use your device-under-test (DUT) as a counter Gate signal, which would buffer the position count each time there's a rising edge on your DUT.  The end result is a buffer of position values, captured at each rising edge of your DUT.

I'm talking about a different approach to produce the same data.  You'd use 2 tasks on a M-series board.  One of them is a hardware-timed digital input task based on "change detection."  Each time one of the specified bits has a transition, your whole set of digital input bits can be captured and an internal "change detect pulse" is generated on the board.  This task should be sensitive to the DUT edges.

The other task would be a buffered position measurement.  It would receive the reference encoder inputs and internally do quad decode and keep a running count.  The sampling clock for this task would be specified as the other task's "change detect pulse."

Net result: on each specified edge of your DUT, you'll buffer a reference encoder position value and a digital state of your DUT.  You can choose to be sensitive to rising edges, falling edges, or (!!!!) both at once. You can also choose to be sensitive to many bits simultaneously.  These are better capabilities than you get with the 6602 alone.

I *think* the 6220 should be ok, based on a quick overview of specs.  I assume your 3.6 MHz is the rate of ref encoder quad state changes, right?  In the approach I'm suggesting, you only need concern yourself with the rate of DUT edges which appear to be in the 10's of kHz or less.

Gotta go for now.  Post back if any further questions.

-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.
Message 6 of 6
(6,006 Views)