Fundamentals of Microprocessor and Microcontroller: Dr. Farid Farahmand
Fundamentals of Microprocessor and Microcontroller: Dr. Farid Farahmand
Fundamentals of Microprocessor and Microcontroller: Dr. Farid Farahmand
A little History
What is a computer?
[Merriam-Webster
Dictionary] one that computes; specifically : programmable electronic device that can store, retrieve, and process data. [Wikipedia] A computer is a machine that manipulates data according to a list of instructions.
Mainframes
Massive amounts of memory Use large data words64 bits or greater Mostly used for military defense and large business data processing Examples: IBM 4381, Honeywell DPS8
Personal Computers
built using Very-LargeScale Integration technology; the entire circuit is on a single chip Central Processing Unit (CPU) Microprocessor Unit (MPU) similar to CPU
Microprocessor
http://en.wikipedia.org/wiki/Personal_computer
Supercomputers
Contain multiple central processors (CPU) Used for scientific applications, and number crunching Now have teraflops performance
FLoating Point Operations Per Second (FLOPS) Used to measure the speed f the computer
Belle, Deep Blue, and Hydra, for playing chess Reconfigurable computing machines or parts of machines GRAPE, for astrophysics and molecular dynamics Deep Crack, for breaking the DES cipher MDGRAPE-3, for protein structure computation
http://en.wikipedia.org/wiki/Supercomputer
Microcontrollers
Embedded Systems
An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions often with real-time An integrated device which consists of multiple devices
Evolution
SSI (Small-Scale Integration) to ULSI Very Large Scale Integration circuits (VLSI) Microcomputers (with CPU being a microprocessor) Components: Memory, CPU, Peripherals (I/O) Example: Personal computers
1- Microprocessors (MPU)
2- Microcontroller (MCU)
Microcomputers (with CPU being a microprocessor) Many special function peripheral are integrated on a single circuit Types: General Purpose or Embedded System (with special functionalities)
Microprocessor-Based Systems
Central Processing Unit (CPU) Memory Input/Output (I/O) circuitry Buses Address bus Data bus Control bus
MPU
CLK
GPCPU
Reg
Control Unit
Microprocessor-based Systems
Microprocessor
The
microprocessor (MPU) is a computing and logic device that executes binary instructions in a sequence stored in memory. Characteristics:
General Binary Register-based Clock-driven Programmable
Microprocessor-based Systems
Microprocessor
Arithmetic Register Logic Arrays Unit its job is to fetch instructions, decode them, and then execute them 8/16/32/etc bit (how it moves the data
Control Unit
ALU performs computing tasks manipulates the data/ performs numerical and logical computations Registers are used for temp. storage Control unit is used for timing and other controlling functions contains a program counter (next instructions address and status register)
System software: A group of programs that monitors the functions of the entire system
Evolution of CPUs
Transistors
Vacuum Tubes: A devise to control, modify, and amplify electric signals Then can transistors Designed by John Bardeen, William Shockley, and Walter Brattain, scientists at the Bell Telephone Laboratories in Murray Hill, New Jersey - 1947 In 1960 Jack Kilby and Robert Noyce designed the first integrated circuit (IC) Fairchild company manufactured logic gates
Integrated Circuits
Advances in manufacturing allowed packing more transistors on a single chip Transistors and Integrated Circuits from SSI (Small-Scale Integration) to ULSI Birth of a microprocessor and its revolutionary impact
Microprocessors
Noyce and Gordon Moore started Intel Intel designed he first calculator Intel designed the first programmable calculator Intel designed the first microprocessor in 1971 Model 4004 4-bit; 2300 transistors, 640 bytes of memory, 108 KHz clock speed
First Processors
Intel released the 8086, a 16-bit microprocessor, in 1978 Motorola followed with the MC68000 as their 16bit processor The 16-bit processor works with 16 bit words, rather than 8 bit words Instructions are executed faster Provide single instructions for more complex instructions such as multiply and divide 16 bit processors evolved into 32 bit processors Intel released the 80386 Motorola released the MC68020
Evolution of CPUs
In 1965, Gordon Moore, co-founder of Intel, indicated that the number of transistors per square inch on integrated circuits had doubled every year since the integrated circuit was invented. Moore predicted that this trend would continue for the foreseeable future.
Evolution of CPUs
Tukwila World's First 2-Billion Transistor Microprocessor - Next-generation Intel Itanium processors (codenamed Tukwila)
http://www.intel.com/technology/architecture-silicon/2billion.htm
Remember
Microprocessor-based Systems
Memory
16 register address: 0-15 in binary: 01111; Address lines: A0-A3 storing the binary codes for the sequence of instructions specified by programs (program) storing binary data that the computer needs to execute instructions (data)
Microprocessor-based Systems
Memory Types
R/W:
It is volatile (losses information as power is removed) Write means the processor can store information Read means the processor can receive information from the memory Acts like a Blackboard! ROM: Read-Only memory; It is typically non-volatile (permanent) can be erasable It is similar to a Page from your textbook
Microprocessor-based Systems
Memory Classification
Basic Technologies: Semiconductor Magnetic Optical (or combination)
Expensive Fast/
Cheap Slow
Expensive Fast/
Cheap Slow
Erasable ROMs
Programmed by the manufacturer Can be programmed in the field via the programmer Uses ultraviolet light to erase (through a quartz window) OTP refers to one-time programmable Each program location can be individually erased Expensive Requires programmer Can be programmed in-circuit (in-system) Easy to erase (no programmer) Only one section can be erased/written at a time (typically 64 bytes at a time)
Programmable ROM (PROM) Erasable Programmable ROM (EPROM) Electrically Erasable Programmable ROM (EEPROM)
FLASH
Microprocessor-based Systems
I/O Ports
The way the computer communicates with the outside world devices I/O ports are connected to Peripherals
Input devices Output devices Printers and modems, keyboard and mouse scanner Universal Serial Bus (USB)
Examples
The three components MPU, memory, and I/O are connected by a group of wires called the BUS
Address bus
consists of 16, 20, 24, or 32 parallel signal lines (wires) - unidirectional these lines contain the address of the memory location to read or written consists of 4 to 10 (or more) parallel signal lines CPU sends signals along these lines to memory and to I/O ports examples: Memory Read, Memory Write, I/O Read, I/O Write consists of 8,16, or 32 parallel signal lines bi-directional only one device at a time can have its outputs enabled, this requires the devices to have three-state output
Control bus
Data bus
First Microcontrollers
IBM started using Intel processors in its PC Intel started its 8042 and 8048 (8-bit microcontroller) using in printers Apple Macintosh used Motorola 1980 Intel abandoned microcontroller business By 1989 Microchip was a major player in designing microcontrollers PIC: Peripheral Interface Controller
Embedded controllers
Used to control smart machines Examples: printers, auto braking systems Also called microcontrollers or microcontroller units (MCU)
Embedded controllers
Software Characteristics
No operating systems Execute a single program, tailored exactly to the controller hardware Assembly language (vs. High-level language) Not transportable, machine specific Programmer need to know CPU architecture Speed Program size Uniqueness
An integrated electronic computing and logic device that includes three major components on a single chip
Microprocessor Memory I/O ports Timers A/D converter Serial I/O Parallel Slave Port
All components connected by common communication lines called the system bus.
MCU Architecture
RISC (Harvard) Reduced instruction set computer Simple operations Simple addressing modes Longer compiled program bust faster to execute Uses pipelining CISC (Von Neuman) Complex instruction set computer More complex instructions (closer to highlevel language support)
Bench marks: How to compare MCUs together MIPS: Million Instructions / second (Useful when the compilers are the same)
Microchip
RISC architecture (reduced instruction set computer) Has sold over 2 billion as of 2002 Cost effective and rich in peripherals CISC architecture Has hundreds of instructions Examples: 68HC05, 68HC08, 68HC11 CISC architecture Has hundreds of instructions Examples: 8051, 8052 Many difference manufacturers: Philips, Dallas/MAXIM Semiconductor, etc. RISC architecture (reduced instruction set computer) Cost effective and rich in peripherals AVR
Motorola
Intel
Atmel
Lets continue..
Numbering system Data format
Memory operation
System Software (hardware/Software) Example of a microprocessor / microcontroller based
Memory
A semiconductor storage device consisting of registers that store binary bits Two major categories
Read/Write
Addresses
Registers
What is the address bus value? PORT A = 8000H PORT B = 8001H
All
Difficult
High-level Language
one-to-one correspondence with machine instructions Efficient in execution and use of memory; machine-specific and not easy to troubleshoot
High-level Language
Unsigned
Signed
Unsigned Integers: All eight bits (Bit0 to Bit7) represent the magnitude of a number
Range
Unsigned
Signed
Signed Integers: Seven bits (Bit0 to Bit6) represent the magnitude of a number.
The
eighth bit (Bit7) represents the sign of a number. The number is positive when Bit7 is zero and negative when Bit7 is one. Positive numbers: 0 to 7F (0 to 127) Negative numbers: 80 to FF (-1 to -128) All negative numbers are represented in 2s complement
bits of a number divided into groups of four, and each group represents a decimal digit from 0 to 9 Four-bit combinations from A through F in Hex are invalid in BCD numbers
Example: 0010 0101 represents the binary coding of the decimal number 25d which is different in value from 25H.
alphanumeric code with 128 combinations (00 to 7F) Represents English alphabet, decimal digits from 0 to 9, symbols, and commands
In an 8-bit RAM
Each byte is stored in a single memory register Each word is stored in two memory locations (registers) DATA 0x1234
What if we want to store -8? Remember -8111 1000 (in twos complement)
Design Examples ..
References
Read about microcontrollers: http://www.mikroe.com/en/books/picbook/2_01chapter.htm Lots of good information exist on Wikipedia about microcontrollers http://en.wikipedia.org/wiki/ History of transistors: http://inventors.about.com/library/weekly/aa061698.htm Nice transistor timeline by Intel: http://www.intel.com/technology/timeline.pdf I used a few slides from here: http://www.ceng.metu.edu.tr/courses/ceng336/_documents/introduct ion.pdf