Binary Codes
27
Solution
(a) The binary equivalent of decimal 13 is 1101.
Binary–Gray conversion
Binary 1101
Gray 1- - -
Binary 1101
Gray 10 - -
Binary 1101
Gray 101 –
Binary 1101
Gray 1011
(b) Gray–binary conversion
Gray 1111
Binary 1- - -
Gray 1111
Binary 10- -
Gray 1111
Binary 101Gray 1111
Binary 1010
Example 2.5
Given the sequence of three-bit Gray code as (000, 001, 011, 010, 110, 111, 101, 100), write the next
three numbers in the four-bit Gray code sequence after 0101.
Solution
The first eight of the 16 Gray code numbers of the four-bit Gray code can be written by appending ‘0’
to the eight three-bit Gray code numbers. The remaining eight can be determined by appending ‘1’ to
the eight three-bit numbers written in reverse order. Following this procedure, we can write the next
three numbers after 0101 as 0100, 1100 and 1101.
2.4 Alphanumeric Codes
Alphanumeric codes, also called character codes, are binary codes used to represent alphanumeric
data. The codes write alphanumeric data, including letters of the alphabet, numbers, mathematical
symbols and punctuation marks, in a form that is understandable and processable by a computer. These
codes enable us to interface input–output devices such as keyboards, printers, VDUs, etc., with the
computer. One of the better-known alphanumeric codes in the early days of evolution of computers,
when punched cards used to be the medium of inputting and outputting data, is the 12-bit Hollerith
code. The Hollerith code was used in those days to encode alphanumeric data on punched cards.
The code has, however, been rendered obsolete, with the punched card medium having completely
vanished from the scene. Two widely used alphanumeric codes include the ASCII and the EBCDIC
codes. While the former is popular with microcomputers and is used on nearly all personal computers
and workstations, the latter is mainly used with larger systems.
27
Solution
(a) The binary equivalent of decimal 13 is 1101.
Binary–Gray conversion
Binary 1101
Gray 1- - -
Binary 1101
Gray 10 - -
Binary 1101
Gray 101 –
Binary 1101
Gray 1011
(b) Gray–binary conversion
Gray 1111
Binary 1- - -
Gray 1111
Binary 10- -
Gray 1111
Binary 101Gray 1111
Binary 1010
Example 2.5
Given the sequence of three-bit Gray code as (000, 001, 011, 010, 110, 111, 101, 100), write the next
three numbers in the four-bit Gray code sequence after 0101.
Solution
The first eight of the 16 Gray code numbers of the four-bit Gray code can be written by appending ‘0’
to the eight three-bit Gray code numbers. The remaining eight can be determined by appending ‘1’ to
the eight three-bit numbers written in reverse order. Following this procedure, we can write the next
three numbers after 0101 as 0100, 1100 and 1101.
2.4 Alphanumeric Codes
Alphanumeric codes, also called character codes, are binary codes used to represent alphanumeric
data. The codes write alphanumeric data, including letters of the alphabet, numbers, mathematical
symbols and punctuation marks, in a form that is understandable and processable by a computer. These
codes enable us to interface input–output devices such as keyboards, printers, VDUs, etc., with the
computer. One of the better-known alphanumeric codes in the early days of evolution of computers,
when punched cards used to be the medium of inputting and outputting data, is the 12-bit Hollerith
code. The Hollerith code was used in those days to encode alphanumeric data on punched cards.
The code has, however, been rendered obsolete, with the punched card medium having completely
vanished from the scene. Two widely used alphanumeric codes include the ASCII and the EBCDIC
codes. While the former is popular with microcomputers and is used on nearly all personal computers
and workstations, the latter is mainly used with larger systems.
