0% found this document useful (0 votes)
101 views13 pages

Codes 2

The document discusses various digital codes, including the excess-3 code, Gray code, alphanumeric codes, ASCII, EBCDIC, and seven-segment display codes. It explains how the excess-3 code simplifies arithmetic operations by adding '3' to each decimal digit and converting it to binary, while the Gray code ensures that successive values differ by only one bit. Additionally, it covers the limitations of traditional character encodings and introduces Unicode as a comprehensive solution for multilingual text representation.

Uploaded by

obenzajoshua01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views13 pages

Codes 2

The document discusses various digital codes, including the excess-3 code, Gray code, alphanumeric codes, ASCII, EBCDIC, and seven-segment display codes. It explains how the excess-3 code simplifies arithmetic operations by adding '3' to each decimal digit and converting it to binary, while the Gray code ensures that successive values differ by only one bit. Additionally, it covers the limitations of traditional character encodings and introduces Unicode as a comprehensive solution for multilingual text representation.

Uploaded by

obenzajoshua01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AST 122

(DIGITAL ELECTRONICS)
2nd Semester AY 2024-2025

By: Maricar H. Nudalo, MSIT


Part-time Instructor
2.2 Excess-3 Code
The excess-3 code is another important BCD code. It is particularly significant for arithmetic operations as it
overcomes the shortcomings encountered while using the 8421 BCD code to add two decimal digits whose sum exceeds
9. The excess-3 code has no such limitation, and it considerably simplifies arithmetic operations. The excess-3 code for a
given decimal number is determined by adding ‘3’ to each decimal digit in the given number and then replacing each digit
of the newly found decimal number by its four-bit binary equivalent.

Table 2.2 Excess-3 code equivalent of decimal numbers.


Decimal number Excess-3 code
0 0011
1 0100
2 0101
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100
If the addition of ‘3’ to a digit produces a carry, as is the case with the digits 7, 8 and 9, that
carry should not be taken forward. The result of addition should be taken as a single entity and
subsequently replaced with its excess-3 code equivalent.

Example: let us find the excess-3 code for the decimal number 597:

• The addition of ‘3’ to each digit yields the three new digits/numbers ‘8’,
‘12’ and ‘10’.
• The corresponding four-bit binary equivalents are 1000, 1100 and 1010
respectively.
• The excess-3 code for 597 is therefore given by:
1000 1100 1010 = 100011001010
2.3Gray Code

The Gray code was designed by Frank Gray at Bell Labs and patented in 1953. It is an
unweighted binary code in which two successive values differ only by 1 bit.

Table2.3 lists the binary and Gray code equivalents of decimal numbers 0–15. An examination of the four-bit
Gray code numbers, as listed in Table 2.3, shows that the last entry rolls over to the first entry. That is, the last
and the first entry also differ by only 1bit. This is known as the cyclic property of the Gray code.
Different ways by which Gray codes with a given number of bits can be remembered:
1. remember that the least significant bit follows a repetitive pattern of ‘2’ (11, 00, 11, ),
2. the next higher adjacent bit follows a pattern of ‘4’ (1111, 0000, 1111, ) and so on
3. We can also generate the n-bit Gray code recursively by prefixing a ‘0’ to the Gray code for
n−1bits to obtain the first 2n−1 numbers, and then prefixing ‘1’ to the reflected Gray code for
n−1bits to obtain the remaining2n−1 numbers.

The reflected Gray code is nothing but the code written in reverse order. The process of
generation of higher-bit Gray codes using the reflect and-prefix method is illustrated inTable2.4.
The columns of bits between those representing the Gray codes give the intermediate step of
writing the code followed by the same written in reverse order
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.

12-bit Hollerith code – 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,

Two widely used alphanumeric codes:


1. ASCII Code – popular with microcomputers and is used on nearly all personal computers and workstations.
2. EBCDIC code – mainly used with larger systems.

Traditional character encodings such as ASCII, EBCDIC and their variant shave a limitation in terms of the
number of characters they can encode. As a result, these encodings do not permit multilingual computer
processing.
Unicode – developed jointly by the Unicode Consortium and the International Standards
Organization(ISO).
– the most complete character encoding scheme that allows text of all forms and
languages to been coded for use by computers.

