Representation of Characters: ASCII& EBCDIC Code

A decimal number to binary and the coding all have a series of bits. Bits obtained from coding are combinations of 1’s and 0’s arranged according to the rules of used codes. Our computer can understand the instructions written only in ‘0’ or ‘1’ binary code. So, all the digits\character are assigned a specific code in the form of ‘0’ or ‘1’. Different computers and devices need to communicate alphanumeric data amongst themselves. An alphanumeric data consists of only the letters A,B,C,D…,Z,a,b,c,d…..z and the blank spaces and numeric data consists of only numerals,0…9.These representation in form of ‘0’ or ‘1’ codes are divided into some forms of computer codes, some are ASCII-7, ASCII-8, EBCDIC, BCD.

BCD Code (binary code decmal)

Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence. The binary coded decimal codes are one of the early memory codes. Its main virtue is that it allows easy conversion to decimal digits for printing or display and faster decimal calculations. It is based on the idea of converting each digit of a decimal number into its binary equivalent rather then converting the entire decimal value into a pure binary form.

To Remember:

• The binary coded decimal (BCD) the code is one of the early computer codes.

• This code is based on the idea of converting each digit of a decimal number into its 4 bit binary equivalent. In the BCD form 4 bits each represent all decimal digits. When only 4-bits are used a total of 24 i.e., 16 configurations are possible.

• To represent character- 6 bits are used. It is 6 bit code which allow 64 (2^6) different character.

• BCD number are useful whenever decimal information is transferred into a computer.

• The zone portion is first two bits and digit portion is last four bits

In the 6-bit code the four BCD numeric place position (1,2,4 and 8) are retained, but two additional Zone Positions are used in combination with the numeric bits to represent alphabetic and special positions are used in combination with the bits to represent alphabetic and special characters.

Example:

Conversion of vikram in BCD = 010011 111001 100010 101001 110001 100100

character Zone bits Numeric digits

8 4 2 1

V 0 1 0 0 1 1

I 1 1 1 0 0 1

K 1 0 0 0 1 0

R 1 0 1 0 0 1

A 1 1 0 0 0 1

M 1 0 0 1 0 0

When only 6 bits are used a total of 26 i.e., 64 configurations are possible, means 64 different characters can be represented. These are sufficient to code 10 decimal digits, 26 alphabets and other 28 special characters.

CHARACTER BCD CODE OCTAL EQUIVALENT

Zone Digit

A 11 0001 61

B 11 0010 62

C 11 0011 62

D 11 0100 64

E 11 0101 65

F 11 0110 66

G 11 0111 67

H 11 1000 70

I 11 1001 71

J 10 0001 41

K 10 0010 42

L 10 0011 43

M 10 0100 44

N 10 0101 45

O 10 0110 46

P 10 0111 47

Q 10 1000 50

R 10 1001 51

S 01 0001 22

T 01 0010 23

U 01 0011 24

V 01 0100 25

W 01 0101 26

X 01 0110 27

Y 01 1000 30

Z 01 1001 31

1 00 0001 01

2 00 0010 02

3 00 0011 03

4 00 0100 04

5 00 0101 05

6 00 0110 06

7 00 0111 07

8 00 1000 10

9 00 1001 11

0 00 0000 12

Example: Conversion of

“NEEL007” BCD = 100101 110101 110101 100011 001010 001010 000111

character Zone bits Numeric digits

8 4 2 1

N 1 0 0 1 0 1

E 1 1 0 1 0 1

E 1 1 0 1 0 1

L 1 0 0 0 1 1

0 0 0 1 0 1 0

0 0 0 1 0 1 0

7 0 0 0 1 1 1

Conversion of Rahul in BCD = 010011 111001 100010 101001 110001 100100

character Zone bits Numeric digits

1001

0001

1000

0100

0011

R

10

11

11

01

10

A

H

U

L

Zone code - Digit code, zone code - Digit code

101001110001111000010100100011

Drawbacks of BCD :

Its drawbacks are the increased complexity of circuits needed to implement mathematical operations and a relatively inefficient encoding.

It occupies more space than a pure binary representation

By this code only 64 characters can be represented, which are not sufficient.to provide for decimal numbers(10), lower cse letters(26), capital letters(26) and other special characters.

Pracitce:

Prove these:

CASE = 110111 110001 010001 010010 110101

Manisha = 100100 110001 100101 111001 010001 111000 110001

Practice: Change these in BCD

1. manisha

2. nirbhay99

3. lavanya36

4. engineertamra1789

5. singhbikaner

Packed BCD

