Digital Electronics & Microprocessors Lecture 3: … file- Intel 8051, 4k ROM, 128b RAM, 32 I/O,...

Preview:

Citation preview

Dr. Mohamed A. MoustafaA. Professor of Control & Computer Engineering

Cairo University

Digital Electronics & Microprocessors

Lecture 3: Introduction

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 2

Computer Data Processing

Data Storage

What is Computer ?

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 3

Major Components of a Computer

Computer

CPU

MEMORYI/O SYSTEM

BUS

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 4

What is Microprocessor ?

CPU

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 5

Past Microprocessors ...1971 - Intel 4004, 1st single chip CPU, 4-bit processor1972 - Intel 4040, enhanced 4004, 60 instructions1972 - Intel 8008, 8-bit P1972 - Texas Instrument TMS 1000, 1st single C, 4-bit1974 - Intel 8080, successor to the 8008, used in Altair 88001975 - Motorola 6800, used MOS technology1976 - Intel 8085, updated 8080, +5V power supply1976 - Zilog Z80, improved 80801976 - TI TMS 9900, 1st 16-bit P1978 - Zilog Z8000, Motorola 68000, 16-bit P1978 - Intel 8086, 16-bit, IBM’s choice...

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 6

What is Microcontroller ?

CPU

MEMORY

I/O SYSTEM BUS

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 7

Past Microcontrollers ...1972 - Texas Instrument TMS 1000, 1st single C, 4-bit1976 - Intel 8048, 8-bit C, 1k ROM, 64b RAM, 27 I/O 1980 - Intel 8051, 4k ROM, 128b RAM, 32 I/O, 2 16-bits timers1980s(MCS-51 family)- Intel 8031, 8052, 8751, …- Atmel AT89C51, AT 89C1052/2051,…- Dallas Semiconductor DS5000 series…- Philips, National Semiconductor, ...(Other Cs)Microchip PIC16 series, Motorola 68HC11, Zilog’s Z86

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 8

General Structure of a C

CPU

SerialInterface

ParallelInterface

I/OInterruptControl

RAM ROM

Memory

Timers/ Counters

Internal address, data, & control buses

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 9

Major 8-bit Micro-controllers

Intel 8051

Motorola 68HC11

Zilog Z86

Microchip PIC16XX

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 10

Microprocessor System Vs Microcontroller System

CPU

GeneralpurposeMicro

processor

Data Bus

Address Bus

RAM ROM I / OPort

TimerSerialCOMPort

CPU RAM ROM

I / OPort

TimerSerialCOMPort

General-Purpose Microprocessor System Microcontroller

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 11

Microprocessor System Vs Microcontroller SystemP C

HardwareArchitecture

Single-chip CPURAM-ROM ratio highInterrupt, I/O, Timer –external.Not much on Real-time

Single-chip ICROM-RAM ration highInterrupt, I/O, timer-InternalNeed to respond to Real time

Application Microcomputer systemProcessing information

Control – oriented activitiesControl of I/O devices

Instructionset

Process intensive to handleLarge volume of dataOperates on byte, words,pointers, and arrays.Longer development timeANDing, ORing, XORing inbit level is less easy

Control intensive to handleI/O using single BitOperates mostly on Bit & byte

shorter development timeANDing, ORing, XORing inbit level is easy

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 12

What is CPU ?The Central Processing Unit (or P)

Control Unit & Instruction Decoder

Arithmetic/Logic Unit

Registers

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 13

Control Unit & Instruction Decoder

Arithmetic/Logic Unit

Registers

To decode instruction and

pass the necessary control signals to CU

To synchronize and control the

overall operation of the P system

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 14

Control Unit & Instruction Decoder

Arithmetic/Logic Unit

Registers

To perform the arithmetic and logical operations within the CPU

To perform shift and rotate operations that may either be arithmetic or logical in nature

3/26/2009 Microprocessors & Microcontrollers Dr. M. Moustafa 15

Control Unit & Instruction Decoder

Arithmetic/Logic Unit

Registers

• Control and Status Registers• User-Variable Registers

A set of internal storagelocations within the CPU

BJ Furman SJSU MAE

Computer History

• Abacus– c. 500 BC – 1200 AD

