Professional Documents
Culture Documents
By: Engr. Tarique Rafique Memon Department of Electronic Engineering QUEST Nawabshah
Contents
Introduction Parameters
consideration for
Introduction
Automation
The
control of an industrial process (e.g manufacturing, production etc) by automatic rather that manual means is often called automation can be defined as a technology that uses programmed commands to operate a given process
Automation
Appliances
Sensors/ Transducers
Level Flow Pressure Temperature Humidity
Controllable applications
Motors Solenoid
Display
Input
Controller
Takes
Input Verifies the conditions Controls the equipment & Displays the output
Microcontrollers
The prime use of a microcontroller :
To control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system
Typical Microcontrollers
The
most common microcontrollers are 8-bit. 4-bit are used in high volume very low cost applications 16 & 32 bit are used in high-end applications. Typical clock frequencies are 12 - 24 MHz
Software:
Test case:
A smaller computer On-chip RAM, ROM, I/O ports...
8051
A single chip
History of 8051
1981,
Intel MCS-51 The 8051 became popular after Intel allowed other manufacturers to make and market an flavor of the 8051.
different speed, amount of on-chip ROM code-compatible with the original 8051 form a 8051 family
Block Diagram
External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter
On-chip RAM
Timer 1 Timer 0
Counter Inputs
OSC
Bus Control
4 I/O Ports
P0 P2 P1 P3
TxD RxD
Address/Data
8051 (8031)
A Pin of Port 1
Read latch TB2 Vcc Load(L1) Internal CPU bus Write to latch
D Q
P1.X
Clk Q
P1.X pin M1
P0.x
8051 IC
Vcc
1 0
M1
P1.X
Clk Q
P1.X pin
output 1
8051 IC
ground
P1.X pin
0 1
M1
P1.X
Clk Q
output 0
8051 IC
Q
P1.X
Write to latch
Clk
M1
8051 IC
Q
P1.X
P1.X pin
Write to latch
Clk
M1
8051 IC
8051 Family
Mask OTP
programmable
User Programmable
Reprogrammable
User Reprogrammable
ROM type 8031 no ROM ; requires external Rom 80xx mask ROM 87xx EPROM 89xx Flash EEPROM 89xx 8951 8952 8953 8955 898252 891051 892051 Example (AT89C51,AT89LV51) AT= ATMEL(Manufacture) C = CMOS technology LV= Low Power(3.0v)
Registers
A B R0 R1 R2 R3 R4 R5 R6 R7 Some 8-bitt Registers of the 8051 Some 8051 16-bit Register PC PC DPTR DPH DPL
4k
0000H 0000H
8k
0000H
30H 2FH Bit-Addressable RAM 20H 1FH 18H 17H 10H 0FH 08H 07H 00H Register Bank 3 Register Bank 2 Register Bank 1
Register Bank 0
Sensor input/Analog
8051uc
Decoder
Decoder
Decoder
Decoder
Counter
Counter
Counter
Counter
Clk input
C 1
3p 3F
C 2
3p 3F
X 1
1 9 CYTL RSA
U 1
XA1 TL P. / D 0 A0 0 P. / D 0 A1 1 P. / D 0 A2 2 P. / D 0 A3 3 P. / D 0 A4 4 P. / D 0 A5 5 P. / D 0 A6 6 P. / D 0 A7 7 P. / 8 2A 0 P. / 9 2A 1 P. / 1 2 A0 2 P. / 1 2 A1 3 P. / 1 2 A2 4 P. / 1 2 A3 5 P. / 1 2 A4 6 P. / 1 2 A5 7 P. / X 3 RD 0 P. / X 3 TD 1 P. /N0 3IT 2 P. /N1 3IT 3 P. / 0 3T 4 P. / 1 3T 5 P. / R 3W 6 P. / D 3R 7 3 9 3 8 3 7 3 6 3 5 3 4 3 3 3 2 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7
1 8
R 1 C 3
1u 0F 1k 0 9
XA2 TL
RT S
Q 1
2 20 N97
2 9 3 0 3 1
PE SN AE L E A
Q 2
2 20 N97
1 2 3 4 5 6 7 8
P. 1 0 P. 1 1 P. 1 2 P. 1 3 P. 1 4 P. 1 5 P. 1 6 P. 1 7 A8C1 T9 5
Q 3
2 20 N97
Q 4
2 20 N97
Controller
Fixed Universal controllers
Universal controllers
Input
Applications of microcontroller
Personal
information products: Cell phone, pager, watch, pocket recorder, calculator Laptop components: mouse, keyboard, modem, fax card, sound card, battery charger Home appliances: door lock, alarm clock, thermostat, air conditioner, TV remote, VCR, small refrigerator, exercise equipment, washer/dryer, microwave oven Industrial equipment: Temperature/pressure controllers, Counters, timers, RPM Controllers Toys: video games, cars, dolls, etc.
Microcontroller Applications
Sample projects
Car parking gate control
; wait for enter into parking ; if inside goto here subroutine ; wait for leave parking ; if leave parking goto here1 ; start motor1 for open d gate ; start motor1 until it strikes to limit switch ; after defined time stop d motor ; wait for input when the car cross the entering door ; when gate crossed start motor1 in revese direction to close d gate ; start motor1 in reverse direction until it strikes to the other limit ; after closing the door now stop motor1 ; start counter to count number of cars on seven segment display ; display result on port 0 'use decoder' ; return from subroutine ; start motor2 for open d gate ; start motor2 until it strikes to the other limit ; after defined time stop d motor ;wait for input when the car cross the exit door ; when gate crossed start motor2 in revese direction to close d gate ; start motor2 until it strikes to the other limit ; after closing the door now stop motor2 ; count down ; display result on port 0 ; restart