DPRG
DPRG List  



[DPRG] More quad encoder stuff

Subject: [DPRG] More quad encoder stuff
From: Mike McCarty jmccarty at ssd.usa.alcatel.com
Date: Fri Aug 31 16:18:45 CDT 2001

On Thu, 30 Aug 2001, Dan Miner wrote:

> Great ideas - I especially like the enc-90 idea as you
> CAN mount the sensors 180 degrees apart (but with a different
> radius from the center) and it works with any # of divisions.
> 
> However, in a moment of nit-picking, your 6bitgray.gif is 
> not really gray code - it's binary code.  The definition of 
> gray code is that only 1 bit changes at a time.  Yours changes 
> many bits at once - especially at the 12, 3, 6, and 9 o'clock 
> positions.  5 bit gray code (left to right) would be:
> 
> LSB: 01100110011001100110011001100110 
>      00111100001111000011110000111100 
>      00001111111100000000111111110000 
>      00000000111111111111111100000000 
> MSB: 00000000000000001111111111111111 
> 
> Note that when going from any column to the next one, only 1
> bit changes - including when you wrap around from last to first.
> 
> Also note that if you look at only the first two lines, you'll
> see the "classic" quadrature encoder waveforms - which are 
> really just 2-bit gray code.

Nice post. Note that there are many Gray codes. The particular one you
show (unless I made a mistake) is sometimes called "Reflected Gray", as
it can be iteratively made by reflecting the bit patterns.

For example, we start with a one bit code

0 1

To make a two bit code, we take the one bit code, and add a bit. When we
reach the end, we invert the added bit, and then reflect the original
code. Like this:

   |
0 1|1 0
0 0|1 1
   |

The first bit pattern is in two parts: 0 1 : 1 0. The second part is the
reflection of the first.

Now to make a three bit code, we do the same thing again, but we reflect
the entire two bit pattern.

       |
0 1 1 0|0 1 1 0 
0 0 1 1|1 1 0 0
0 0 0 0|1 1 1 1
       |

A four bit code then is

               |
0 1 1 0 0 1 1 0|0 1 1 0 0 1 1 0
0 0 1 1 1 1 0 0|0 0 1 1 1 1 0 0
0 0 0 0 1 1 1 1|1 1 1 1 0 0 0 0
0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 1
               |
And so on.

Mike
-- 
char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
I can explain it for you, but I can't understand it for you.
I don't speak for Alcatel      <- They make me say that.


More information about the DPRG mailing list