The rotary encoder at a joint of a robot arm delivers the position of the joint in the Gray code, while the controller calculates in the binary code. The code disc has 16 sectors and four tracks. A code converter turns the Gray code word with the bits A, B, C and D into the binary code word with the bits Y3, Y2, Y1 and Y0, Y3 with the weight 8. This is the code table:
Sector
A
B
C
D
Y3
Y2
Y1
Y0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
2
0
0
1
1
0
0
1
0
3
0
0
1
0
0
0
1
1
4
0
1
1
0
0
1
0
0
5
0
1
1
1
0
1
0
1
6
0
1
0
1
0
1
1
0
7
0
1
0
0
0
1
1
1
8
1
1
0
0
1
0
0
0
9
1
1
0
1
1
0
0
1
10
1
1
1
1
1
0
1
0
11
1
1
1
0
1
0
1
1
12
1
0
1
0
1
1
0
0
13
1
0
1
1
1
1
0
1
14
1
0
0
1
1
1
1
0
15
1
0
0
0
1
1
1
1
a) Minimize Y3 with a Karnaugh map.
b) Minimize Y2 with a Karnaugh map.
c) Minimize Y1 with a Karnaugh map.
d) Draw the Karnaugh map of Y0. You do not need to write down its expression. What happens to the loops from a) to d)?
e) Express the four outputs with XOR gates with two inputs, as a chain from the highest bit down. How many XOR gates does the code converter need?
f) Check your chain for sector 11.
A colleague has built this code converter with a fault and reports: Y3 and Y2 agree with the code table in all 16 rows, but Y1 and Y0 do not:
g) In which rows do Y1 and Y0 deviate, and why do both outputs deviate in the same rows? Which input of which gate is connected wrongly? Confirm it in the simulation.
Solution
a) Y3=A
b) Y2=A⋅B+A⋅B=A⊕B
c) Y1=A⋅B⋅C+A⋅B⋅C+A⋅B⋅C+A⋅B⋅C=A⊕B⊕C
d) a chequerboard of eight single ones: the loops shrink with every further input, from eight cells to single cells, and no loop can minimize Y0
e) a chain, in which each output is the XOR of the output above it and one more input: Y3=A, Y2=A⊕B, Y1=A⊕B⊕C, Y0=A⊕B⊕C⊕D; three XOR gates
f) sector 11 is the Gray code word 1110; the chain gives 1011, the number 11
g) rows 4, 5, 6, 7, 12, 13, 14 and 15, exactly those with B=1; the XOR gate of Y1 receives A instead of Y2, and Y0 is formed from the wrong Y1