A widely used variation of the two-digits-per-byte encoding is called packed BCD or simply packed decimal. All of the upper bytes of a multi-byte word plus the upper four bits (nibble) of the lowest byte are used to store decimal integers. The lower four bits of the lowest byte are used as the sign flag.

As an example, a 32 bit word contains 4 bytes or 8 nibbles. Packed BCD uses the upper 7 nibbles to store the integers of a decimal value and uses the lowest nibble to indicate the sign of those integers.

Sign

Digit BCD

8 4 2 1 Sign Notes

A 1 0 1 0 +

B 1 0 1 1 −

C 1 1 0 0 + Preferred

D 1 1 0 1 − Preferred

E 1 1 1 0 +

ASCII Code

American Standard Code For Information Interchange.

It is the most common encoding for characters. It is a way of how the characters should map to various numbers. In today’s scenario everyone uses this coding. It is built in binary code for representing characters in almost computers. But in IBM mainframe use the EBCDIC code system. Initially it was based on 7-bit coding system.

In data communication x6x5…….x0 is 2^7=128 character.

It is seven bit code system and is divided into two portion.

(1) Zone portion – x6x5x4

(2) Digit portion - x3x2x1

ASCII was originally developed for communications and uses only seven bit per character, providing 128 combinations that include upper & lower case alphabetic letters, the numeric digit and special symbols such as the $ and %.

ASCII reserves the first 32 codes (numbers 0–31 decimal) for control characters: codes originally intended not to carry printable information, but rather to control devices (such as printers) that make use of ASCII, or to provide meta-information about data streams such as those stored on magnetic tape. The original ASCII standard used only short descriptive phrases for each control character. The ambiguity this left was sometimes intentional (where a character would be used slightly differently on a terminal link than on a data stream) and sometimes more accidental (such as what "delete" means).

The standard ASCII table defines 128 character codes (from 0 to 127), of which, the first 32 are control codes (non-printable), and the remaining 96 character codes are representable characters:

* 0 1 2 3 4 5 6 7 8 9 A B C D E F

0 NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI

1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US

2 ! " # $ % & ' ( ) * + , - . /

3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?

4 @ A B C D E F G H I J K L M N O

5 P Q R S T U V W X Y Z [ \ ] ^ _

