You are on page 1of 1

/*OVER FLOW INDICATOR FOR WATER TANK WITH AUTO CUT OFF USING 8052 MCU*/

#include<reg51.h>
#include<stdio.h>
#include<lcd.h>

sbit sw1=p0^0;
sbit sw2=p0^1;

sbit pump=p0^4;
sbit led1=p0^5;
unsigned char ch;
sbit rw=p2^0;
sbit rs=p2^1;
sbir en=p2^2;
void msdelay(unsigned int itime);
void main()
{
while(1)
{
if(sw1==1) // tank empty
{
pump=1; // water pump ON
led1=1; //led indication
}
if(sw2==1) // tank full
{
pump=0; // motor off
led1=0; // LED indications
}
}
}

void msdelay(unsigned int itime)


{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<125;j++);
}

You might also like