PBL Introduction to Embedded System
PBL Introduction to Embedded System
Islamabad
NUTECH
Problem Based Learning
Course: Introduction to Embedded
System
Department: Electrical Engineering
Batch: Fall 2022
Problem Statement:
Now a days vehicle parking is a major concern in urban areas due to increasing
number of vehicles. When a vehicle trying to locate the empty slot, it slows down
the overall traffic on the road and results in the congestion near the parking area.
This can also be the cause of accident and there is a need of smart parking system.
The smart parking system is not about creating more parking space but making it
easier for people to locate the empty parking spaces so that the time spent on the
road may significantly reduce. In the smart parking system, there will be a display
unit on the entrance of the parking arena and shows the total number of available
parking slots. Whenever a vehicle enters the parking arena the total count will be
decremented by one and in case a vehicle goes out from parking arena the total
count will be incremented by one. If the parking area is full and there is no empty
slot for vehicle the count on the display will be zero.
You are required to make the prototype of smart parking system using PIC18F with
maximum parking limit of 50. There will be two different sensors to detect the
incoming and outgoing vehicle. Both sensors are digital sensors and send HIGH
signal when vehicle is detected otherwise send LOW signal. To display the
available slots, use the seven-segment display. Fig.1 shows the seven-segment
display.
LED’s are joined together to ground and individual segments are illuminated by
HIGH signal to the individual Anode terminals. On the other hand, in common
anode display, all the anode connections are joined together to HIGH signal and
individual segments are illuminated by sending LOW signal to the individual
Cathode terminals.
Develop a program C18 for PIC18F which meets the above specifications along
with the required circuitry/schematic to accomplish the task. Consider the seven
segment as common cathode.
Code Implementation:
#include <p18f452.h>
#define in PORTBbits.RB0
void main()
unsigned char segment[] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07,
0x7F, 0x6F};
TRISBbits.TRISB0 = 1;
TRISBbits.TRISB1 = 1;
TRISC = 0;
TRISD = 0;
PORTC = 0x6D;
PORTD = 0x3F;
while (1)
maxslots--;
maxslots++;
Output: