Professional Documents
Culture Documents
PROGRAMMABLE
CIRCUITS AND
MICROCONTROLLERS
These are lecture notes to accompany the books:
Mohammad Ali Mazidi, The 8051 Microcontroller and embedded
•
systems.2006
Milan Verle, PIC Microcontrollers - Programming in C, 2009
•
Course Outline
2
Ex 1:
Convert (11001)2 to Decimal:
Weight: 16 8 4 2 1
Digits: 1 1 0 0 1
Sum: 16+ 8+ 0+ 0+ 1=2510
Converting form Binary to Decimal
10
Ex2:
Convert (110110.01)2 to Decimal
1 x 2-2 =0.25
0 x 2-1 =0
0 x 20 =0
1 x 21 =2
1 x 22 =4
0 x 23 =0
1 x 24 =16
1 x 25 =32
Sum= (54.25)10
Converting form Decimal to Binary
11
Ex 3:
Convert (25)10 to Binary.
Quotient Reminder
25/2 = 12 1 (LSB)
12/2= 6 0
6/2= 3 0
3/2= 1 1
½= 0 1 (MSB)
Therefore (25)10 is (11001)2
Hexadecimal System
12
Two ways:
1- Convert to binary then to hex
Convert directly to hex, by repeated division by
16 and keep tracking the reminder.
Converting from decimal to hex
17