Parking System Project using PIC16F1947 Microcontroller
Pin Diagram:
In this tutorial, I'll show you how to design an automatic parking system. In this design, I have used two push buttons which act as sensing sensors. When a motor car passes against the sensing sensor, then sensor detects it and increment/decrement the counter. When I press entrance button, it increment the counter. In this design, 7 segment display act as a counter that shows the number of enters or exit. The total number of cars that a parking can accomodate is 8. When the parking fill, an LED turns on that indicates that there is no place in Parking. If place is available in the parking, another LED turns on that indicates that in parking, free space is available. I have used Sinking Current method for LEDs.
Proteus Circuit Diagram
MikroC Code
//Code by Shahid Khan
//Automatic Parking System
#define DIS PORTE //display at PORTE
sbit PB1 at PORTC.B0; // Entry sensor
sbit PB2 at PORTC.B1;//Exit Sensor
sbit LEDGREEN at PORTD.B4; //Space available
sbit LEDRED at PORTD.B5; //Full
unsigned char Num; //define a variable
unsigned char Code[]={0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00,}; //array
void UP_COUNT() //UP-COUNTER
{
Num++;
} void DOWN_COUNT() //DOWN-COUNTER
{
Num--;
}
void main()
{
TRISE=0;
TRISC.RC0=1;
TRISC.RC1=1;
TRISD.RD4=0;
TRISD.RD5=0;
Num = 0x00;
DIS= Code[Num];
while(1)
{
if(PB1==1)
{
Delay_ms(3);
UP_COUNT();
DIS=Code[Num];
while(PB1==1);
}
if(PB2==1)
{
Delay_ms(3); //Debouncing-delay
DOWN_COUNT();
DIS=Code[Num];
while(PB2==1);
}
if(Num==8)
{
LEDGREEN=1;
}
else
{
LEDGREEN=0;
}
if(Num<8)
{ LEDRED=1;
}
else
{
LEDRED=0;
}
}
}
Simulation Video
In this tutorial, I'll show you how to design an automatic parking system. In this design, I have used two push buttons which act as sensing sensors. When a motor car passes against the sensing sensor, then sensor detects it and increment/decrement the counter. When I press entrance button, it increment the counter. In this design, 7 segment display act as a counter that shows the number of enters or exit. The total number of cars that a parking can accomodate is 8. When the parking fill, an LED turns on that indicates that there is no place in Parking. If place is available in the parking, another LED turns on that indicates that in parking, free space is available. I have used Sinking Current method for LEDs.
Proteus Circuit Diagram
MikroC Code
//Code by Shahid Khan
//Automatic Parking System
#define DIS PORTE //display at PORTE
sbit PB1 at PORTC.B0; // Entry sensor
sbit PB2 at PORTC.B1;//Exit Sensor
sbit LEDGREEN at PORTD.B4; //Space available
sbit LEDRED at PORTD.B5; //Full
unsigned char Num; //define a variable
unsigned char Code[]={0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00,}; //array
void UP_COUNT() //UP-COUNTER
{
Num++;
} void DOWN_COUNT() //DOWN-COUNTER
{
Num--;
}
void main()
{
TRISE=0;
TRISC.RC0=1;
TRISC.RC1=1;
TRISD.RD4=0;
TRISD.RD5=0;
Num = 0x00;
DIS= Code[Num];
while(1)
{
if(PB1==1)
{
Delay_ms(3);
UP_COUNT();
DIS=Code[Num];
while(PB1==1);
}
if(PB2==1)
{
Delay_ms(3); //Debouncing-delay
DOWN_COUNT();
DIS=Code[Num];
while(PB2==1);
}
if(Num==8)
{
LEDGREEN=1;
}
else
{
LEDGREEN=0;
}
if(Num<8)
{ LEDRED=1;
}
else
{
LEDRED=0;
}
}
}
Simulation Video
Post a Comment