0 Members and 1 Guest are viewing this topic.

#### coolrp

• Beginner
• Posts: 1
« on: October 08, 2009, 10:42:03 AM »
Hi,My name is Rohan and am new to LFR making...i just developed this 4sensor program to work on a black line using AT89S52....can any1 please go through it and let me know if it is good enough??This is a very basic program....

and also help me how to enhance my program to increase the efficiency of my lfr?

#include<reg52.h>
sbit sl=P3^0;
sbit sml=P3^1;
sbit smr=P3^2;
sbit sr=P3^3;
sbit MRP=P2^0;
sbit MRN=P2^1;
sbit MLP=P2^2;
sbit MLN=P2^3;
void main()
{
while(1)
{
if(sl==0&&sml==0&&smr==0&&sm==0)
{
MRP=MLP=1;
MRN=MLN=0;
}
else if(sl==0&&sml==0&&smr==0&&sm==1)
{
MRP=1;
MLP=MRN=MLN=0;
}
else if(sl==1&&sml==0&&smr==0&&sm==0)
{
MLP=1;
MRN=MRP=MLN=0;
}
else if(sl==1&&sml==0&&smr==0&&sm==1)
{
MRP=MLP=1;
MRN=MLN=0;
}
else if(sl==1&&sml==0&&smr==1&&sm==1)
{
MRP=1;
MLP=MRN=MLN=0;
}
else if(sl==1&&sml==1&&smr==0&&sm==1)
{
MLP=1;
MRN=MRP=MLN=0;
}
else if(sl==1&&sml==1&&smr==1&&sm==1)
{
MRP=MLP=1;
MRN=MLN=0;
}

}
}