2. Binary Coded Decimal (BCD)
• One of the most widely used representations of
numerical data is the binary coded decimal
(BCD) form in which each integer of a decimal
number is represented by a 4-bit binary number
(see conversion table).
• It is particularly useful for the driving of display
devices where a decimal output is desired. BCD
usually refers to such coding in which the binary
digits have their normal values, i.e., 8421.
Sometimes it is written "8421 BCD" to clearly
distinguish it from other binary codes such as
the4221 Code, but when BCD is used without
qualification, the 8421 version is assumed.
7. BCD Addition
• Multi-digit BCD numbers can be added together
23
0010 0011
45
0100 0101
68
0110 1000
23
0010 0011
48
0100 1000
71
0110 1011
• 1011 is illegal BCD number
8. BCD Addition
• Add a 0110 (6) to an invalid BCD number
• Carry added to the most significant BCD digit
23
48
71
0010 0011
0100 1000
0110 1011
0110
0111 0001
10. Gray Code : Minimum Change code
• Gray code is also known as reflected binary code.
• The reflected binary code was originally designed to prevent
spurious outputs from electromechanical switches.
• Today, Gray codes are widely used to facilitate error correction in
digital communications
18. Alphanumeric Codes
• Represent numbers and alphabetic characters.
—Also represent other characters such as symbols and
various instructions necessary for conveying
information.
• The ASCII is the most common alphanumeric
code.
—ASCII = American Standard Code for Information
Interchange
20. Codes and Characters
• Each character is coded as a byte
• Most common coding system is ASCII
(Pronounced ass-key)
• ASCII = American National Standard Code for
Information Interchange
• Defined in ANSI document X3.4-1977
21. ASCII Features
•
•
•
•
7-bit code
8th bit is unused (or used for a parity bit)
27 = 128 codes
Two general types of codes:
—95 are “Graphic” codes (displayable on a console)
—33 are “Control” codes (control features of the
console or communications channel)
25. e.g., ‘a’ = 1100001
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
000
NULL
SOH
STX
ETX
EDT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
001
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
010
!
"
#
$
%
&
'
(
)
*
+
,
.
/
011
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
100
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
101
P
Q
R
S
T
U
V
W
X
Y
Z
[
]
^
_
110
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
111
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL
29. Extended ASCII
• There are an additional 128 characters that
were adopted by IBM for use in their PCs. It’s
popular and is used in applications other than
PCs unofficial standard.
—The extended ASCII characters are represented by
an 8-bit code series from 80h-FFh
31. Error Detection
• Digital Systems are very Reliable
• Errors during storage or transmission
• Parity Bit
—Even Parity
—Odd Parity
32.
33.
34.
35. Odd Parity Error Detection
•
•
•
•
•
•
•
•
Original data
10011010
With Odd Parity
110011010
1-bit error
110111010
Number of 1s even indicates 1-bit error
2-bit error
110110010
Number of 1s odd no error indicated
3-bit error
100110010
Number of 1s even indicates error