Você está na página 1de 16

NNAMDI AZUKIWE UNIVERSITY, AWKA

A Project Report
On
MICROPROCESSOR EMBEDDED SYSTEM
OF A REAL-TIME SYSTEM

By
NDIKA CHINEMELUM CHUKWUNWEIKE

Reg no: 2012234132


Department of Electrical Engineering
Faculty Engineering
ELECTRONIC & COMPUTER ENGINEERING LAB

13th MAY 2019


ABSTRACT
The work report experiences, designs, practices and observation of
real time simulation which is workable of a program in real life
simulation

Some experiences to be shared in this report are

 Real time simulation of a four (4) way traffic light controller in a


proteus environment.
 Fluid level controller interface with LCD
Table of content
Cover page .......................................................................................i

Abstract ...........................................................................................ii

CHAPTER ONE
Real time simulation of four way traffic light ..................................1

CHAPTER TWO
Fluid level controller ........................................................................9
1.0 REAL TIME SIMULATION OF FOUR WAY TRAFFIC
LIGHT CONTROLLER IN A PROTEUS
ENVIRONMENT
A practical example of a real time system is traffic light. There are
different ways of designing a traffic light system. Depending on
the user’s need , there are traffic light with
 Arrow light
 Timer
 Sensor
In a traffic light with timer, the timer is in a form of counter
enables drivers to know the duration of the light. The design of
this system is done in such a way that the operation
microcontroller will control the traffic light bulb as well as to
control the counter sub-circuit.
Traffic light with sensor are usually used at road junction where
emergencies are needed. Light sensor such as, photodiodes, light
dependent resistors (LDR), phototransistors etc. Are placed along
the road near the junction. The presence of the sensor enables
the traffic light to work according to the value of the traffic the
light at the junction.
While in traffic light with Arrows, the design objective is to give
an additional array of light to reduce traffic.
FIG 1.1 A FOUR WAY TRAFFIC LIGHT
CONTROLLER IN A PROTEUS ENVIRONMENT
1. COMPONENT OF FOUR WAY TRAFFIC LIGHT
 Microcontroller AT89C51
 Crystal oscillator
 Power supply
 Capacitor 33pf
 Resistor 10k
 Switches
 Ground
 Traffic light
The AT89C51 is a 40-pin microcontroller, which consists of 30
input/output pins and 8 special pins. Many of the pins have
optional alternate function relating to accessing external memory
using the on chip timer/counters, detecting external interrupts,
and handling serial communication.

1.2 FUNDERMENTALS OF MICROCONTROLLER


A microcontroller is a single chip computer. It is a single
chip because it is in an form of integrated circuit (IC), and
also a computer because it has all the component part of
a computer. It is a low cost programmable electronic
device that is characterized by a very high speed of about
12 MHz that is reliable and flexible. The micro suggests
that the device is small, while the controller suggest that
the device can be used to control object and processes.
Thus , a microcontroller is a single chip computer.

The type of microcontroller used as a case study for this is


AT89C51. It is an advanced single chip electronic device
whose immense advantages is the vast range of functions
to which it can be applied.
The AT89C51 microcontroller is a member of 8051
microcontroller family. It is a single chip IC which contain
all logic circuitry that perform the following function.
1. It provides timing and control signal.
2. It fetches instructor and data from memory
3. It transfers data to and from memory and other
output/input device
4. It interprets instructions
5. It perform arithmetic and logic operation based on
the instruction it receives.

Pin 32 to 39(port0): similar to port 2and 3 , these


pin can be used as input/output pins when we do
not use my external memory. When ALE or pin 30 is
at 1 then this port is used as data bus, when ALE pin
at 0, then this port is used as lower order address
bus (AO to A7).
Pin40: positive power supply pin (+5V)

1.3 CODE TABLE FOR THE TRAFFIC LIGHT CODES


P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.O P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0

0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 RED ON GREEN
ON
Call Call
five- five-
sec sec
1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 YELLOW
ON
Call Call
two- two-
sec sec
0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 GREEN
ON
Call Call
five- five-
sec sec
1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 YELLOW
ON
Call Call
two- two-
sec sec

1.3 CONTROL PROGRAM FOR A FOUR- WAY TRAFFIC LIGHT


SYSTEM

org 00h
start:
mov p1,#000010001b
mov p2,#00000011b
call delay
mov p1,#01100010b
mov p2,#00000100
call delay
mov p1,#10001100b
mov p2,#00001000b
call delay
jmp start

