Introduction To Microprocessors: Topic 1 Microprocessor Fundamentals
Introduction To Microprocessors: Topic 1 Microprocessor Fundamentals
Topic 1
Microprocessor Fundamentals
Objectives
• Understand the difference between
microprocessors, microcontrollers, and
microcomputers
• Review of number systems and conversions
• Understand the development process
• Understand the numbering system and selection
of various AVR ICs
• Examine some Internet resources
1/15/2009 2
Microprocessor
• A Microprocessor is a single integrated circuit
(IC) that accepts and executes coded instructions
(machine code or machine language) for the
purpose of manipulating data and controlling the
associated circuitry (RAM, ROM, and I/O ICs) in
a digital system.
1/15/2009 3
Microcomputer
• A Microcomputer is an integrated system of computer
components typically containing data storage ICs, mass
storage elements, and standard I/O devices, capable of a
wide variety of applications. Microcomputers contain a
microprocessor at the heart of the system, controlling
data flow, manipulating data, and executing instructions.
• Data storage ICs: RAM, ROM, and I/O
• Mass storage elements: External Drives, Hard Drives,
CD-ROM Drives
• Standard I/O devices: High resolution monitor, keyboard,
mouse, printer, etc.
1/15/2009 4
Microcontroller
• A Microcontroller is also a single integrated circuit that
accepts and executes coded instructions for the purpose
of manipulating data and controlling a digital system
similar to a microprocessor.
• The difference between a microcontroller and a
microprocessor is that the microcontroller also contains
RAM, ROM, and I/O circuitry in that single IC package.
• This allows miniaturization of single application,
microprocessor controlled, digital systems because the
required associated circuitry is contained within the
integrated circuit of a microcontroller.
1/15/2009 5
Microcontroller
• Its construction and integration of common
computer circuits make the microcontroller ideal
for single function, programmable, control
systems such as those found in:
– Microwave Ovens, Dishwashers, Washing Machines
– Cell Phones, iPODs, other MP3 devices
– PDAs, watches
– Automobiles, GPS Systems
– House Alarm Systems,
– and many other household and industrial applications.
1/15/2009 6
A “short list” of embedded systems
Anti-lock brakes Modems
Auto-focus cameras MPEG decoders
Automatic teller machines Network cards
Automatic toll systems Network switches/routers
Automatic transmission On-board navigation
Avionic systems Pagers
Battery chargers Photocopiers
Camcorders Point-of-sale systems
Cell phones Portable video games
Cell-phone base stations Printers
Cordless phones Satellite phones
Cruise control Scanners
Curbside check-in systems Smart ovens/dishwashers
Digital cameras Speech recognizers
Disk drives Stereo systems
Electronic card readers Teleconferencing systems
Electronic instruments Televisions
Electronic toys/games Temperature controllers
Factory control Theft tracking systems
Fax machines TV set-top boxes
Fingerprint identifiers VCR’s, DVD players
Home security systems Video game consoles
Life-support systems Video phones
Medical testing systems Washers and dryers
7
Embedded systems are everywhere
• In 2000, more than a quarter billion, 8-bit
embedded processors were being sold each
month (http://www.extremetech.com/article2/0,3973,18917,00.asp)
8
Embedded systems are everywhere
• The average middle-class American household has
about 40 to 50 microprocessors in it - plus another 10
processors for every PC
(http://www.extremetech.com/article2/0,3973,18917,00.asp)
9
Embedded systems are everywhere
• There's a microprocessor in your:
• An automatic garage door opener (and each remote
control) also contains a microprocessor
• The average new car has a dozen
– BMW 7-series has 63
– Mercedes S-class has 65
• Every modern car has electronic ignition
– Ford, Jaguars and Volvos, use a PowerPC to control the engine
• Automatic transmissions and Antilock brakes are
microprocessor controlled as well
10
Embedded systems are everywhere
• Got a Volvo?
– The processor in its automatic transmission communicates
with the processors behind each side-view mirror.
– Allows the outside mirrors to automatically tilt down and
inward whenever you put car into reverse gear, the better to
see the back end of the car
11
Embedded systems are everywhere
• The Additional Processors in Your PC
– There's an 8-bit processor in your keyboard
– Another processor in your mouse
– There’s one in each hard disk drive and floppy drive
(if you still have one)
– One in your CD-ROM
– A big one in your graphics accelerator
– A CPU buried in your USB interface
– A processor handling your NIC
12
Common characteristics of embedded systems
• Single-functioned
– Executes a single program, repeatedly
• Tightly-constrained
– Low cost, low power, small, fast, etc.
• Reactive and real-time
– Continually reacts to changes in the system’s environment
– Must compute certain results in real-time without delay
• Programmed in C or Java
13
NUMBER SYSTEMS
1/15/2009 14
Number Systems
• So, why do we need to understand the different
numbering systems and how to convert between
them?
– Humans (including programmers and engineers) think
in decimal (at least early on in their education they do)
– When working with I/O to control devices, we are
looking at individual bits or bit streams
– Large binary numbers are difficult to read, its easier to
use some form of short-hand: hexadecimal (and
sometimes octal)
1/15/2009 15
Number Systems
Decimal Hexadecimal Binary Octal
0 00 00000000 000
1 01 00000001 001
2 02 00000010 002
3 03 00000011 003
4 04 00000100 004
5 05 00000101 005
6 06 00000110 006
7 07 00000111 007
8 08 00001000 010
9 09 00001001 011
10 0A 00001010 012
11 0B 00001011 013
12 0C 00001100 014
13 0D 00001101 015
14 0E 00001110 016
15 0F 00001111 017
16 10 00010000 020
17 11 00010001 021
1/15/2009 16
Conversions
• Decimal to Hexadecimal:
Ex: convert 4010 to hex:
We only need a 2 digit number to express 40 in hex:
40 16 = 2.5 or 2 r8 2-
8 is too small to be divided by 16: 28
1/15/2009 17
Conversions
• Decimal to Hexadecimal:
Ex: convert 21010 to hex:
1/15/2009 18
Conversions
• Decimal to Hexadecimal:
Ex: convert 21010 to hex:
We only need a 2 digit number to express 210 in hex:
210 16 = 13.125 or 13 r2
(13 in decimal is D in hex) D-
2 is too small to be divided by 16: D2
1/15/2009 19
Conversions
• Hexadecimal to Decimal :
Ex: convert E7 to decimal:
E * 161 + 7 * 160 =
14 * 161 + 7 * 160 =
224 + 7 = 231
1/15/2009 20
Conversions
• Hexadecimal to Decimal :
Ex: convert 2C to decimal:
1/15/2009 21
Conversions
• Hexadecimal to Decimal :
Ex: convert 2C to decimal:
2 * 161 + C * 160 =
2 * 161 + 12 * 160 =
32 + 12 = 44
1/15/2009 22
Conversions
• Decimal to Binary:
Ex: convert 4010 to binary:
40 2 = 20, r 0 0
20 2 = 10, r 0 00
10 2 = 5, r 0 000
5 2 = 2, r 1 1000
2 2 = 1, r 0 01000
1 2 = 0, r 1 101000
1/15/2009 23
Conversions
• Decimal to binary:
Ex: convert 15510 to binary:
1/15/2009 24
Conversions
• Decimal to binary:
Ex: convert 15510 to binary:
155 2 = 77, r 1 1
77 2 = 38, r 1 11
38 2 = 19, r 0 011
19 2 = 9, r 1 1011
9 2 = 4, r 1 11011
4 2 = 2, r 0 011011
2 2 = 1, r 0 0011011
1 2 = 0, r 1 10011011
1/15/2009 25
Conversions
• Binary to Decimal :
Ex: convert 10011101 to decimal:
1 * 27 + 0 * 26 + 0 * 25 + 1 * 24 + 1 * 23 + 1 * 22 + 0 * 21 + 1 * 20 =
128 + 0 + 0 + 16 + 8 + 4 + 0 + 1 =
157
1/15/2009 26
Conversions
• Binary to Decimal :
Ex: convert 11101101 to decimal:
1/15/2009 27
Conversions
• Binary to Decimal :
Ex: convert 11101101 to decimal:
1 * 27 + 1 * 26 + 1 * 25 + 0 * 24 + 1 * 23 + 1 * 22 + 0 * 21 + 1 * 20 =
128 + 64 + 32 + 0 + 8 + 4 + 0 + 1 =
237
1/15/2009 28
Conversions
• Hex to binary:
Ex: convert 3F16 to binary:
3 = 0011, F = 1111
3F = 00111111
1/15/2009 29
Conversions
• Hex to binary:
Ex: convert F716 to binary:
1/15/2009 30
Conversions
• Hex to binary:
Ex: convert F716 to binary:
F = 1111, 7 = 0111
F7 = 11110111
1/15/2009 31
Conversions
• Binary to Hex :
Ex: convert 10011101 to hex:
1001 = 9, 1101 = D
10011101 = 9D
1/15/2009 32
Conversions
• Binary to Hex:
Ex: convert 11101101 to hex:
1/15/2009 33
Conversions
• Binary to Hex:
Ex: convert 11101101 to hex:
1110 = E, 1101 = D
11101101 = ED
1/15/2009 34
Conversions
• Conversions:
– You need to be able to do this with and without a
calculator
– Many conversions have to be done quickly, on-the-fly
– Used to verify data or I/O
1/15/2009 35
DEVELOPMENT PROCESS
1/15/2009 36
Development Process
1. Gather and verify all project requirements and specifications
2. Layout a plan for your program
1. Pseudo-code, algorithm, or flowchart (maybe all 3)
3. Choose a target processor or controller
4. Write the program using a text editor or an Integrated
Development System (IDS)
5. Assemble the program
1. Remove syntax errors and re-assemble until all errors are removed
Continued……
1/15/2009 37
Development Process
6. Simulate the program in the IDS
1. Remove all logic errors
2. Go to step 4 and repeat 4 & 5 until all logic errors are removed
7. Program the AVR
1. Remove errors:
1. Example: Target range of addresses could be incorrect
2. Example: Expected support ICs may be missing
3. Go to step 4 and repeat 4, 5, & 6 until all errors are removed
8. Test the program on the hardware
1. Remove errors:
1. Example: I/O port addresses may be incorrect
2. Example: Logic for interfaced hardware may be incorrect
3. Example: Timing may be incorrect
4. Go to step 4 and repeat 4, 5, 6, & 7 until all errors are removed
* The various books for this class have slightly different steps
1/15/2009 38
Choosing an AVR
• The IC number tells us some things (but not all):
AT90S1200
SRAM memory size
CPU Model #
EEPROM data memory size
1 kB of Flash Program memory
May also need to know the number of total pins, the pinout of the IC, the number
of I/O pins (and registers), other features
1/15/2009 39
Choosing an AVR
• May also need to know:
– The number of total pins,
– The pinout of the IC,
– The number of I/O pins (and registers),
– And other features
• Have to look it up
– Good place to start:
– Appendix A in Morton book
– http://www.avrfreaks.net/
– http://www.atmel.com
1/15/2009 40
Summary
• In this topic we:
– Discussed the difference between microprocessors,
microcontrollers, and microcomputers
– Reviewed number systems and conversions
– Discussed the development process
– Discussed the numbering system and selection of
various AVR ICs
– Examined some Internet resources
1/15/2009 41