Handheld Vehicle Lock Control System Using Wireless Communication (IR / RF)

CODING:
/**COMPILER DIRECTIVES**/
#include
/**PORT DEFINATIONS**/
#define LCD P0
sbit ir=P3^3;
/**FUNCTIONS DECLARATION**/
void lcd_init(void);
void lcd_cmd(unsigned char);
void lcd_data(unsigned char);
void lcd_str(unsigned char *);
void integer_LCD(int);
void delay_ms(unsigned int);
/**GLOBAL VARIABLE DECLARATION**/
unsigned char i,bitCount;
sbit buzzer = P2^0;
sbit M1 = P2^3;
sbit M2 = P2^4;
/**MAIN FUNCTION**/
void main()
{
/**VARIABLES DECLARATION**/
char addr,cmd,mul;
buzzer = 0;
M1 = M2 = 0;
lcd_init(); //LCD INITIALIZATION
lcd_cmd(0×80); //1ST LINE DISPLAY
lcd_str(“St.JOHNS COLLEGE”); //STRING DISPLAY
lcd_cmd(0xC0); //1ST LINE DISPLAY
lcd_str(“**Dept. Of ECE**”); //STRING DISPLAY
delay_ms(500);
lcd_cmd(0×01);
lcd_cmd(0×80); //1ST LINE DISPLAY
lcd_str(“RC5 Protocol”); //STRING DISPLAY
lcd_cmd(0xC0); //1ST LINE DISPLAY
lcd_str(“DOOR = CLOSE “); //STRING DISPLAY
M1 = 0;
M2 = 1;
buzzer = 1;
delay_ms(10);
M1 = M2 = 0;
buzzer = 0;
while(1)
{
addr=0×00,cmd=0×00; //VARIABLES INITIALIZATION
while(ir); //WAITING FOR INTERRUPT
mul=0×10;
for(i=255;i>0;i–); ////wait for first three bits
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=25;i>0;i–);
for(i=114;i>0;i–);
for(bitCount=0;bitCount<5;bitCount++) { for(i=255;i>0;i–); //capture bit address data in pre defined time
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=4;i>0;i–);
if(!ir)
addr|=mul;
mul/=2;
}
mul=0×20;
for(bitCount=0;bitCount<6;bitCount++) { for(i=255;i>0;i–); //capture bit command data in pre defined time
for(i=255;i>0;i–);
for(i=255;i>0;i–);
for(i=4;i>0;i–);
if(!ir)
cmd|=mul;
mul/=2;
}
if(cmd == 12)
{
lcd_cmd(0×80);
lcd_str(” RIGHT COMMAND “);
M1 = 1;
M2 = 0;
buzzer = 1;
delay_ms(10);
M1 = M2 = 0;
buzzer = 0;
lcd_cmd(0xc0);
lcd_str(“DOOR : OPEN “);
}
else if(cmd == 34)
{
lcd_cmd(0×80);
lcd_str(” RIGHT COMMAND “);
M1 = 0;
M2 = 1;
buzzer = 1;
delay_ms(10);
M1 = M2 = 0;
buzzer = 0;
lcd_cmd(0xc0);
lcd_str(“DOOR : CLOSE “);
}
else
{
lcd_cmd(0×80);
lcd_str(” WRONG COMMAND “);
lcd_cmd(0xc0);
lcd_str(“ “);
}
}
}
/**LCD INITIALIZATION FUNCTION**/
void lcd_init(void)
{
lcd_cmd(0×28);
lcd_cmd(0x0C);
lcd_cmd(0×06);
lcd_cmd(0×01);
}
/**LCD COMMAND FUNCTION**/
void lcd_cmd(unsigned char c)
{
LCD=((c & 0xf0) | 0×08);
LCD=0;
LCD=(((c & 0x0f)<<4)|0×08);
LCD=0;
delay_ms(2);
}
/**LCD DATA FUNCTION**/
void lcd_data(unsigned char c)
{
LCD=((c&0xf0)|0x0A);
LCD=0;
LCD=(((c & 0x0f)<<4)|0x0A); LCD=0; delay_ms(2); } /**LCD STRING FUNCTION**/ void lcd_str(unsigned char *s) { while(*s) lcd_data(*s++); } /**MILLI SECONDS DELAY**/ void delay_ms(unsigned int i) { unsigned int j; while(i–>0)
for(j=1000;j>0;j–);
}

venugopal

12 thoughts on “Handheld Vehicle Lock Control System Using Wireless Communication (IR / RF)

  1. the source code contains somany error. dont waste ur time in this project. i request the author pls post the correct code and hex.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in