You are on page 1of 19

Computer Codes

Computer Codes

 Numeric data is not the only data handled by the


computer
 Need to process alphanumeric data as well
BCD Code

 Binary-coded decimal code


 formed by converting each digit of a decimal number
individually into binary
 requires more digits than conventional binary
 has advantage of very easy conversion to/from decimal
 Decimal Binary BCD

0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
 4 digit BCD number can only represent numbers
 Insufficient to represent various characteristics
 With 6 bits how many combinations are available?
BCD code BCD code
Character Zone Digit Character Zone Digit
A 11 0001 J 10 0001
B 11 0010 K 10 0010
C 11 0011 L 10 0011
D 11 0100 M 10 0100
E 11 0101 N 10 0101
F 11 0110 O 10 0110
G 11 0111 P 10 0111
H 11 1000 Q 10 1000
I 11 1001 R 10 1001
BCD code
BCD code
Character Zone Digit Character Zone Digit
0 00 0000
S 01 0010
1 00 0001
T 01 0011
2 00 0010
U 01 0100
3 00 0011
V 01 0101
4 00 0100
W 01 0110
5 00 0101
X 01 0111
6 00 0110
Y 01 1000
7 00 0111
Z 01 1001
8 00 1000
9 00 1001
 Write BCD code of the word BASE
EBCDIC

 Stands for Extended Binary Coded Decimal


Interchange Code
 Uses 8 bits
 Represent 256 characteristics
Zoned Decimal Numbers

 Used to represent numeric values in EBCDIC (


positive, negative, unsigned)
 A sign indicator ( C for plus, D for minus, F for
unsigned) is used in the zone position of the right
most digit
 Zones for all other digits is F
Packed Decimal Numbers

 Packed decimal numbers are formed from Zoned


decimal number in the following format
 The zone half and the digit half of the right- most digit is
reversed
 All remaining zones are dropped out
 Requires fewer number of bytes
 Can be used for arithmetic operations
 Using binary notation, write EBCDIC coding for
the word BIT. How many bytes are required for this
representation?
 Solution:

B = 1100 0010 in EBCDIC binary notation


I = 1100 1001 in EBCDIC binary notation
T = 1110 0011 in EBCDIC binary notation
ASCII

 ASCII stands for American Standard Code for Information


Interchange

 ASCII is of two types – ASCII-7 and ASCII-8

 ASCII-7 uses 7 bits to represent a symbol and can


represent 128 (27) different characters

 ASCII-8 uses 8 bits to represent a symbol and can


represent 256 (28) different characters

 First 128 characters in ASCII-7 and ASCII-8 are same


Unicode

 Why Unicode:
 No single encoding system supports all languages
 Different encoding systems conflict

 Unicode features:
 Provides a consistent way of encoding multilingual
plain text
 Defines codes for characters used in all major
languages of the world
 Defines codes for special characters, mathematical
Symbols, technical symbols, and diacritics
 Unicode features (continued):
 Capacity to encode as many as a million characters
 Assigns each character a unique numeric value and name
 Reserves a part of the code space for private use
 Affords simplicity and consistency of ASCII, even
corresponding characters have same code
 Encoding Forms
 UTF-8, UTF-16, UTF-32

You might also like