• Mechanical calculating ‘engines’– Blaise Pascal 1642 (adder)– Gottfried Wilhelm von Leibniz 1694 (add

and multiply)

http://www.ee.ryerson.ca:8080/~elf/abacus/

http://www-history.mcs.st-andrews.ac.uk/history/Bookpages/Leibniz_machine.jpeg

BJ Furman SJSU MAE

Computer History, cont.

• Mechanical calculating ‘engines’, cont.– Charles Babbage c. 1822

• Difference engine– Calculation by fixed instruction program

• Analytical engine– Forerunner of the modern computer

– Never realized due to lack of precision machining capability

– Herman Hollerith 1889• Punched card tabulator for US Census bureau• Electromechanical (relays)

http://mycetes.pwp.blueyonder.co.uk/babbage/Fragment_Photo.JPG

BJ Furman SJSU MAE

Computer History, cont.

• Electronic Digital Computer– John P. Eckert and John W. Mauchly c. 1942 at

Univ. Pennsylvania• ENIAC

– WWII artillery calculations• “18,000 vacuum tubes, about 1,800 square feet of floor

space, and consumed about 180,000 watts of electrical power” (http://www.softlord.com/comp/, 04SEP04)

• Fast “look-up” calculation– 2, 10 digit number multiplication in 200 microseconds

– John Von Neumann c. 1945• Computer ‘architecture’

– Stored program– Subroutines

BJ Furman SJSU MAE

Miniaturizing the Computer

• The transistor– John Bardeen, Walter Brattain,

and William Shockley c. 1947– Shockley Semiconductor c. 1956

in Palo Alto– “Traitorous 8” start Fairchild

Semiconductor c. 1957– Jack Kilby (TI) and Robert

Noyce invent the IC c. 1959

• Magnetic core memory– c. 1952

http://www.fortunecity.com/marina/reach/435/coremem.htm

http://www.101science.com/transistor.htm

BJ Furman SJSU MAE

The Microprocessor

• Intel (“Integrated Electronics) c. 1969– Robert Noyce, Gordon Moore, Andrew

Grove leave Fairchild Semiconductor– Busicom’s desire for high-performance

calculator chips (12)• Ted Hoff’s idea to instead design a single-chip,

general purpose logic device– Intel 4004 microprocessor– The rest is …

http://www.antiquetech.com/chips/4004.htmhttp://www.cedmagic.com/history/intel-4004.html

BJ Furman SJSU MAE

Moore’s Law

• Doubling of the number of transistors per square inch every 18 months

ftp://download.intel.com/intel/intelis/museum/research/arc_collect/history_docs/pdf/original+graph.pdf

BJ Furman SJSU MAE

Microprocessors and Microcontrollers

• Microprocessor– “A central processing unit (CPU) fabricated on one

or more chips, containing the basic arithmetic, logic, and control elements of a computer that are required for processing data”(http://www.intersil.com/digital/glossary.asp, 04SEP04)

• Microcontroller– A single-chip computer system usually comprising

a CPU, memory, input/output ports, and often, timers, counters, analog-to-digital converters (ADC), etc. used for control applications

BJ Furman SJSU MAE

Microcomputer Architecture

http://www.engr.colostate.edu/~dga/mechatronics/figures/7-1.gif

BJ Furman SJSU MAE

Components of a Microcontroller

http://www.engr.colostate.edu/~dga/mechatronics/figures/7-2.gif

BJ Furman SJSU MAE

ATmega128 Microcontroller

Pin numberPin name

Special function

Source: http://www.atmel.com/dyn/resources/prod_documents/doc2467.pdf

Note the limitations!

p. 322

BJ Furman SJSU MAE

Atmel STK501

http://www.circuitcellar.com/library/print/1002/eady147/p2.htm

Adapter for the ATmega 128 Chip

BJ Furman SJSU MAE

Atmel STK500

Source: http://www.rfsource.gr/product/micro/STK500/stk500_en.htm

Universal Evaluation Board for Atmel AVR MicrocontrollersMomentary

switches(8 ea.)

LED (8 ea.)

Ports A-Eheader pins

PrimaryRS-232

LED header pins

SpareRS-232

switch header pins

BJ Furman SJSU MAE

Binary and Hexadecimal Numbers - 1

• Microcontrollers are fundamentally digital (as opposed to ‘analog’) and use binary logic– Two states: high and low, 1 or 0, on or off

• Often 5V or 0V– One binary digit is called a bit

• It can take on two possible states: 1 or 0– Eight binary digits is called a byte– Four binary digits is called a nibble

BJ Furman SJSU MAE

Binary and Hexadecimal Numbers - 2

1 1 0 0 1 1 0 1

7 6 5 4 3 2 1 0Bit No.

Lower nibbleUpper nibble

BJ Furman SJSU MAE

Binary and Hexadecimal Numbers - 3

1 1 3 8Base 10

11388301001000108103101101 0123

=+++×+×+×+×

1 1 0 1Base 2

13104821202121 0123

=+++×+×+×+×

Base 10

BJ Furman SJSU MAE

Binary and Hexadecimal Numbers - 3

0 0 0 0 0

0 0 0 1 1

0 0 1 0 2

0 0 1 1 3

0 1 0 0 4

0 1 0 1 5

0 1 1 0 6

0 1 1 1 7

1 0 0 0 8

1 0 0 1 9

1 0 1 0 A

1 0 1 1 B

1 1 0 0 C

1 1 0 1 D

1 1 1 0 E

1 1 1 1 F

HEXBinary

BJ Furman SJSU MAE

CPU

• What is it?– The “brains” of the controller

• Consists of:– Control unit

• Handles timing and sequencing of operations• Fetches instructions, decodes instructions, executes

instructions, stores results– Arithmetic Logic Unit (ALU)

• Carries out data manipulation– Registers

• Temporary data storage locations

BJ Furman SJSU MAE

Memory

• Random Access Memory (RAM)– Volatile– Fast

• Read-only Memory (ROM)– PROM– EPROM– EEPROM

• Configuration data infrequently changed• Slow, 10’s of ms• Byte addressable

– FEPROM (flash)• Program storage

– Ex. Atmega128 has 128k of flash memory for program storage– Programmed in blocks– 10,000 (minimum) write cycle life

BJ Furman SJSU MAE

I/O

• Data exchange with external world– Sensors (data IN)– Actuators (data OUT)– Communications

• Displays• Serial data

• Examples:– Atmega128 data sheet– Motorola 68HC11 data sheet

From Stepper Motor Driving by H. Sax (ST app note AN235/0788

BJ Furman SJSU MAE

Timer/Counter

• Registers to capture clock cycles and count pulses for timing and counting functions– Generating signals with precise timing, e.g. square wave,

PWM signals• Interrupts

– Event timing– Examples

• Encoder position sensing• Voltage to frequency decoding

• Clock signal– External crystal or onboard oscillator system sets the “beat”

and synchronizes all operations• Ex. Atmega128, 32 kHz – 8 MHz

BJ Furman SJSU MAE

Analog-to-Digital Converter

• Continuously varying values to discrete (digital levels)

• Number of channels• Number of bits

BJ Furman SJSU MAE

Busses

• The sets of internal conductors that connect the pieces of the microcontroller together

• Address bus– Carries the address of a location in memory or I/O– Width (number of conductors) determines how many memory

locations can be addressed» Ex. 68HC11 address bus is 16 bits => ? addresses

• Data bus– Carries data to and from memory or I/O ports– Width (number of conductors) determines the size of the

microcontroller, e.g. an 8-bit microcontroller• Control bus

– Carries control signals to memory and peripherals (timers, A/D, serial I/O, etc.), e.g. R/W, IRQ

BJ Furman SJSU MAE

History

• Intel 8048– Magnavox Odyssey video game and and in the

original IBM PC keyboard• Intel 8051 c. 1980

– Harvard architecture• Separate program and data memory structures accessed by

separate sets of conductors (busses)• Can fetch program and data in parallel (speed advantage)

– Boolean processing engine for efficient bit operations on internal registers and RAM

– Widely used (still)!• IBM PC keyboard controller• Programmable logic controllers

BJ Furman SJSU MAE

History, cont.

• Intel 80186 and 80188 c. 1982– Microcontroller version of the 8086/8088

microprocessors (IBM PC)

• Motorola 68HXXX– von Neumann architecture

• Program instructions and data share the same space and are accessed by same the same lines (bus)

BJ Furman SJSU MAE

Overview of Major Types

• Motorola• Microchip• Atmel

Recommended