ECE 2560 Introduction to Microcontroller-Based Systems Lecture 2
Digital Devices and : Binary and Hexadecimal Numbers
ECE 2560 Introduction to Microcontroller-Based Systems –
Copyright By PowCoder代写 加微信 powcoder
Last Time: Computers
We have distinguished between
• General-purpose computers – e.g., desktops, laptops
• Embedded computers – e.g., microcontrollers
Two things both classes have in common is: They are digital electronic computers
Digital computers process information in discrete form, Electronic computers as opposed to mechanical systems
Vacuumtubes➡ Transistors➡ MOSFET➡ IntegratedChips(IC)
➡ Quantumcomputers
➡ ??? ECE 2560 Introduction to Microcontroller-Based Systems –
in particular binary two values: 0 and 1
Analog vs Digital An analog signal takes a continuous range of values
Þ infinite set of possible values
A digital signal takes values from a finite set Often this finite set has only two possible values
aka logic signal
or binary signal
ECE 2560 Introduction to Microcontroller-Based Systems –
The Digital Revolution
The digital revolution changed human civilization
Agricultural Rev. Industrial Rev. Digital Rev.
~10,000 BCE ~1750-1850
Agricultural Industrial Age Age
What is the digital revolution?
• Transition from analog to digital technology
• Transistor (1947) Þ Integrated Circuits (IC)
• Digital signals and digital logic
• Digital communication Þ The Internet
Information Age
Þ Computers
YET digital signals are a big fat lie only an abstraction
ECE 2560 Introduction to Microcontroller-Based Systems –
Digital Signals
Physical digital signals do not exist – a digital signal is an abstraction
Does not exits as a physical signal
ECE 2560 Introduction to Microcontroller-Based Systems –
Digital Signals
When a mixed signal oscilloscope displays a digital signal it is an abstraction
ECE 2560 Introduction to Microcontroller-Based Systems –
Digital Signals
This makes digital signals very resilient to noise Digital signal is interpreted as
1 if (analog signal + noise) > blue voltage
0 if (analog signal + noise) < red voltage
Noise will have no effect as long as it is not too big
Listen to AM radio (analog) and HD radio and compare the sound quality
(Slightly) scratch a vinyl recording and a CD and see what happens ECE 2560 Introduction to Microcontroller-Based Systems –
Binary Numerals
Digital signals take two values: 0 and 1
Hardware can distinguish between two stable states:
• Transistor and capacitor (dynamic RAM)
• Flip-flops (static RAM)
• Magnetic material (HDD)
• Cells in solid-state drives (SSD)
Þ We have to learn to do everything with 0 and 1 only
Duh, they compute!
• Math – Numbers and operations Þ We have to re-learn to do
What do computers do?
math using 0 and 1 only ECE 2560 Introduction to Microcontroller-Based Systems –
• Logic – True/False
Numbers and Numeral Systems
A number is a mathematical object (abstraction) used to count and measure
Physical objects Mathematical abstraction There are multiple symbolic ways to express the number “five”
5 101 we use Numerals used
Tally marks
ECE 2560 Introduction to Microcontroller-Based Systems –
numerals in everyday life by computers
Numeral Systems
A numeral system is a mathematical notation for representing numbers
We focus on positional numeral systems where the value of the expressed number depends on numeral symbols (digits) and their position
decimal base-10
= 1x10 + 1x1 = 1x2 + 1x1
binary base-2
hexa- decimal
“eleven” “three”
= 1x16 + 1x1
ECE 2560 Introduction to Microcontroller-Based Systems –
“seventeen”
Decimal Numerals • Each position is a power of 10
Base 10 (“ten”)
• Digits0,1,2,...,9
Why base 10?
But we all know this!
ECE 2560 Introduction to Microcontroller-Based Systems –
Binary Numerals • Each position is a power of 2
Base 2 (“two”)
• Digits 0 and 1 Binary digit = bit
Why base 2?
8421 1⁄21⁄4
represents value
1x8+1x4+0x2+1x1+0x1⁄2+1x1⁄4 =13.25
Notation: (1011)2 0b1011 1011b ECE 2560 Introduction to Microcontroller-Based Systems –
Binary to Decimal Conversion
ECE 2560 Introduction to Microcontroller-Based Systems –
Decimal to Binary Conversion
e.g. 41 = 32 + 8 + 1 More systematically:
321684 2 1
What about 52579? Bookmark your favorite decimal-to-binary converter!! ECE 2560 Introduction to Microcontroller-Based Systems –
Hexadecimal Numerals
Base 16 (“sixteen”)
• Each position is a power of 16
• Digits0,1,2,...,9,A,B,C,D,E,F
Why base 16?
represents value
256 16 1 0x 3AD
3x256 + 10x16 +13x1 = (941)10 in binary
0011 1010 1101
0x3 0xA 0xD
ECE 2560 Introduction to Microcontroller-Based Systems –
Hexadecimal to Binary
One hexadecimal digit encodes four bits (i.e., four binary digits)
ECE 2560 Introduction to Microcontroller-Based Systems –
Hexadecimal ↔ Binary 6FB
1011000111
Bookmark your favorite number converter!!
ECE 2560 Introduction to Microcontroller-Based Systems –
Operations with Binary Numerals We can easily add two binary numbers
107 + 210 317
ECE 2560 Introduction to Microcontroller-Based Systems –
Operations with Binary Numerals We can easily multiply two binary numbers
ECE 2560 Introduction to Microcontroller-Based Systems –
Operations with Binary Numerals
We can subtract two binary numbers – as long as the result is not negative At this point we do not know how to represent negative numbers with 0 and 1 Next time: 1’s complement, 2’s complement, signed numbers ...
ECE 2560 Introduction to Microcontroller-Based Systems –
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com