2.4.1. ASCII(American Standard Code for Information Interchange) – is strictly a seven-bit code based on the
English alphabet.
– used to represent alphanumeric data in computers, communications equipment and other related devices.
– first published as a standard in1967. It was subsequently updated and published as ANSIX3.4-1968, then as
ANSI X3.4-1977and finally as ANSIX3.4-1986.

Since it is a seven-bitcode, it can at the most represent 128 characters. It currently defines 95 printable characters
including 26 upper-case letters (A to Z), 26 lower-case letters(a to z),10 numerals(0 to 9)and 33 special characters
including mathematical symbols, punctuation marks and space character.

In addition, it defines codes for 33 nonprinting, mostly obsolete control characters that affect how text is processed.
With the exception of ‘carriage return’ and/or ‘line feed’, all other characters have been rendered obsolete by
modern mark-up languages and communication protocols, the shift from text-based devices to graphical devices
and the elimination of teleprinters, punch cards and paper tapes.
An eight-bit version of the ASCII code, known as USASCII-8 or ASCII-8, has also been developed.
The eight-bit version can represent a maximum of 256 characters. Table2.6 lists the ASCII codes for
all 128 characters. When the ASCII code was introduced, many computers dealt with eight-bit
groups(or bytes) as the smallest unit of information. The eighth bit was commonly used as a parity
bit for error detection on communication lines and other device-specific functions. Machines that did
not use the parity bit typically set the eighth bit to‘0’
Looking at the structural features of the code as reflected
inTable2.6, we can see that the digits 0 to 9 are represented with
their binary values prefixed with 0011.That is, numerals 0 to 9 are
represented by binary sequences from 00110000 to 00111001
respectively. Also, lower-case and upper-case letters differ in bit
pattern by a single bit. While upper-case letters ‘A’ to ‘O’ are
represented by 0100 0001 to 01001111, lower-case letters ‘a’ to ‘o’
are represented by 01100001 to 01101111. Similarly, while upper-
case letters ‘P’ to ‘Z’ are represented by 01010000 to 01011010,
lower-case letters ‘p’ to ‘z’ are represented by 01110000 to
01111010.

With widespread use of computer technology, many variants of the ASCII code have evolved over the years to
facilitate the expression of non-English languages that use a Roman-based alphabet. In some of these variants, all
ASCII printable characters are identical to their seven-bit ASCII code representations.

2.4.2 EBCDIC code


EBCDIC (Extended Binary Coded Decimal Interchange Code), pronounced ‘eb-si-dik’ – is another widely used
alphanumeric code, mainly popular with larger systems.
IBM – created the EBCDIC to extend the binary coded decimal that existed at that time.
All IBM mainframe computer peripherals and operating systems use EBCDIC code, and their operating systems
provide ASCII and Unicode modes to allow translation between different encodings.
The code is used in contemporary mainframe machines solely for backwards compatibility as
punch cards are not used on main frames anymore.
2.5 Seven-segment Display Code
Seven-segment displays [Fig. 2.1(a)] are very common and are found almost everywhere, from
pocket calculators, digital clocks and electronic test equipment to petrol pumps. A single seven-
segment display or a stack of such displays invariably meets our display requirement. There are
both LED and LCD types of seven-segment display.

Figure 2.1 Seven-segment displays.


there are common anode-type LED displays where the arrangement of different diodes,
designated a, b, c, d, e, f and g, is as shown in Fig. 2.1(b), and common cathode-type displays
where the individual diodes are interconnected as shown in Fig. 2.1(c). Each display unit usually
has a dot point (DP).
The DP could be located either towards the left (as shown) or towards the right of the figure ‘8’ display pattern.
This type of display can be used to display numerals from 0 to 9 and letters from A to F. Table 2.8 gives the binary
code for displaying different numeric and alphabetic characters for both the common cathode and the common
anode type displays. A ‘1’ lights a segment in the common cathode type display, and a ‘0’ lights a segment in the
common anode type display.

You might also like