Microcontroller › 8051 › Interfacing AT89S51 with ultrasonic sensor and LCD › hey nidhin.k can you explain
February 3, 2013 at 6:00 pm
#9090
zulnorain
Participant
hey nidhin.k can you explain this section of the code:
void Distance_Measure()
{
count=count1=0;
TH0=0x00;TL0=0x00;
TR0=0;
for(i=0;i<10;i++)
{
TX=0;
Delay(1000);
TX=1;
Delay(10);
TX=0;
while(RX==0);
TR0=1;
while(RX==1);
TR0=0;
count=TH0<<8;
count=count|TL0;
TH0=TL0=0x00;
count1=count1+count;
Delay(5000);
}
count=count1/10;
inch1=count%10000/1000;
inch2=count%1000/100;
result=(inch1*10)+inch2;
obj_distance=result-2;
Lcd8_Decimal3(0XCb,obj_distance);
}