6 ` A b c d e f g h i j k l m n o

7 p Q r s t u v w x y z { | } ~

* This panel is organized to be easily read in hexadecimal: row numbers represent the first digit and the column numbers represent the second one. For example, the "A" character is located at the 4th row and the 1st column, for that it would be represented in hexadecimal as 0x41 (65).

Because most systems nowadays work with 8bit bytes, which can represent 256 different values, in addition to the 128 standard ASCII codes there are other 128 that are known as extended ASCII, which are platform- and locale-dependent. So there is more than one extended ASCII character set.

TYPES-

ASCII is of two types :

1. ASCII-7

2. ASCII-8

ASCII-7

ASCII-7 is a 7-bit code that allows 128 different characetrs. The first 3 bits are used as zone bits and the last 4 bits indicate the digit. Micorcomputers using 8-bit byte use the 7-bit ASCII by leaving the leftmost first bit of each byte as a zero. ASCII-7 is a 7 bit code ,which allow 128 (2^7) different characters.

The first 3 bits are used as zone bits.

The last 4 bits indicate the digit.

Microcomputer using 8 bit byte (group of 8 bit for 1byte) use the 7 bit ASCII by leaving the left most first bit of each byte as a zero.

Table of ASCII-7

Character Ascii -7 Hexadecimal Equivalent

zone digit

code code

0 011 0000 30

1 011 0001 31

2 011 0010 32

3 011 0011 33

4 011 0100 34

5 011 0101 35

6 011 0110 36

7 011 0111 37

8 011 1000 38

9 011 1001 39

A 100 0001 41

B 100 0010 42

C 100 0011 43

D 100 0100 44

E 100 0101 45

F 100 0110 46

G 100 0111 47

H 100 1000 48

I 100 1001 49

J 100 1010 4A

K 100 1011 4B

L 100 1100 4C

M 100 1101 4D

N 100 1110 4E

O 100 1111 4F

P 101 0000 50

Q 101 0001 51

R 101 0010 52

S 101 0011 53

T 101 0100 54

U 101 0101 55

V 101 0110 56

W 101 0111 57

X 101 1000 58

Y 101 1001 59

Z 101 1010 5A

Example:

Conversion of vikram in ASCII-7 = 1010110 1001001 1001011 1010010 1000001 1001101

character Zone code Digit code

V 101 0110

I 100 1001

K 100 1011

R 101 0010

A 100 0001

M 100 1101

Example: Conversion of

“NEEL007” in ASCII-7 = 1001110 1000101 1000101 1001100 0110000 0110000 0110111

character Zone code Digit code

N 100 1110

E 100 0101

E 100 0101

L 100 1100

0 011 0000

0 011 0000

7 011 0111

Example : Change RAVI in ascii-7

Character ZONE CODE DIGIT CODE

R 101 0010

A 100 0001

V 101 0110

I 100 1001

Zone code - Digitcode,zonecode - Digit code

1010010100000110101101001001

Practice: Change these in asii-7

1. manisha

2. nirbhay99

3. lavanya36

4. engineertamra1789

Ascii-8

ASCII-8 is an extended version of ASCII-7.

• It is an 8 bit code ,which allow 256 (2^8) different characters, rather than 128 in ascii-7.

• The additional bit is added to the zone bits.

• The first 4 bits are used as zone bits.

• The last 4 bits indicate the digit.

Ascii-8 table:

Character Zone code Digit code Hexadecimal

Equivalent

0 0101 0000 50

1 0101 0001 51

2 0101 0010 52

3 0101 0011 53

4 0101 0100 54

5 0101 0101 55

6 0101 0110 56

7 0101 0111 57

8 0101 1000 58

9 0101 1001 59

A 1010 0001 A1

B 1010 0010 A2

C 1010 0011 A3

D 1010 0100 A4

E 1010 0101 A5

F 1010 0110 A6

G 1010 0111 A7

H 1010 1000 A8

I 1010 1001 A9

J 1010 1010 AA

K 1010 1011 AB

L 1010 1100 AC

M 1010 1101 AD

N 1010 1110 AE

O 1010 1111 AF

P 1011 0000 B0

Q 1011 0001 B1

R 1011 0010 B2

S 1011 0011 B3

T 1011 0100 B4

U 1011 0101 B5

V 1011 0110 B6

W 1011 0111 B7

X 1011 1000 B8

Y 1011 1001 B9

Z 1011 1010 BA

Example:

Character ZONE CODE DIGIT CODE

R 1011 0010

A 1010 0001

J 1010 1010

D 1010 0100

E 1010 0101

E 1010 0101

P 1011 0000

Zone code - Digitcode,zonecode - Digit code

10110010101000011010101010100100101001011010010110110000

Practice: Change these in asii-8

6. manisha

7. nirbhay99

8. lavanya36

9. engineertamra1789

10. singhbikaner

EBCDIC Code

EBCDIC (Extended Binary Coded Decimal Interchange Code) is a character encoding set used by IBM mainframes. Unlike virtually every computer system in the world which uses a variant of ASCII, IBM mainframes and midrange systems such as the AS/400 tend to use a wholly incompatible character set primarily designed for ease of use on punched cards.

The character encoding is based on Binary Coded Decimal (BCD), so the contiguous characters in the alphanumeric range are formed up in blocks of up to 10 from 0000 binary to 1001 binary. Non alphanumeric characters are almost all outside the BCD range. EBCDIC uses the full 8 bits available to it, so parity checking cannot be used on an 8 bit system. Also, EBCDIC has a wider range of control characters than ASCII.

To be remember:

• Extended Binary Coded Decimal Interchange Code, pronounced “eb-see-dick”.

• EBCDIC is an 8 bit code, it can be easily divided into two 4 bit group. Each of these 4-bit groups can be represented by 1 hexadecimal digit

• In this code, it is possible to represent 256(28) different characters instead of 64(26). Because EBCDIC is an 8-bit code,.

• The binary code for text as well as communication & printer control for IBM.

• This code can represent the following type of coded information.

2.) Lowercase letters – a,b,c….z

3.) Upper case letter eg. A,B, …Z

4.) Printable

5.) Nom printable

6.) Numeric values 0,1,….9

7.) Some special character such ass +,-,*,/,$ etc

In the BCd code only 64 characters can be represented, which are not sufficient to provide decimal number (10), lower case letter (26), capital letters (26) and large number of other special characetrs. Hence, the BCD code was extended from a 6-bit code to an 8-bit code. This coding scheme is called as EBCDIB for Extended bimary coded decimal interchange code.

Character EBCDIC CODE HEXADECIMAL EQUIVALENT

Zone code Digit code

A 1100 0001 C1

B 1100 0010 C2

C 1100 0011 C3

D 1100 0100 C4

E 1100 0101 C5

F 1100 0110 C6

G 1100 0111 C7

H 1100 1000 C8

I 1100 1001 C9

J 1101 0001 D1

K 1101 0010 D2

L 1101 0011 D3

M 1101 0100 D4

N 1101 0101 D5

O 1101 0110 D6

P 1101 0111 D7

Q 1101 1000 D8

R 1101 1001 D9

S 1111 0001 E2

T 1111 0010 E3

U 1111 0011 E4

V 1111 0100 E5

W 1111 0101 E6

X 1111 0110 E7

Y 1111 1000 E8

Z 01 1001 E9

1 1111 0001 F1

2 1111 0010 F2

3 1111 0011 F3

4 1111 0100 F4

5 1111 0101 F5

6 1111 0110 F6

7 1111 0111 F7

8 1111 1000 F8

9 1111 1001 F9

0 1111 1010 F0

Example:

Character ZONE CODE DIGIT CODE

R 1101 1001

A 1100 0001

J 1101 0001

Zone code - Digitcode,zonecode - Digit code

11011001 11000001 11010001

Advantages

• Scaling by a factor of 10 (or a power of 10) is simple; this is useful when a decimal scaling factor is needed to represent a non-integer quantity (e.g., in financial calculations)

• Alignment of two decimal numbers (for example 1.3 + 27.08) is a simple, exact, shift

• Rounding at a decimal digit boundary is simpler.

• Conversion to a character form or for display is a simple per-digit mapping, and can be done in linear time. A text-based format such as XML, or to drive signals for a seven-segment display. Conversion from pure binary involves relatively complex logic that spans digits, and for large numbers no linear-time conversion algorithm is known

• Some non-integral values, such as 0.3, have a finite place-value representation in decimal but not in binary; consequently a system based on binary place-value representations would introduce a small error representing such a value, which may be compounded by further computation if careful numerical considerations are not made.

Note that if computation is not performed on the value this is not an issue, since it suffices to represent it using enough bits that when rounded to the original number of decimal digits the original value is correctly recovered.

Disadvantages

Some operations are more complex to implement.

• Adders require extra logic to cause them to wrap and generate a carry early. 15–20% more circuitry is needed for BCD add compared to pure binary. Multiplication requires the use of algorithms that are somewhat more complex than shift-mask-add

Exam: a binary multiplication, requiring binary shifts and adds or the equivalent, per-digit or group of digits is required

• Standard BCD requires four bits per digit, roughly 20% more space than a binary encoding. When packed so that three digits are encoded in ten bits, the storage overhead is reduced to about 0.34%, at the expense of an encoding that is unaligned with the 8-bit byte boundaries common on existing hardware, resulting in slower implementations on these systems.

Practical existing implementations of BCD are typically slower than operations on binary representations, especially on embedded systems, due to limited processor support for native BCD operations.

Practice: Change these in EBCDIC

1. manisha

2. nirbhay99

3. lavanya36

4. engineertamra1789

5. singhbikaner

• An Indian Code

ISCII –Coding representation:

Indian Standard code for Information Interchange-

• This coding is an Indian information interchange. It is developed for representation of Indian script alphabets.

• It is 8-bit representation

• It also allows English vowels and consonants and other symbols.

• It is based on BRAMHI script.

USE:

• Mainly it is developed for our traditional religious books

## 07 October 2010

Subscribe to:
Post Comments (Atom)

Shree Ram Techno Solutions Provides CCTV Camera, Security Camera, Wireless Security, Attendance System, Access Control System, DVR, NVR, Spy Camera, Fire Alarm, Security Alarm, PCI, IP Network Camera, Dome Camera, IR Camera, CCTV, Camera Price, HIKVISION, SCATI, Time Machine

ReplyDeleteCCTV CAmera in jaipur at Rajasthan

Home security system in jaipur

Wireless Home Security System in jaipur

Realtime attendance machine in jaipur

cctv camera dealer in jaipur

Hikvision DVR in jaipur at Rajasthan

security system solutions in jaipur

Freelance Best Makeup & Hair Artist in Jaipur with huge experience and Specialization in Bridal and Wedding Makeup,Celebrity Makeup,Professional Makeup,Creative Makeup,Bollywood Makeup..

ReplyDeleteFiza Makeup Academy Rajasthan

Fiza Makeup Academy

Fiza Makeup and Hair Artist

Wedding Makeup Artist in jaipur

Bridal Makeup Artist in jaipur

Professional Makeup Artist in jaipur

Hair and Makeup Artist in jaipur

Celebrity Makeup Artist in jaipur

Creative Makeup Artist in jaipur

Bollywood Makeup Artist in jaipur

Character Makeup Artist in jaipur