Anda di halaman 1dari 31

Evolution Of Microprocessors

Used As Used In
a CPU of a computer Control Application
• 8088 • 8086
• 80x86 • Z 80
• Pentium • MC 6800
• Intel 8051
• AVR
• PIC
• Dallas series
• Phillips
Microcontroller & Microprocessor

Memory I/O Timer Serial I/O


CPU

I/O Memory Timer


External
External CPU
*ADC Serial Memory
I/O
*PWM *WDT I/O
2
Microcontroller -
It is a highly integrated device which includes, on one chip,
all or most of the parts needed to perform an application
control function.
Microcontroller based System -
 Compact
Low Cost
Minimum component count
Low power requirement
Built in functions and memory
Choosing a microcontroller-
• Speed
•Width of data to be processed
•Power Consumption
• On chip Memory
•No of I/O pins and Timers on chip
•Availability of development tools
•Availability of Microcontroller ICs
• Additional features available
Microcontroller Applications:

Television Copiers
Telephone Elevators
Body controller of Automobile Irons
Remote control Cellular phone
Different parts of PC(printer,modem,disk controller
keyboard ) Security system
Home appliances (Microwave oven , Washing machine)
Environment control (green house, factory)
Digital diary
Vending machines
8 – Bit Microcontrollers
• Motorola’s 6811
•Intel’s 8051
•Zilog’s Z8
•Microchip Technology’s PIC 16X

Companies producing Member of 8051 family

Intel Siemens
Atmel Dallas Semiconductor
Philips AMD
Microcontroller Block Diagram -
Features of 8031 Architecture
• Optimized 8 bit CPU for control applications
•Extensive Boolean processing capabilities.
•8 bit and 16 bit registers.
• 64 K program memory address space
• 64 K Data memory address space
•128 bytes of on chip data memory
•32 bi-directional and individually addressable I/O lines
• Two 16-bit timers/counters
•Full Duplex UART, programmable in 4 modes
8-bit UART , 9-bit UART , Inter-processor communication
link, shift register I/O expander
•5 vector interrupts structure with priority levels
•On chip clock oscillator
Inside Microcontroller
Ex.INT Timer I/P

Timer/Counter
Interrupt RO RAM
M

CPU

Bus 4 I/O Serial


OSC
Contr Ports Port
ol

P0-P3
8051 Block Diagram
I/O
PSW SFR
ALU L P0 A0-7
& RAM D0-7

A B 8 Bit Data & Add.


Bus L P I/O
1

ROM I/O
L P2 A8-15

PC DPTR I/O
INT.
L P3
16- Bit Address Bus Counter
S.Data
EA
ALE
System Timing L- Latch
PSEN
Interrupts
XTAL1
XTAL2
Data Buffers
RESET
Memory Control
8051 Programming Model
A E0 B F0 TMOD TCON FFF
IP B8 IE A8
89 88

7F
General TH0 TL0 TH1 TL1
purpose 8C 8A 8D 8B
30 Area ROM
2F SCON SBUF PCON PSW
Bit Address 98 99 87 D0

20 Area
S
R.Bank 3
P
8
R.Bank 2 1
DPTR
R.Bank 1 DPH DPL PC
83 82
Registe
r
000
Port 0 Port 1 Port Port 3
Bank 0
80 90 2 B0
00
R0-R7 A0
* Bit addressable
Versions of 8051 from ATMEL

PART RAM ROM I/O TIMER INTERRUPT. VC


NO C
AT89C5 128 4KB 32 2 6 V
5
1
AT89LV51 12 4KB 3 2 6 3
8 2
AT89C1051 64 1KB 1 1 3 3
5
AT89C2051 128 2KB 1 2 6 3
5
AT89C52 128 8KB 3 3 8 5
2
AT89LV52 128 8KB 3 3 8 3
2 12
OVERVIEW OF 8051 FAMILY
OVERVIEW OF 8051 FAMILY

µC RAM ROM Other features


8031 128 NIL
2 Timers, 1 Serial
Bytes port, 6 Interrupt
sources

8051 128 4 Same as above


Byte KB
s
128
8751 4 KB Same as above
Bytes EPROM
8051 Pin Assignments
A8---A15
Vcc AD0 AD1 AD2 AD3 AD4 AD5 AD6 Vp Prog
AD7 p
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23
22 21 ____
EA ALE PSEN
P0.0 -- P0.7 P2.0 ----2.7
P3.0 --P3.7

P1.0 - P1.7 RST


1 2 3 4 5 6 78 9 10 11 12 13 14 15 16 17 18
19 20
_____ ____
Vss
__ __
Port 1 Bit 0-7 RXD INT0 INT1 T0 T1
Reset WR RD XTAL1
TXD
XTAL2
Input - Output Pins, Ports

1. 8051 Interact with outside world with I/O ports


