Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Automatic room light controller progarm

Status
Not open for further replies.

akhilesh111

Newbie level 1
Joined
Dec 13, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,297
#include<reg51.h>
#include<lcd216.h>

sbit s1_entry = P3^4;
sbit s1_exit = P3^5;

sbit led1 = P2^0;
sbit led2 = P2^1;
sbit led3 = P2^2;
sbit led4 = P2^3;
sbit led5 = P2^4;

unsigned int count;
void delay1(unsigned int);

void int_init();

void main()
{
unsigned char first;
char x,d1,d2,d3;
int count1;
LCD_Init();
led1=1;led2=1;led3=1;led4=1;led5=1;
Disp_Str("POWER SAVING FOR");
LCD_Cmd(0xc0);
Disp_Str(" SHOPPING MALLS ");
delay1(100);
LCD_Cmd(0x80);
Disp_Str(" INITIALY LIGHT ");
LCD_Cmd(0xc0);
Disp_Str(" ON ");
led1=0;
delay1(100);
LCD_Cmd(0x01);
delay1(10);
count = 0;
while(1)
{
x = count/10; d1 = count%10; d2 = x % 10; d3 = x / 10;
LCD_Cmd(0x80); Disp_Str("CNT IN HALL =");
LCD_Data(d3+0x30); LCD_Data(d2+0x30); LCD_Data(d1+0x30);
while(1)
{
if(s1_entry==0) {first = 1;break;}
if(s1_exit==0) {first = 2;break;}
}

if(first==1)
{
while(!s1_entry); while(!s1_exit);
count++;

}
if(first==2)
{
while(!s1_exit); while(!s1_entry);
if(count>0) count--;
}



count1 = 100*d3+10*d2+d1;

if (count1<5)
{ led1=0;led2=1;led3=1;led4=1;led5=1; }

if (count1>=5 && count1<15)
{ led1=0;led2=0;led3=1;led4=1;led5=1; }

if (count1>=15 && count1<25)
{ led1=0;led2=0;led3=0;led4=1;led5=1; }

if (count1>=25 && count1<35)
{ led1=0;led2=0;led3=0;led4=0;led5=1; }
if (count1>=35)
{ led1=0;led2=0;led3=0;led4=0;led5=0; }


delay1(50);

}
getch ();
}

void int_init()
{
IE = 0x85;

}
void delay1(unsigned int dtime)
{
unsigned int i,j;
for (i=0; i<=dtime; i++)
for (j=0; j<=1275; j++);
}
Dear all i m facing error in this program.
If any one know the correction in this program than please suggest me
 

mynul_h

Newbie level 2
Joined
Sep 24, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
the "#include<lcd216.h>" header file do not work. plz give me download link or source code in details ... (mynul_h@gmail.com)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top