Anda di halaman 1dari 6

Microprocessor

Objective 1 : Flash LED


Flash LED program use a single LED that blink ON or Off, initially code
check if LED is not on then turn it On then code check if is on make it
Off, when is LED is low its jump to start of the code for a number of time
by loop
Pseudo Code:
Initiate the LED
Start code
Loop For < 0xfff (check the condition and increment)
Turn LED ON ()
If LED is ON then
Turn LED Off ()
Jump to start code
End

Start

LED ON

Check LED

LED Off

Objective 2 : Water level controller


Water level controller monitors the level of the overhead tank and
automatically switches on the water pump whenever the level goes
below The level of the overhead tank is indicated using 5 LEDs and the
motor is switched OFF when the overhead tank is full.
Pseudo Code:
Configuration of controller pins P0 , P1, P2, P3
P4 for the output
Initialized Buzzer
Initialized Display
Water Level check by P0 to P3
If pins are Low then
(tank is empty)
Buzzer On()
Display the Status
Turn the P4 High (Motor start automatically)
End
If P4 is high then
Check if p3 is high now then
Tank is full now
Turn the P4 Low ( Motor Stop)
End
Timer delay set to 300 sec
Go to water level check again
End
Start

Initialize Parameters

Buzzer On
Check Water Level Empty

Display

Motor OFF
Motor ON

Check Water Level Full

Objective 3: Traffic Signal Lights controller


This program is design for the traffic lights e.g red , yellow , green which
are On as per the timing assigned or the load of traffic etc .
Pseudo Code:

Configuration of controller pins P0 = Red, P1= Yellow, P2=


Green
Set the timer to 0 sec
Check the timer status ()
If timer status equal to 0 sec then
At 0 Sec Change the light Status ()
(Red = High
Yellow = Low
Green = Low)
Delay for 10 sec
If timer status equal to 10 sec then
At 10 Sec Change the light Status ()
(Red = Low
Yellow = High
Green = Low)
Delay for 2 sec
If timer status equal to greater 12 sec then
2

At 12 Sec Change the light Status ()


(Red = Low
Yellow = Low
Green = High)
Delay for 20 sec
If timer status equal to 32 sec then
Set the timer value to 0
Jump of start of code and repeat the code
End

Start

Initialize Parameters

Check Timer = 0

R = High
Y = Low
G = Low

Check Timer = 12

R = Low
Y = High
G = Low

Check Timer > 12

R = Low
Y = Low
G = High

Timer = 0

Check Timer > 32

Objective 4: Parking Counter


Suppose a parking have capacity of 100 car at a time, When a
car enter in some parking , at entrance , first counter check if is
less than 100 then allow the car to enter and add 1 to current
counter and when car left from the parking from exit then
counter change .
Pseudo Code:
Start
4

Configuration of parameters
Set the counter variable to 0
Set the capacity variable to 100
Car Enter ()
Check the counter variable equal to capacity variable =
100 or not
If Not equal then
Allow Entry of Car ()
Increment to counter + 1
Update the counter variable
Display Parking Allowed
Else if counter variable equal to capacity variable = 100
then
Disallow Entry of Car ()
Display Parking Full
Update the counter variable = counter variable
End of if condition
Car Exit ()
Allow Exit of Car ()
Decrement to counter -1
Update the counter variable
Display Parking Allowed
End
Start

Set Parameters

Car Entry-check counter

Allow Parking
Counter +1

Not allow Parking


Display parking full
Car Exit

Allow Exit
Counter -1 - updated

Anda mungkin juga menyukai