Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
0
2
3
1
0
3
-
11/21/2011 InA? nASSA
onverslon Among 8ases
1he posslblllLles
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
;ulck xample
25
10
11001
2
31
8
19
16
Base
11/21/2011 InA? nASSA
ueclmal Lo ueclmal ([usL for fun)
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
125
10
= 5 x 10
0
= 5
2 x 10
1
= 20
1 x 10
2
= 100
125
Base
Weight
11/21/2011 InA? nASSA
lracLlons
ueclmal Lo declmal ([usL for fun)
14 = 4 x 10
-2
= 004
1 x 10
-1
= 01
x 10
0
=
14
11/21/2011 InA? nASSA
8lnary Lo ueclmal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
8lnary Lo ueclmal
1echnlque
MulLlply each blL by 2
= 8
0 x 2
4
= 0
1 x 2
5
= 2
4
10
Bit '0
11/21/2011 InA? nASSA
lracLlons
8lnary Lo declmal
101011 = 1 x 2
-4
= 00625
1 x 2
-
= 0125
0 x 2
-2
= 00
1 x 2
-1
= 05
0 x 2
0
= 00
1 x 2
1
= 20
26875
11/21/2011 InA? nASSA
8nA? uMAL
9erform radlx2 expanslon
- 1 MulLlply each blL ln Lhe blnary number by 2 Lo Lhe power of lLs place
2 1hen sum all of Lhe values Lo geL Lhe declmal value
xamples
10111
2
(12
4
)+(02
3
)+(12
2
)+(12
1
)+(12
0
)23
10
101100011
2
(12
4
)+(02
3
)+(12
2
)+(12
1
)+(02
0
)
+(02
1
)+(02
2
)+(12
3
)+(12
4
) 221873
10
InA? nASSA 11/21/2011
cLal Lo ueclmal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
cLal Lo ueclmal
1echnlque
MulLlply each blL by 8
16
= x 16
0
= 12 x 1 = 12
x 16
1
= 11 x 16 = 176
x 16
2
= 10 x 256 = 2560
2748
10
11/21/2011 InA? nASSA
ueclmal Lo 8lnary
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
ueclmal Lo 8lnary
1echnlque
ulvlde by Lwo keep Lrack of Lhe remalnder
llrsL remalnder ls blL 0 (LS8 leasLslgnlflcanL blL)
Second remalnder ls blL 1
Lc
11/21/2011 InA? nASSA
xample
125
10
= .
2
2 125
62 1 2
1 0
2
15 1
2
7 1
2
1
2
1 1 2
0 1
125
10
= 1111101
2
11/21/2011 InA? nASSA
lracLlons
ueclmal Lo blnary
14579
14579
x 2
029158
x 2
05816
x 2
11662
x 2
0264
x 2
066528
x 2
1056
etc
11001001
11/21/2011 InA? nASSA
uMAL 8nA?(1)
Integer part
- Modulo dlvlslon of declmal lnLeger by 2 Lo geL each blL sLarLlng wlLh LS8
- Iract|on part
- MulLlpllcaLlon declmal fracLlon by 2 and collecL resulLlng lnLegers sLarLlng wlLh MS8
xample
onverL 41828123
10
Integer part
41 mod 21 LS8
20 mod 20
10 mod 20
S mod 21
2 mod 20
1 mod 21 MS8
InA? nASSA 11/21/2011
uMAL 8nA?(2)
Iract|on part
082812S 2 16S62S MS8
06S62S 2 1312S
0312S 2 062S
062S 2 12S
02S 2 0S
0S 2 10 LS8
1herefore 4182812S10 1010011101012
InA? nASSA 11/21/2011
ueclmal Lo cLal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
xample
124
10
= .
8
8 124
154 2
8
19 2
8
2
8
0 2
124
10
= 222
8
11/21/2011 InA? nASSA
ueclmal Lo Pexadeclmal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
xample
124
10
= .
16
124
10
= 4D2
16
16 124
77 2
16
4 1 = D
16
0 4
11/21/2011 InA? nASSA
cLal Lo 8lnary
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
cLal Lo 8lnary
1echnlque
onverL each ocLal dlglL Lo a 3blL equlvalenL
blnary represenLaLlon
11/21/2011 InA? nASSA
xample
705
8
= .
2
7 0 5
111 000 101
705
8
= 111000101
2
11/21/2011 InA? nASSA
Pexadeclmal Lo 8lnary
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
xample
10
16
= .
2
1 0
0001 0000 1010 1111
10
16
= 0001000010101111
2
11/21/2011 InA? nASSA
8lnary Lo cLal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
8lnary Lo cLal
1echnlque
Croup blLs ln Lhrees sLarLlng on rlghL
onverL Lo ocLal dlglLs
11/21/2011 InA? nASSA
xample
1011010111
2
= .
8
1 011 010 111
1 2 7
1011010111
2
= 127
8
11/21/2011 InA? nASSA
8nA? 1AL
8INAk CC1AL
0002 08
0012 18
0102 28
0112 38
1002 48
1012 38
1102 68
1112 78
8INAk CC1AL Croup blnary blLs by 3 from LS8
xamples
10 100 1102 2468
10 101 111 011011 112 2S73368
InA? nASSA 11/21/2011
8lnary Lo Pexadeclmal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
8lnary Lo Pexadeclmal
1echnlque
Croup blLs ln fours sLarLlng on rlghL
onverL Lo hexadeclmal dlglLs
11/21/2011 InA? nASSA
8lnary Lo Pexadeclmal
1echnlque
Croup blLs ln fours sLarLlng on rlghL
onverL Lo hexadeclmal dlglLs
11/21/2011 InA? nASSA
xample
1010111011
2
= .
16
10 1011 1011
2
1010111011
2
= 2
16
11/21/2011 InA? nASSA
8nA? POAuMAL
8INAk nLkADLCIMAL
0000
2
0
16
10002 816
00012 116 10012 916
00102 216 10102 10 (A16)
00112 316
01002 416 10112 11 (816)
01012 316 11002 12 (16)
01102 616 11012 13 (u16)
01112 716 11102 14 (16)
11112 13 (l16)
8INAk nLkADLCIMAL Croup blnary by 4 blLs from radlx polnL
xamples
10 10 10 01 101100 012 2A6C416
0111 10112 7816
InA? nASSA 11/21/2011
cLal Lo Pexadeclmal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
cLal Lo Pexadeclmal
1echnlque
use blnary as an lnLermedlary
11/21/2011 InA? nASSA
xample
1076
8
= .
16
1 0 7 6
001 000 111 110
2 E
1076
8
= 2E
16
11/21/2011 InA? nASSA
Pexadeclmal Lo cLal
Hexadecimal
Decimal Octal
Binary
11/21/2011 InA? nASSA
Pexadeclmal Lo cLal
1echnlque
use blnary as an lnLermedlary
11/21/2011 InA? nASSA
xample
10
16
= .
8
1 0
0001 1111 0000 1100
1 7 4 1 4
10
16
= 17414
8
11/21/2011 InA? nASSA
xerclse onverL
Don`t use a calculator!
Decimal Binary Octal
Hexa-
decimal
33
1110101
703
1AF
11/21/2011 InA? nASSA
xerclse onverL
Decimal Binary Octal Hexa-decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
nswer
11/21/2011 InA? nASSA
And now 1ry Some 9roblems
Suppose you want to represent pos|t|ve |ntegers |n b|nary
ndlcaLe how many blLs are requlred Lo represenL each of Lhe followlng seLs of
lnLegers
(1) 1he lnLegers from 0 Lo 127 lncluslve
(2) 1he lnLegers from 0 Lo 2048 lncluslve
(3) 1he lnLegers from 0 Lo 32300 lncluslve
(4) 1he lnLegers from 0 Lo 1300343 lncluslve
ndlcaLe how large a value can be represenLed by each of Lhe blnary quanLlLles
(1) 4blL (2) 12blL and (3) 24blL quanLlLy
onverL each of Lhe followlng blnary dlglLs lnLo declmal Assume Lhese quanLlLles
represenL unslgned lnLegers
(1) 1010 (2) 10010 (3) 0111110 (4) 10000000 (3) 0111111
onverL each of Lhe followlng declmal numbers lnLo blnary
(1) 6 (2) 13 (3) 111 (4) 147 (3) 311
InA? nASSA 11/21/2011
Why 8lnary n ?
igitaI Computers
- ImpIy that the computer deaIs with digitaI information, i.e., it deaIs
with the information that is represented by binary digits
- Why #? instead of ecimaI or other number system ?
* Consider eIectronic signaI
signaI
range
0 1 2 3 4 5 6 7 8 9
0 0 1 2 3 4 5 6 7 8 9
1 1 2 3 4 5 6 7 8 9 10
2 2 3 4 5 6 7 8 9 1011
3 3 4 5 6 7 8 9 101112
4 4 5 6 7 8 9 10111213
5 5 6 7 8 9 1011121314
6 6 7 8 9 101112131415
7 7 8 9 10111213141516
8 8 9 1011121314151617
9 9 101112131415161718
0
1
7
6
5
4
3
2
1
0
binary octaI
0 1
0 1
1 10
0
1
* Consider the caIcuIation cost - Add
InA? nASSA 11/21/2011
asy Lo represenL
ff and n pen and close swlLch Pead and Lall on a coln 9olarlLy of
magneLlzaLlon 0 and nonzero volLage levels
Pow Lo represenL lnformaLlon ln blnary?
We wanL Lo represenL poslLlve numbers 0 1
0 ls 0 and 1 ls 1
We wanL Lo represenL red and green colors
0 ls red and 1 ls green (or vlce versa)
WanL Lo represenL summer and wlnLer semesLers
0 ls summer and 1 ls wlnLer (or vlce versa)
Why 8lnary no?
11/21/2011 InA? nASSA
8lLs and omblnaLlons
# of
Bits
1
2
3
4
..
..
..
n
# of
quantities
2
4
8
16
..
..
..
2
n
What happens in other number
systems?
n base b, n digits give bn
combinations
Base 10: decimal
Base 8: Octal
Base 16: Hexadecimal
11/21/2011 InA? nASSA
IN1kCDUC1ICN
1he 8CD Code
1he Lxcess3 Code
1he Gray Code
1he ASCII Code
Lncoders
Sevensegment
D|sp|ays
Sevensegment LLD
D|sp|ays
Decoders
8CDtoSeven
Segment Decoder]
Dr|ver
L|qu|d Crysta| D|sp|ays
Vacuum I|uorescent
D|sp|ays
1he 8421 8CD Code
8CD stands for 8|naryCoded Dec|ma|
A 8CD number |s a fourb|t b|nary group that
represents one of the ten dec|ma| d|g|ts 0 through 9
,250
Decimal number 4926 4 9 2 6
8421 BC coded number 0100 1001 0010
0110
Convert the 8CD coded number
1000 0111 0001 |nto dec|ma|
"&IZ
ecimaI Number 8 7 1
BC Coded Number 1000 0111
0001
Convert the decimaI
number 350 to its BC
equivaIent.
ecimaI Number 3 5 0
BC Coded Number 0011 0101
0000
"&IZ
1he Lxcess3 Code
Add 3 to each d|g|t of dec|ma| and
convert to 4b|t b|nary form
A 8CD code (not 8421 8CD)
ecimaI Binary +3 Excess-3
0 0000 0011 0011
1 0001 0011 0100
2 0010 0011 0101
3 0011 0011 0110
4 0100 0011 0111
5 0101 0011 1000
6 0110 0011 1001
7 0111 0011 1010
8 1000 0011 1011
9 1001 0011 1100
ecimaI 3 5 9
SampIe ProbIem:
Excess-3 0110 1000 1100
"&IZ
1. To form an excess-3 coded
number, decimaI 3 is added to
the decimaI number and this is
converted to its 4-bit binary
code. (True or FaIse)
True
2. The excess-3 BC number 1010
0100 equaIs __________ in decimaI. 71
3. The decimaI number 428 equaIs
what excess-3 number. 0111 0101 1011
1he Gray Code
1he Gray code's most |mportant
character|st|c |s that on|y one
d|g|t changes as you |ncrement
or decrement the count
1he Gray code |s common|y
assoc|ated w|th |nput]output
dev|ces such as an opt|ca|
encoder of a shaft's angu|ar
pos|t|on
1he Gray code |s NC1 a 8CD
code
Decimal Gray code
0 00000
1 00001
2 00011
3 00010
4 00110
5 00111
6 00101
7 00100
8 01100
9 01101
10 01111
11 01110
12 01010
13 01011
14 01001
15 01000
16 11000
"&IZ
1. The Gray code is not a type of
BC code. (True or FaIse)
2. The most important
characteristic of the
____________ (BC, Gray code)
is that onIy one digit changes
state as you increment or
decrement the count.
3. The Gray code is commonIy
associated with input/output
devices such as an opticaI
encoder of a shaft's anguIar
position. (True or FaIse)
True
Gray code
True
1he ASCII Code
ASCII |s an acronym for Amer|can Standard
Code for Informat|on Interchange
kepresents numbers |etters punctuat|on
marks and contro| characters
Standard ASCII |s a 7b|t code (127 characters)
Lxtended ASCII (I8M ASCII) an 8b|t code |s
a|so very popu|ar
Lxtended ASCII adds graph|cs and math
symbo|s to code (tota| of 2S6 symbo|s)
"&IZ
1. A common 7-bit code used to
represent numbers, Ietters,
punctuation marks, and controI
characters is known by the
acronym __________.
2. The acronym ASCII stands for
__________________________.
3. Extended ASCII code is a(n)
__________ (8-bit, 10-bit)
code which adds graphic
and math symboIs to ASCII
for a totaI of 256 symboIs.
ASCII
American Standard
Code for
Information
Interchange
8-bit
EIectronic Encoder - ecimaI to BC
0
Decimal
to
BCD
Encoder
BCD output
Decimal input
0 0 0 0
S
0 1 0 1
7
0 1 1 1
3
0 0 1 1
Encoders are avaiIabIe in IC form.
This encoder transIates from
decimaI input to BC output.
Seven Segment D|sp|ays
C (Iiquid crystaI dispIay)
CommonIy dark characters on a siIvery background
Very Iow power consumption
Viewing onIy OK in good Iight
BackIighted dispIays can be viewed in Iow Iight
E (Iight emitting diode) dispIay
High power consumption
Viewing best under Iow Iight conditions
CommonIy red but avaiIabIe in other coIors
VF (vacuum fIuorescent) dispIay
CommonIy bIue-green dispIay (without fiIters)
Medium power consumption
Viewing good from dark to Iighter conditions
Based on vacuum tube triode technoIogy
"&IZ
1. The type of 7-segment dispIay based on vacuum tube
technoIogy which usuaIIy has bIue-green characters and can
be viewed in dark to Iighter conditions is the vacuum
fIuorescent dispIay (VF). (True or FaIse)
2. The type of 7-segment dispIay that shows dark characters on
a siIvery background, uses very IittIe power, and is good for
viewing in bright Iight is caIIed the Iiquid crystaI dispIay
(C). (True or FaIse)
3. The seven-segment E dispIay is best viewed in very bright
sunIight. (True or FaIse)
True
True
FaIse
7-Segment E ispIay Operation
imiting resistors
7segment ED display
(common anode)
H
b
c
H
H
H
H
+Sv
..
nputs
7segment code
Common anode
Cathode terminals (a thru g)
b S c inputs active
therefore
segments b S c
light on display
Note that inputs are
active"
7segment display
reads decimal 1
(segments b S c
are lit)
.
b
c
H
H
H
H
+Sv
a
g
nputs
7segment code
" #1- What will be the decimal output on the 7-segment LED display?
" #2- What is the decimaI output on the dispIay for the new set of inputs?
.
H
c
d
H
f
.
b
c
d
e
f
" #3- What is the decimaI output on the dispIay for the new set of inputs? " #4- What is the decimaI output on the dispIay for the new set of inputs?
H
b
c
H
H
f
g
"&IZ
BC-to-
7-Segment
ecoder/
river
ecoders: BC to
7-Segment ecoder/river
BCD input
0 0 0 0 0 0 0 0
Decimal output
ED
0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0
EIectronic decoders are avaiIabIe in IC form.
This decoder transIates from BC to decimaI.
ecimaIs are shown on an 7-segment E dispIay
This IC aIso drives the 7-segment E dispIay.
BC-to-
7-Segment
ecoder/
river
BC input
ecimaI output
0 0 1 1