ADVERTISEMENTS:

We are well conversant with binary numbers. As discussed earlier an electronic/ magnetic device can recognize two distinguishable states, we assign one state to 0 and the other state to be 1. Thus every single binary digit is stored and processed separately by a digital computer.

A binary digit when stored in computer hardware is called as a bit. Thus a complete binary number is stored as a combination of bits. As it is clear now, a digital computer accepts every information (be it an alphabet or a number or combination of both) in form of O’s and 1’s.

So our task is to represent every alphabet (A to Z), number (0 to 9) and special characters ( / ? + ” @ # * &^{^} = {} % ~ [] \ …) in a standard binary format. For efficient and fast processing, these characters are not only represented as O’s and 1’s, but also encoded with some standard formats. Encoding is a salient feature of modern digital computers.

ADVERTISEMENTS:

Let us discuss an example to illustrate the point. Suppose you are given a bunch of nails of different sizes, a bunch of nut bolts of different shapes and sizes and other small steel items to keep in a tool box. Let us keep it in raw form (all are mixed up). When the carpenter asks for a nail of a particular size, what shall we do? We have to search the entire tool box for the nail, which would not be faster.

Instead, if the nails / nut bolts are kept in different packets as per their sizes. Then imagine the finding a nail of any given size! Definitely, the search would be faster!! Exactly, the encoding of characters does that in digital operation.

Encoding of the characters began as early as 1963. A data may consists of either a single character or a number of characters. Computer accepts each character as a group of bits. Such a group of bits used to represent a character (a letter, a number or any special symbol) is called a byte. In modern digital computers a byte consists of 8 bits, i.e. every character is represented internally by a group of 8 bits.

There may be different ways of encoding every character used for a computer. In order to avoid any ambiguity, some standards have been defined by the computer industries. Notable among them are BCD, EBCDIC and ASCII. The first two are primarily used for mainframe or minicomputers where as ASCII is widely used for today’s Personal Computers.

ADVERTISEMENTS:

**BCD Code:**

Abbreviated for Binary Coded Decimal, it is the earliest encoding standards introduced by IBM Corporation, USA. As per this standard a decimal number is not converted to its binary equivalent rather each digit is converted to its 4-bit binary equivalent number. The following example illustrates this technique.

Show the binary digits used in BCD format to store the word FRUIT.

**Solution:**

ADVERTISEMENTS:

In BCD binary notation

F is recorded as 110110

R is recorded as 101001

U is recorded as 010100

ADVERTISEMENTS:

I is recorded as 111001

T is recorded as 010011

Thus, the binary digit 110110 101001 010100 111001 010011 would store the word FRUIT in a computer memory.

To remember these 6-bit binary encoding may not be so easy. Here we take the help of Octal Number system, in which a 6-bit binary number is compressed to just 2- digit octal number. A student can convert the binary numbers representing a character in the Table-1B.4.1 to octal numbers and try to remember the corresponding codes.

ADVERTISEMENTS:

As an example, the character “R” possess a binary BCD code of 101001.

Its decimal BCD code would be 41

Its octal BCD code would be 51

Because 101001_{binary }= 41_{decimal} = 51_{octal}

**EBCDIC Code:**

The limitation of BCD code is that, only 64 characters can be encoded in this format. These characters include 26 upper case English alphabets, 10 decimal digits and few special symbols like +, -, / and * etc. But another set of 26 lower case letters and many more special symbols required to be encoded.

This requirement gave rise to the new format called as Extended Binary Coded Decimal Interchange Code. Instead of 6-bit encoding, this format uses 8-bit coding.

[The first 4-bits are called as ‘Zone’ and the next 4-bit are the ‘digit’. Combination of these 8-bits is called a byte. Each of the 4-bits is called a nibble. Thus a 8-bit byte consists of two nibbles.]

Thus the number of characters those can be encoded in this format is 2^{8} = 256. The following Table-2.4 shows the binary EBCDIC codes of different characters.

The shortcut method to remember these codes is, just to convert the Zone nibble and Digit nibble in to hexadecimal numbers.

Look the zone nibble of the letters (A to I) is 1100 in binary which is C in hexadecimal. The digit nibbles are just from 0001 to 1001 in binary which is 1 to 9 in hexadecimal. So the codes for (A to I) is (CI to C9) in hexadecimal.

Similarly the hexadecimal EBCDIC code for (J to R) are (D1 to D9), for (S to Z) are (E2 to E9) and for the decimal numbers (0 to 9) are (F0 to F9).

When decimal numbers are encoded in EBCDIC format they are called as Zoned Decimal Numbers. A digital computer accepts those numeric data which are in Zoned- Decimal format. But an electronic circuit cannot carry out arithmetic operations on the numbers in Zoned-Decimal format.

It has to be converted to another format called as Packed-Decimal format. In this format the zone nibbles are dropped except the rightmost number. The zone nibble of the right most number is shifted from left to right. If the number is +ve then this shifted nibble would be Chex, if the number is – ve then it is Dhex and if unsigned it is Fhex. The following example would illustrate the steps.

**ASCII Code:**

Abbreviated for American Standard Code for Information Interchange is contemporary of EBCDIC format. Due to its use in Personal Computers this encoding format has got wide acceptance and use. There are two ASCII formats ASCII-7 and ASCII-8. In the first one the zone part consists of 3-bits and the digit part as usual 4-bits. In the later format the zone nibble and the digit nibble are 4-bit each.

The type of encoding is exactly the same as that of EBCDIC except different binary representations which are illustrated in the following Tables. A close verification of two tables reveals that the digit nibbles of the characters of both the formats are same except the zone nibble.

Again like EBCDIC the ASCII encoded characters can be easily remembered if the binary nibbles are converted to hexadecimal equivalents.

Thus the letters (A-O) in hexadecimal notation of ASCII-7 are (41-4F).

The letters (P-Z) in hexadecimal notation of ASCII-7 are (50-5A).

The digits (0-9) in hexadecimal notation of ASCII-7 are (30-39).

The letters (A-O) in hexadecimal notation of ASCII-8 are (Al-AF).

The letters (P-Z) in hexadecimal notation of ASCII-8 are (BO-BA).

The digits (0-9) in hexadecimal notation of ASCII-8 are (50-59).