Microcontroller › 8051 › CODE FOR CAR PARKING SYSTEM
- This topic has 18 replies, 11 voices, and was last updated 7 years, 2 months ago by
Anonymous.
-
AuthorPosts
-
September 7, 2010 at 1:09 pm #404
poonam
Participanthii…….
i need code for multistorage car parking system.
September 7, 2010 at 1:24 pm #5050Anonymous
Guestcould u please explain wat u actually want to make, and could u provide the details like how many cars u want to park and up to how many levels
September 10, 2010 at 7:32 pm #5053poonam
Participantactually my project is multi storage car parking system.which is based on 8051 microcontroller.in this project we will make 3 floor and each floor contain atleast 10 cars.third floor for vip section which access through password matching which is stored in internal RAM memory of 8051.
we also use lift to carry the car on each floor.their is IR sensor at each floor to sense the headlight of car for opening of lift.i need code for this project in ‘c’ language.
March 28, 2011 at 10:50 am #5827dip
ParticipantPLZ MAIL ME,CODE FOR CAR PARKING SYSTEM USING 8051
July 1, 2011 at 1:58 pm #6409udit
Participantactually i am planning too the car parking project: it has a code detector of 12 bits after matching the code the motor will respond and after certain point there will be IR. when car crosses the IR doors will again closed. also to represent the project in a better way i am thinking a track on which my car will move.So any suggestions for that?
July 2, 2011 at 5:39 pm #6415SaLMAN Ahmed Khan
Participantwell udit your idea first of all is not new ……..the thing is this idea can be easily implememented BY using plc
ladder diagram logic i have made it on ladder logic however the microcontroller can be little complecated
August 3, 2011 at 3:15 pm #6570Tathagata Bhattacharya
ParticipantCan u please give the code and the ckt diagram of automatic car parking system.
February 12, 2012 at 9:24 am #7152Satish
ParticipantMarch 31, 2012 at 8:57 am #7363anurudh tiwari
Participanthi freinds..i have the code of the car parking system.. with some different from your design …but i will provide the code in coming 48 hrs… plz wait …and also type the whole deatail of your project aim and give the details of all sensors using by you?
.
July 7, 2012 at 3:06 am #8211Anonymous
GuestJuly 11, 2012 at 8:17 pm #8245jayesh dhanawde
Participantpls can u help me by sending d circuit diagram to me pls on below email id
July 12, 2012 at 9:25 pm #8250NENARAM
ParticipantJuly 14, 2012 at 1:42 pm #8251Amrith
ParticipantHi Poonam,
Share your schematics to get help on code. Without circuit disgrsm it is difficult to implement the logic in code.
July 15, 2012 at 6:07 pm #8260Anonymous
Guest6.1 MAIN PROGRAM
#include<reg51.h>
#include “liftcontrol.h”
#include “liftapp.h”
#include “lcd.h”
#include “delay.h”
#include “visitor.h”
#include “display.h”
#include “rtc.h”
sbit sw0 =P0^0;
sbit sw1 =P0^1;
sbit sw2 =P0^2;
sbit sw3 =P0^3;
int main()
{
unsigned char time[]=” : : “; //buff for storing time
unsigned char date[]=” / / “; //buff for storing date
unsigned char time_date[]={0x30,0x15,0x03,0x08,0x06,0x10};//(min,hr,day,date,month,yr)
unsigned char lftup,lftdown;
unsigned char engn,exgn,enfrst,exfrst;
engn =1;
exgn =1;
enfrst =1;
exfrst =1;
lftup =1;
lftdown =1;
init_rtc(&time_date);
while(1)
{
IE =0X85;
IT0 =1;
IT1 =1;
clear();
Read_RTC_Time(&time);
clear();
lcd_pnt(time);
MSdelay(1000);
Read_RTC_Date(&date);
clear();
lcd_pnt(date);
MSdelay(1000);
clear();
visitordisplay();
MSdelay(1000);
clear();
lcd_pnt(“PRESS SWITCH “);
MSdelay(1000);
clear();
engn =sw0;
exgn =sw1;
enfrst =sw2;
exfrst =sw3;
displayled(engn,exgn,enfrst,exfrst);
clear();
lcd_pnt(“USE LIFT”);
MSdelay(1000);
lftup =sw0;
lftdown =sw1;
liftcontrol(lftup,lftdown);
}
return 0;
}
6.2 MODULE FOR THE OPERATION OF RTC
/*rtc.c*/
#include<reg51.h>
#include<stdio.h>
#include <stdlib.h>
#include”rtc.h”
#include”i2c.h”
unsigned char RTC_ARR[7];
void init_rtc(unsigned char *val)
{
ReadRTC(&RTC_ARR[0]);
RTC_ARR[0] = RTC_ARR[0] & 0x7F; // enable oscillator (bit 7=0)
RTC_ARR[1] = val[0]; // minute = 59
RTC_ARR[2] = val[1]; // hour = 05 ,24-hour mode(bit 6=0)
RTC_ARR[3] = val[2]; // Day = 1 or sunday
RTC_ARR[4] = val[3]; // Date = 30
RTC_ARR[5] = val[4]; // month = August
RTC_ARR[6] = val[5]; // year = 05 or 2005
WriteRTC(&RTC_ARR[0]); // Set RTC
}
void Read_RTC_Time(unsigned char *time)
{
ReadRTC(&RTC_ARR[0]);
time[0]=bcd_acii1(RTC_ARR[2]); //geting MSB and LSB and storing it in
time[1]=bcd_acii2(RTC_ARR[2]); // date buffer
time[3]=bcd_acii1(RTC_ARR[1]);
time[4]=bcd_acii2(RTC_ARR[1]);
time[6]=bcd_acii1(RTC_ARR[0]);
time[7]=bcd_acii2(RTC_ARR[0]);
}
void Read_RTC_Date(unsigned char *date)
{
date[0]=bcd_acii1(RTC_ARR[4]); //geting MSB and LSB and storing it in
date[1]=bcd_acii2(RTC_ARR[4]); // date buffer
date[3]=bcd_acii1(RTC_ARR[5]);
date[4]=bcd_acii2(RTC_ARR[5]);
date[6]=bcd_acii1(RTC_ARR[6]);
date[7]=bcd_acii2(RTC_ARR[6]);
}
unsigned char bcd_acii1(unsigned char val)
{
unsigned char lc[]={‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9’};
unsigned char r,temp,tfr;
r= val;
temp=(r/0x10); //taking MSb
tfr=(lc[temp]);
return(tfr); //returning obtaind MSB
}
unsigned char bcd_acii2(unsigned char dat)
{
unsigned char lc[]={‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9’};
unsigned char val1,temp1,tfr1;
val1=dat; //geting the LSB
temp1=val1%0x10;
tfr1=(lc[temp1]); //returning LSB
return(tfr1);
}
/*i2c.c*/
#include<reg51.h>
#include<stdio.h>
#include”intrins.h”
#include”I2C.h”
#define ACK 1
#define NO_ACK 0
#define SLAVE 0xD0
#define WRITE 0x00
#define READ 0x01
#define ERR_ACK 0x01
unsigned char i;
sbit SCL = P3^7; // connect to SCL pin (Clock)
sbit SDA = P3^6; // connect to SDA pin (Data)
void Start(void) //start SDA and SCL
{
SDA = 1;
SCL = 1;
_nop_();_nop_();
SDA = 0;
_nop_();_nop_();
SCL = 0;
_nop_();_nop_();
}
void Stop(void) //stop bit for SDA
{
SDA = 0;
_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SDA = 1;
}
void WriteI2C(unsigned char Data) //passing write code to device
{
for (i=0;i<8;i++)
{
SDA = (Data & 0x80) ? 1:0;
SCL=1;SCL=0;
Data<<=1;
}
SCL = 1;
_nop_();_nop_();
SCL = 0;
}
unsigned char ReadI2C(bit ACK_Bit) //readiong ACk from rtc or eeprom
{
unsigned char Data=0;
SDA = 1;
for (i=0;i<8;i++)
{
SCL = 1;
Data<<= 1;
Data = (Data | SDA);
SCL = 0;
_nop_();
}
if (ACK_Bit == 1)
SDA = 0; // Send ACK
else
SDA = 1; // Send NO ACK
_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SCL = 0;
return Data;
}
void ReadRTC(unsigned char * buff) //reading data from RTC
{
Start();
WriteI2C(0xD0);
WriteI2C(0x00);
Start();
WriteI2C(0xD1);
*(buff+0)=ReadI2C(ACK); // Second and incrimenting
*(buff+1)=ReadI2C(ACK); // Minute
*(buff+2)=ReadI2C(ACK); // hour
*(buff+3)=ReadI2C(ACK); // Day
*(buff+4)=ReadI2C(ACK); // date
*(buff+5)=ReadI2C(ACK); // month
*(buff+6)=ReadI2C(NO_ACK); // year
Stop();
}
void WriteRTC(unsigned char *buff) //writing data to RTC
{
Start();
WriteI2C(0xD0);
WriteI2C(0x00);
WriteI2C(*(buff+0)); //writing sec and inc
WriteI2C(*(buff+1)); //wirting min and inc
WriteI2C(*(buff+2)); //wirting hr and inc
WriteI2C(*(buff+3)); //wirting day and inc
WriteI2C(*(buff+4)); //wirting date and inc
WriteI2C(*(buff+5)); //wirting month and inc
WriteI2C(*(buff+6)); //wirting yr
Stop();
}
6.3 MODULE FOR VISITOR COUNTER
/*visitor.c*/
#include<reg51.h>
#include “visitor.h”
#include “lcd.h”
#include “delay.h”
unsigned int m,k,l,i;
extern unsigned int count=20;
unsigned char visitor[12] ={“TOTAL AVAL “};
unsigned char number[] ={‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9’};
void visitordisplay()
{
k =count/10;
l =count%10;
clear();
for(i=0;i<12;i++)
{
lcd_pntc(visitor);
MSdelay(250);
}
lcd_pntc(number[k]);
MSdelay(250);
lcd_pntc(number[l]);
MSdelay(500);
return;
}
void enter (void) interrupt 0
{
EA =0;
count–;
if(count<0)
{
k =count/10;
l =count%10;
clear();
for(i=0;i<12;i++)
{
lcd_pntc(visitor);
MSdelay(250);
}
lcd_pntc(number[k]);
MSdelay(250);
lcd_pntc(number[l]);
MSdelay(500);
MSdelay(250);
}
EA=1;
}
void exit (void) interrupt 2
{
EA =0;
count++;
if(count>20)
{
k =count/10;
l =count%10;
clear();
for(i=0;i<12;i++)
{
lcd_pntc(visitor);
MSdelay(250);
}
lcd_pntc(number[k]);
MSdelay(250);
lcd_pntc(number[l]);
MSdelay(500);
MSdelay(250);
}
EA =1;
}
6.4 MODULE FOR LCD DISPLAY
/*lcd.c*/
#include<reg51.h>
#include<intrins.h>
#include”lcd.h”
sfr ldata=0x90; //difineng port1 for data
sbit rs=P2^0; //seting rs at p2.0
sbit rw=P2^1; //seting rw at p2.1
sbit en=P2^2; //seting en at p2.2
extern int fst;
extern int gn;
extern unsigned int m;
void MSdelay(unsigned int item);
void lcdcmmd(unsigned char mybyte)
{
ldata=mybyte;
rs=0;
rw=0;
en=1;
MSdelay(1);
en=0;
return;
}
void lcd_pnt(unsigned char *Ldat)
{
unsigned char *tmp;
tmp=Ldat;
while(*tmp!=’