Complete Computer Knowledge Portal

Wednesday, July 3, 2013

Computer Codes

1)   BCD (Binary Coded Decimal) Code:  This code is based on the idea of converting each digit of a decimal number into its binary equivalent in spite of converting the entire decimal value into a pure binary form. In this coding technique each decimal digit is independently converted to a  4 bit binary number which makes conversion process very easy.24=16 configurations are possible but only first 10 are used to represent decimal digits from 0 to 9.

Character
BCD Code
Octal Equivalent
Zone
Digit
A
11
0001
61
B
11
0010
62
C
11
0011
63
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
0010
22
T
01
0011
23
U
01
0100
24
V
01
0101
25
W
01
0110
26
X
01
0111
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
1010
12


E.g. Conversion of decimal number 38 is done as follows
3810= 0011           1000
             3                 8

Or 00111000 in BCD

2)EBCDIC (Extended BCD Interchange Code): BCD code has the limitation that it can be used only to represent 64 Characters. This is not sufficient to represent 10 decimal numbers, 26 small letters and 26 capital letters with it. Therefore this code is extended from 6 bit to 8 bit code and is known as EBCDIC. First 4 bits are used as zone bits and rest 4 are used to represent digits. With this code it is possible to represent 256 different characters. This code contains 8 bit and can be used as two 4 bit groups to represent 1 hexadecimal digit.

Character
EBCDIC Code
Hexadecimal Equivalent
Zone
Digit
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
1110
0010
E2
T
1110
0011
E3
U
1110
0100
E4
V
1110
0101
E5
W
1110
0110
E6
X
1110
0111
E7
Y
1110
1000
E8
Z
1110
1001
E9
0
1111
0000
F0
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


3) Gray Code: Gray code is similar to binary but has the difference that gray code changes by only one bit as it sequences from one number to next number. These codes are generally used in counters. These are also used in digital systems for generating timing sequences. Table given below illustrates 4 bit gray code.

4 Bit Gray Code Table
Binary Code
Decimal Equivalent
0000
0
0001
1
0011
2
0010
3
0110
4
0111
5
0101
6
0100
7
1100
8
1101
9
1111
10
1110
11
1010
12
1011
13
1001
14
1000
15


4) ASCII (American Standard Code for Information Interchange) Code:
This is another coding standard that is used for transmission of binary information. It is of two types: ASCII-7 and ASCII-8. ASCII is 8 bit code and can represent 128 different characters. First 3 bits are used as Zone bits and last 4 bits are used to represent digits. ASCII-8 is the extended version of ASCII-7 and can represent 256 different characters. It contains 4 Zone bits rather than 3 bits.

Character
ASCII-7 Code
Hexadecimal Equivalent
ASCII-8 Code
Hexadecimal Equivalent
Zone
Digit
Zone
Digit
0
011
0000
30
0101
0000
50
1
011
0001
31
0101
0001
51
2
011
0010
32
0101
0010
52
3
011
0011
33
0101
0011
53
4
011
0100
34
0101
0100
54
5
011
0101
35
0101
0101
55
6
011
0110
36
0101
0110
56
7
011
0111
37
0101
0111
57
8
011
1000
38
0101
1000
58
9
011
1001
39
0101
1001
59
A
100
0001
41
1010
0001
A1
B
100
0010
42
1010
0010
A2
C
100
0011
43
1010
0011
A3
D
100
0100
44
1010
0100
A4
E
100
0101
45
1010
0101
A5
F
100
0110
46
1010
0110
A6
G
100
0111
47
1010
0111
A7
H
100
1000
48
1010
1000
A8
I
100
1001
49
1010
1001
A9
J
100
1010
4A
1010
1010
AA
K
100
1011
4B
1010
1011
AB
L
100
1100
4C
1010
1100
AC
M
100
1101
4D
1010
1101
AD
N
100
1110
4E
1010
1110
AE
O
100
1111
4F
1010
1111
AF
P
101
0000
50
1011
0000
B0
Q
101
0001
51
1011
0001
B1
R
101
0010
52
1011
0010
B2
S
101
0011
53
1011
0011
B3
T
101
0100
54
1011
0100
B4
U
101
0101
55
1011
0101
B5
V
101
0110
56
1011
0110
B6
W
101
0111
57
1011
0111
B7
X
101
1000
58
1011
1000
B8
Y
101
1001
59
1011
1001
B9
Z
101
1010
5A
1011
1010
BA

No comments:

Post a Comment