136 = 0001 0011 0110
1 3 6
00101001
11010110 First, invert the bits
+00000001 Then, add 1
= 11010111
The 2’s complement of 00101001 is 11010111
10110101
01001010 Invert the bits
+ 00000001 then add 1
= 01001011
The 2’s complement of 10110101 is 01001011
Binary to Gray code conversion lecutre
XOR table
Example 1
1 0 1 1 = 1 ( 1 ^ 0 ) ( 0 ^ 1 ) ( 1 ^ 1 )
= 1 1 1 0
(1011)2 = (1110)gray
Example 2
11001 = 1 ( 1 ^ 1 ) ( 1 ^ 0 ) ( 0 ^ 0 ) ( 0 ^ 1)
= 10101
Gray code to binary
Example 1
10101 = 11001