2. Each port has a D-type output latch for each pin.
3. Data on the latches is not same as that on the pins
4. Separate data paths are used to read the latch or pin
data
5.Different opcodes access the latch or pin states as
appropriate.
Voltages at ports are TTL Levels.
But currents are IIL=10 µA IoL = 1.6 mA IIH = 10 µA IOH = -60
µA
6.Normally ports are buffered when interfaced to
external device.
7.All ports can be used as input / output, To use port as
input , ‘1’ must be written to corresponding port.
PIN DESCRIPTION OF THE 8051

Pin no 1 to 8 : port 1 It can be used as i/o no external pull up


resistors are required.
Pin no 9 : Reset : I/P active high. Upon applying high pulse to
this pin for two machine cycles 8051 will reset and terminate
all activities
Pin no 10 - pin no 17 are duel functions It is used as Bi-
directional I/O port
PIN DESCRIPTION ….

Pin no 18 19 : this pins are provided to connecting a


crystal to form an oscillator
To use frequency source other than crys.osc.it is
connected XTAL1
with XTAL2 open
Maximum Crystal frequency is 16 MHz
PIN DESCRIPTION ….

Pin 20 : Ground pin


Pin 21 to 28 : Port 2 it is used as I/O port alternate use as
high order address bus when external memory is interfaced
to 8051
Pin 29 : PSEN : It is O/P pin it is connected to OE pin of ROM
Pin no. 30 : ALE / PROG : It is an O/P pin it is used for
demultiplex address and data bus it is I/P during flash
programming.
Pin 31 : EA/VPP : 8051 family members such as 8751 89c51
come with on chip ROM in such a cases EA pin is connected
to VCC.
VPP : It is connected to 12 V during flash programming.
Pin 32 to Pin 39 Port 0 : It is a I/O port it can be used as
bi-directional low order address and data bus for external
8051 Timings
All internal operations of 8051 are in synchronous with
clock.
A Quartz crystal generates a basic internal clock frequency
of microcontroller.
Typically 1 MHz to 12 MHz clock frequencies are used.
Frequency of serial communication decides the particular
clock frequency to be used..
• Machine Cycle: The smallest interval of time to accomplish any simple
instruction.
The machine cycle made up of 6 T states.
T State: Basic time interval for discrete operations of microcontroller.

Two oscillator pulses define each T state.


One machine cycle requires 12 clock periods.

Time required to execute any instruction: Tinst=(12 C)/(Crystal Freq.)


20
Program Memory
ROM – Used to store program, least expensive for high
volume manufacturing. Eg. 8051 ( 4K ROM)

EPROM- Used to store program.Special programmer


is needed for programming. It takes time for erasing.
Eg 8751 ( 4K EPROM)

Flash – Electrically erasable and programmable memory. It


can have 100 – 1000 program/erase cycles. Eg 89C51 (4K)
89c52 (8K)
CPU Registers

Accumulator : 8 bit register hold results of many


instructions.
Most versatile register. It is also used in data transfers
between 8051 and any external memory.

B Register: It is 8 bit register used with A register for


multiplication and division operations.

It can be used as general purpose register


Byte Address
1F
Internal RAM Organization
Byte
BANK 3 Address Bit Address Byte Address
R0--R7 7F
2F 7F 78
18

17
BANK 2
R0--R7
10
0F
BANK 1
R0--R7
08

07
BANK 0
R0 -- R7 20 07
00 30
00
Working Registers Bit Addressable General purpose
Program Status Word

CY AC F0 RS1 RS0 OV - P

Select Reg. Bank

User flag 0
TCON

TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0

Ext Int 1 edge


Timer 1 run control flag
bit

Timer 1 overflow
flag Ext Int 0 signal type
control bit
1- edge trigger
0- level trigger
TMOD
Timer 1 Timer 0

Gate C or /T M1 M0 Gate C or /T M1 M0

Mode of timer
1 –Counter
C or /T
Osc Freq. /12 =0
0- Timer
OR gate enable bit

T1/0 pin C or /T To
=1 Timer

TR1/0 bit
Gate in TCON
Bit

/INT 1 or 0
SCON(Serial Port Control)

SM0 SM1 SM2 REN TB8 RB8 TI RI

Transmitted bit 8

Serial port mode bits Receive enable


bit
Transmit interrupt
flag
Multiprocessor
communication bit.

Receive interrupt flag


PCON (Power Mode Control)

SM0D - - - GF1 GF0 PD IDL

Serial baud rate modify


bit Gen. Purpose User
Flag
Power down bit

Idle mode bit


IE (Intrrupt enable SFR)

EA - - ES ET1 EX1 ET0 EX0

Interrupt enable bit


Enable Timer 1 OF
int.
Enable serial port Enable Ext. Int 0
interrupt
IP (Intrrupt Priority SFR)

- - - PS PT1 PX1 PT0 PX0

Priority of Timer 1
OF int.
Priority of serial port Priority of Ext. Int
interrupt 0
1- from Serial port when data transmission and reception
operation is executed.
2– from timers , when overflow occurs
2- from two input pins INT0, INT1
Each interrupt can be independently enabled and priority
will be given using IE and IP register.
Interrupt service routine starting address
External 0 0003h
Timer/Counter 0 000Bh
External 1 0013h
Timer/Counter 1 001Bh
Serial port 0023h 31