Professional Documents
Culture Documents
Using Microcontroller
By: Engr. M.Rizwan Anjum
Department of Electronic Engineering
UCET, IUB.
Contents
Introduction
Parameters
consideration for
Automation
Selecting microcontroller
Internal architecture of Microcontroller
Applications
Introduction
Automation
The
Automation
Transducer
Processing/ control
Set point
Appliances
Output/ Display
Sensors/ Transducers
Level
Flow
Pressure
Temperature
Humidity
Controllable applications
Motors
Solenoid
valves
Control valves
Display
Input
Parameters
Set point
Indication for Output (alarm)
Controller
Takes
Input
Verifies the conditions
Controls the equipment &
Displays the output
Microcontrollers
The prime use of a microcontroller :
Typical Microcontrollers
The
Different manufacturers of
microcontroller
Intel
Atmel
Philips
Dallas
Semiconductors
Microchip
Motorola
Different aspects of a
microcontroller
Hardware:
Software:
Test case:
8051
A smaller computer
On-chip RAM, ROM, I/O ports...
CPU
I/O
Port
RAM ROM
Serial
Timer COM
Port
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.
Block Diagram
External interrupts
Interrupt
Control
On-chip
ROM for
program
code
Timer/Counter
On-chip
RAM
Timer 1
Timer 0
CPU
OSC
Bus
Control
4 I/O Ports
P0 P2 P1 P3
Address/Data
Serial
Port
TxD RxD
Counter
Inputs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
8051
(8031)
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
Vcc
P0.0(AD0
P
) 0.1(AD1)
P0.2(AD2
P
) 0.3(AD3)
P0.4(AD4)
P0.5(AD5)
P0.6(AD6)
P0.7(AD7)
EA/VPP
ALE/PROG
PSEN
P2.7(A15)
P2.6(A14
)P2.5(A13
P
) 2.4(A12
)P2.3(A11)
P2.2(A10)
P2.1(A9)
P2.0(A8)
Function
Pin
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7
RxD
TxD
INT0
INT1
T0
T1
WR
RD
10
11
12
13
14
15
16
17
A Pin of Port 1
Read latch
TB2
Vcc
Load(L1)
Internal CPU
bus
Write to latch
Clk
P1.X
pin
P1.X
Q
M1
TB1
P0.x
Read pin
8051 IC
Vcc
TB2
Vcc
Write to latch
Clk
P1.X
pin
P1.X
Q
M1
TB1
Read pin
8051 IC
output 1
Vcc
TB2
ground
Write to latch
Clk
P1.X
pin
P1.X
Q
M1
TB1
Read pin
8051 IC
output 0
2. MOV A,P1
Vcc
TB2
external pin=High
Load(L1)
P1.X
Write to latch
Clk
M1
TB1
Read pin
3. Read pin=1 Read latch=0
Write to latch=1
8051 IC
P1.X pin
Vcc
2. MOV A,P1
TB2
Load(L1)
Q
P1.X
Write to latch
Clk
M1
TB1
Read pin
3. Read pin=1 Read latch=0
Write to latch=1
8051 IC
external pin=Low
P1.X pin
8051 Family
Mask
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
DPTR
DPH
DPL
R1
R2
PC
PC
R3
R4
R5
R6
R7
Some 8-bitt Registers of
the 8051
8k
0000H
0000H
0FFFH
DS5000
8751
AT89C51
1FFFH
8752
AT89C52
7FFFH
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
and Outputs
Compatibility of I/Os
Impedance matching
Selecting right microcontroller
Sensor
input/Analog
General diagram of
Automation
Set point
D0~D
7
Display
Analog to
Digital
converter
8051uc
Actuator
Contr
ol
Signal
Why Microcontroller
Less complex
Cheaper
Example
Thousand
s
hundred
s
Tens
Units
Decoder
Decoder
Decoder
Decoder
Counter
Counter
Counter
Counter
Clk input
C1
33pF
C2
33pF
X1
U1
19
CRYSTAL
18
R1
C3
10k
XTAL1
XTAL2
RST
10uF
29
PSEN
30
ALE
31 EA
1
P1.0
2
P1.1
3
P1.2
4
P1.3
5
P1.4
6
P1.5
7
P1.6
8
P1.7
AT89C51
P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
39
38
37
36
35
34
33
32
P2.0/A8 21
22
P2.1/A9
23
P2.2/A10
24
P2.3/A11
25
P2.4/A12
26
P2.5/A13
27
P2.6/A14
28
P2.7/A15
10
P3.0/RXD
11
P3.1/TXD
12
P3.2/INT0
13
P3.3/INT1
14
P3.4/T0
15
P3.5/T1
16
P3.6/WR
17
P3.7/RD
Q1
2N2907
Q2
2N2907
Q3
2N2907
Q4
2N2907
Controller
Fixed
Universal controllers
Universal controllers
Input
in form of 0 ~5v
4 ~ 20mA
0 ~20mA
Applications of
microcontroller
Personal
Microcontroller Applications
Microcontroller Application
Area
Sample projects
Car parking gate control