Professional Documents
Culture Documents
Microcontrollers: Lecture 1: Binary Review
Microcontrollers: Lecture 1: Binary Review
Microcontrollers: Lecture 1: Binary Review
9
Hex to Decimal
(87C9)16 = (???)10
x 83 x 72 x C x 90
16 16 161 16
32,768 + 1792 + 192 + 9
(87C9)16 = (34,761)10
10
100101012 = ? (decimal)
12
Problems
85710 = ?16
13
Problems
BED16 = ?2
14
Addition
15
Overflow
18
• N = 0110 0101
• Flipped = 1001 1010
+ 1
---------------
1001 1011 1001 1011
0110 0100
-N +1
---------------
0110 0101
N
Subtraction example
-35 11011101
Unsigned Range:
0 to 2𝑛 − 1 Why?
2𝑛 − 1 − 0 + 1 = 2𝑛
Verify how many numbers can be represented in each case
Signed Range:
−2𝑛−1 to +(2𝑛−1 − 1)
Why?
Try 𝑛 = 3
• Unsigned range: 0 to 7 = 23 − 1
✓000 001 010 011 100 101 110 111
✓0 1 2 3 4 5 6 7
• Signed range:
➢000 001 010 011 100 101 110 111
➢0 1 2 3 ? ? ? ?
Table 2.2
Positive and Negative Binary Numbers
23
4-bit: 8H = -8 to 7H = +7
1000 to 0111
24
25
ASCII
Unicode
Utf-8, 16
28
29
30
• https://www.w3schools.com/charsets/ref_html_utf8.asp
• https://stackoverflow.com/questions/643694/what-is-the-difference-
between-utf-8-and-unicode