delay:
Mov R1,#120
Mov R2,#0
Mov R3,#38
MEG:Djnz R1,MEG
Djnz R2,MEG
Djnz R3,MEG
Ret
CHAPTER TWO
LCD INTERFACE OF FUILD LEVEL CONTROL
2.0 background study of a Liquid Crystal Display LCD
LCD mean Liquid Crystal Display. In recent years, it is finding
widespread use thus, replacing light emitting diodes. (LCDS). The
seven segment display an others.
This is due to the following reasons
1. The declining of prices of LCD
2. The ability to display numbers, characters and graphics. This
is in contrast to 7 segment, which its display is limited to
some numbers and few characters.
3. Ease of programming for characters and graphics display.
4. Incorporation of refreshing controller into the LCD, thereby
hiring the CPU of the task of refreshing the LCD.
There are many places where LCDs are applied in these days’
modern electronics gadgets. Example, modern television set is
made with LCD for display, replacing the old cathode ray tube
system. Then the modern wrist watches use LCD instead of (7)
seven segment, and other examples.
Fig 2.1 : LCD Pin arrangement

The description of the pin of an LCD is stated in the following’


Pin Symbol I/O Description
1 VSS - Ground
2 VCC - +5V Power Supply
3 VEE - Power Supply to control contrast
4 RS I RS=0, to select command register
RS=1, to select data register
5 R/W I R/W=0 for write
R/W=1 for read
6 E I/O Enable
7 DB0 I/O The 8-bit data bus
8 DB1 I/O The 8-bit data bus
9 DB2 I/O The 8-bit data bus
10 DB3 I/O The 8-bit data bus
11 DB4 I/O The 8-bit data bus
12 DB5 I/O The 8-bit data bus
13 DB6 I/O The 8-bit data bus
14 DB7 I/O The 8-bit data bus

The VCC and VSS provide +5v ground respectively, while VEE is
used for controlling the LCD contrast.

2.1.2 The Control Pin of LCD


There are three (3) main control pin in LCD. They are:

 The Register Select (RS)


 Write/Read (W/R)
 Enable (E).

REGISTER SELECT (RS)


The register select is a very important inside the LCD. It controls
two important registers: the Data register and command code
register. The RS pins are used for selection as fellows.
If RS= 0, the instruction command code register is selected, thus
allowing the user to send a command such as ‘’clear’’, ‘display
cursor at home’’, etc.
If RS= 1, the data register is selected, allowing the user to send
data to be displayed on the LCD.

READ/WRITE (R/W)
This is another very important register inside the LCD. The R/W
inputs allow the user to write information to the LCD or read
information from it.
If R/W= 0, it write data onto the LCD;
If R/W= 1, it read data from the LCD.

ENABLE (E)
The enable pin is used by LCD to latch information that is present
on its data pins. When data is supplied to the data pin, a high-to-
low pulse must be applied to these pins in order for the LCD to
latch in the data present at the pins.

COMPONENT
I. Microcontroller 80C31
II. Crystal oscillator
III. 10k resistor
IV. Switch
V. Capacitor
VI. Power supply
VII. LM016L
Fig 2.0 FUILD LEVEL CONTROL
This is a real time system that control the level of water in
reservoir. The sensors are wires. When the reservoir is full of
water, the 10k drop the voltage to low , and zero enter into the
microcontroller. Immediately the level of water start going down,
change occur.
At point ‘A’ the VOA is high, so 1bit(high) enter into
microcontroller port, as the water level continues to go down, the
micro controller will be monitoring the level until it gets below ‘B’
level where port goes high. And below ‘C’ level where port goes
high turning to LCD.
CONTROL PROGRAM

org 00h
start:
Mov p1,#11111111b
Mov p2,#00000000b
chinemelum:
jp p1.0,ndika
clr p2.3
setb p2.0
call delay
clr p2.1
clr p2.2
jmp chinemelum
ndika:
jb p1.1,ndika1
clr p2.0
setb p2.1
DELAY:
PET:Mov R1,#120
Mov R2,#0
Mov R3,#38
MEG:Djnz R1,MEG

Djnz R2,MEG

Djnz R3,MEG

Ret

clr p2.2

jmp chinemelum

ndika1:

jb p1.2,ndika2

clr p2.0

clr p2.1

setb p2.2

call delay

jmp chinemelum

ndika2:

setb p2.3

jmp chinemelum

DELAY1:

PET1:Mov R1,#120

Mov R2,#0

Mov R3,#38

MEG1:Djnz R1, MEG

Djnz R2, MEG

Djnz R3, MEG

Ret

END

Você também pode gostar