What kind of encoder is it? The number of lines in an encoder determines the resolution. That is, if it has 256 lines, one revolution produces 256 counts, and the resolution is 256/360 degrees, or 1/256 of a revolution.
__________________
We have met the enemy and he is us . . . Walt Kelly
it is an incremental encoder.the question was what is the minimum number of bits required in the counter( signal condioner) to measure one revolution of the motors shaft.
Do you need to know how to determine the direction the encoder is moving? Depending on your application, you may need to increment or decrement the counter in accordance with the direction the shaft is rotating.
8=23 , and 3 would be the minimum bits to count clock or counterwise with any certainty of absolute position. 1 bit increments, 1 bit decrements, 1 bit is the home position.
yes, no, maybe?
__________________
Do or do not, there is not try, but there is failure...
Which means you need to divide the encoder into 200 segments
If you had a 7 bit encoder you can count up to 128 or 27 which is too small so you need to use at least 8 bits which can count up to 28 or 256.
The answer is therefore 8 bits but if you wish to measure in exactly 1.8° steps you will not be counting all the way to 256 but rather stopping when you get to 200 which in binary is 1100 1000 rather than going all the way to 256 which is 1111 1111.
__________________
An elephant is a mouse built to government specifications.
One very simple way of doing this in hardware is to use a D-type flip-flop. Connect Channel A to the D input, and Channel B to the clock input. When the shaft is turned clockwise, Channel A lags Channel B, and when turned counter (or anti) clockwise, Channel A leads Channel B.
Assuming the shaft is turning clockwise, the first rising edge of B will latch the value of A, a logic '1.' The flip-flop's Q output will stay at logic 1 for as long as the shaft is rotated clockwise or is not reversed.
If the shaft rotates counterclockwise (read the timing diagram, below, backward), the first rising edge of B will again latch the value of A, this time a logic '0.' The flip-flop's Q output will stay at logic 0 for as long as the shaft is rotated counterclockwise or is not reversed.
The latched value of D in either case appears on the flip-flop's Q output. Either Q or Q-not can serve as the direction indicator, depending on the needs of your application, and can be used to toggle the direction of the count (up/down counters typically sport an up/down pin).
You can use either Channel A or Channel B as the counter's clock input, with the direction signal from your flip-flop determining the count direction.
You can also use a dedicated encoder interface chip, or you can program one of the PIC microcontrollers to do this sort of thing for you.
Your details make acceptance of my laziness easier to bear. I was hoping that someone would post details.
Another thing to consider is that quadrature encoders will yield 4 times the basic line count. That is, a 256 line encoder will give 4 X 256 or 1024 pulses per revolution, so the resolution is 1 part in 1024 +/- 1.
Also, I seem to recall that stepper motor incremental steps which became popular in the 70's was 1.8 degrees, and engineers wanted to put encoders on them for closing the loop, one reason being that stepper motors would not always take steps when commanded to do so. (It has to do with resonances, rates of change of step commands to get through resonant speeds, etc. -- very irritating stuff.)
Anyway, when putting an encremental encoder on a stepper motor, people found that even the encoder feedback didn't work always. After digging into the problem, it was found that when rotor inertia, load inertia, etc. was analyzed, a single step, for example, would cause the motor and load to "ring," which means that it had a natural frequency of oscillation caused by static electromagnetic fields and the salient magnetic poles of the rotor seeking to find a home, and the encoder electronics couldn't keep up with the counts up and down, either because the motor/load didn't oscillate far enough in one direction to cause a corresponding up/down count in the opposite direction (because the "ringing" was a damped function) resulting in a count that was off by 1.
A way around this was to reduce the number of lines on the encoder to 50 for a 200 steps per revolution stepper motor, as well as to add a little friction to the system to reduce the oscillations to a minimum. Kinda tricky sometimes.
Hope this addition helps.
__________________
We have met the enemy and he is us . . . Walt Kelly
Yeah, phase jitter or "dither" can be problem; not just with steppers but with any system that exhibits a resonance or vibration. There are ways around this. Some "smart" encoders, for instance, can dynamically adjust their 'hysteresis' on-the-fly with systems that have problems with dither. At added cost, of course. Photocraft is one such manufacturer of 'smart' encoders.
I was hoping to chime in as the "Encoder guy" on this forum, but you all gave such good answers. There is a lot of knowledge and talent on here.
Without really knowing the application I would like to mention that it is typically ~easier~ and less expensive to use an incremental encoder if possible. The key is whether or not you need to know where you are at on power up.
An aboslute encoder gives you this ability, but with the cost of added wiring.
There are of course lots of protocols to transmit the data fro the encoder so "added wiring" may be an arguable point.