Over speed indication and
Automatic accident Avoiding
System for four wheeler
Presented By
Components Used:
Microcontroller AT89C51
Crystal Oscillator (11.059 Mhz)
Ceramic Capacitor (33 Pf)
Power Supply (5 V)
Reset Switch
Ultrasonic Sensor(10 meter range)
Keypad
Relay Switch
Dc Motor
IC L293d
LCD Display (2x16)
Advantages of Microcontroller
based System
As the peripherals are integrated into a single chip, the overall
system cost is very less
The product is of small size compared to micro processor based
system
The system design now requires very little efforts
As the peripherals are integrated with a microprocessor the
system is more reliable
Though microcontroller may have on chip ROM,RAM and I/O
ports, addition ROM, RAM I/O ports may be interfaced
externally if required
On chip ROM provide a software security
8051 Basic Component
4K bytes internal ROM
128 bytes internal RAM
Four 8-bit I/O ports (P0 - P3).
Two 16-bit timers/counters
One serial interface
64k external memory for code
64k external memory for dataMicrocontroller
210 bit addressable
The basic 8051 Core
8-bit CPU optimized for control applications
Capability for single bit Boolean operations.
Supports up to 64K of program memory.
Supports up to 64K of data memory.
4 K bytes of on-chip program memory.
Newer devices provide more.
128 or 256 bytes of on-chip data RAM
Four 8 bit ports.
Two 16-bit timer/counters
UART
Interrupts
On-chip clock oscillator
5
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 P1 P2 P3
Address/Data
Serial
Port
TxD RxD
Counter
Inputs
8051
Schematic
Pin out
8051
Foot Print
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
RST
(RXD)P3.0
(TXD)P3.1
(INT0)P3.2
(INT1)P3.3
(T0)P3.4
(T1)P3.5
(WR)P3.6
(RD)P3.7
XTAL2
XTAL1
GND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
8051
(8031)
(8751)
(8951)
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
Vcc
P0.0(AD0
)P0.1(AD1)
P0.2(AD2
) 0.3(AD3)
P
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
)P2.4(A12
)P2.3(A11)
P2.2(A10)
P2.1(A9)
P2.0(A8)
Power-On RESET Circuit
Vcc
+
10 uF
31
30 pF
8.2 K
30 pF
11.0592 MHz
19
18
EA/VPP
X1
X2
9 RST
Port 0 with Pull-Up Resistors
Vcc
Port 0
P0.0
DS5000 P0.1
P0.2
8751
P0.3
P0.4
8951
P0.5
P0.6
P0.7
10 K
IMPORTANT PINS (IO Ports)
One of the most useful features of the 8051 is that it contains
four I/O ports (P0 - P3)
Each port can be used as input or output (bi-direction)
Port 0
pins 32-39 P0.0 P0.7
8-bit R/W - General
Purpose I/O
Or acts as a multiplexed
low byte address and data
bus for external memory
design
IMPORTANT PINS (IO Ports)
Port 1
pins 1-8 P1.0
P1.7
Only 8-bit R/W General Purpose I/O
IMPORTANT PINS (IO Ports)
Port 2
pins 21-28 P2.0
P2.7
8-bit R/W General Purpose
I/O
Or high byte of
the address bus
for external
memory design
IMPORTANT PINS (IO Ports)
Port 3
pins 10-17 P3.0
P3.7
General Purpose I/O
if not using any of the
internal peripherals
(timers) or external
interrupts.
Port 3 Alternate Functions
ALE
- Address latch enable
to select valid address
EA/Vpp - External access enable
EA-0 execute program in external
memory
EA-1 execute program in internal
memory
Vpp it receives 21 V for on chip EPROM
PSEN Program store enable
store to read the external program memory
Registers
A
B
R0
DPTR
DPH
DPL
R1
R2
PC
PC
R3
R4
R5
R6
R7
Some 8-bitt Registers of
the 8051
Some 8051 16-bit Register
MOV A,0A2H
XM
MOV R1,#0A2H
MOV A@R1
MOV A,62H
DM
MOV R1,#62H
MOV A@R1
Data memory
Ultrasonic Sensor
PING ultrasonic distance sensor provides
precise distance measurements from about 2
cm (0.8 inches) to 10 meters .
It works by transmitting an ultrasonic burst
and providing an output pulse that
corresponds to the time required for the burst
echo to return to the sensor.
By measuring the echo pulse width the
distance to target can easily be calculated.
Interfacing a Keypad
16 keys arranged as a
4X4 matrix
Place a 0 on R0 port
Read C port
If there is a 0 bit
then the button
at the column/row
intersection has
been pressed.
Otherwise, try next row
Repeat constantly
R
R
R
R
1
2
3
4
C
C
C
C
1
2
3
4
LCD Interfacing
Liquid Crystal Displays (LCDs)
cheap and easy way to display text
Various configurations (1 line by 20 X char up to
8 lines X 80)
Integrated controller
The display has two register
command register
data register
By RS you can select register
Data lines (DB7-DB0) used to transfer data and
commands
Alphanumeric
LCD Interfacing
Microcontroller
communications bus
R/W
RS
DB7DB0
8
LCD
controller
LCD Module
Pinout
8 data pins D7:D0
RS: Data or Command
Register Select
R/W: Read or Write
E: Enable (Latch data)
RS Register Select
RS = 0 Command Register
RS = 1 Data Register
R/W = 0 Write , R/W = 1 Read
E Enable
Used to latch the data present on the data pins.
SJCET
D0 D7
LCD Commands
The LCDs internal controller can accept several commands and
modify the display accordingly.
Such as:
Clear screen
Return home
Decrement/Increment cursor
After writing to the LCD, it takes some time for it to complete its
internal operations. During this time, it will not accept any new
commands or data.
We need to insert time delay between any two commands or
data sent to LCD
Pin Description
Command Codes
SJCET
Interfacing LCD with 8051
8051
LCD
P3.4
RW
P3.5
P3.3
RS
P1.7-P1.0
D7-D0
SJCET