Discussion in "Project Doubts" started by    rammichael    Jul 27, 2017.
Thu Jul 27 2017, 11:39 AM
#1
Hi
I am doing a project on "distance measuring" using ultrasonic sensor with the help of 8051 development board. Present i am just executing in "proteus". Can anybody explain me why there is a delay(0) in get_range function. What is the job of this delay. hELP ME OUT


unsigned int get_range(void)
{
int range=0;
unsigned int s , timerval;
send_pulse();
//delay(40); // generate a delay of 40 Milli seconds=40000 micro
while(echo)
{

}
while(!echo)
{

}
delay(8); // generate a delay of 10 Milli seconds=40000 micro
timerval = TH0;
timerval = (timerval << 8) | TL0;
lcd_cmd(0x81); //
delay(2);
lcd_data_string("range finder:");
lcd_cmd(0xc0); // force cursor to beginning of 2nd line
lcd_data_string("Distance:");
lcd_data_string(0xc9);
if(timerval<35000) //actually you need to use 38000 but the sensor may not work at higher levels
{
range=timerval/59;
s=range/100;
range=range%100;
/*if(s!=0)
//{
lcd_number(s);*/
lcd_data(s+48);
//}
/*else
{
//lcd_cmd(0x06);*/
s=range/10;
range=range%10;
lcd_data(s+48);
lcd_data(range+48);
lcd_data_string("cm");
//led = 0; //}
}
else
{
/*range=0; // indicates that there is no obstacle in front of the sensor
//lcd_cmd(0x06);*/
lcd_data(48);
lcd_data_string("cm");
}
//lcd_data_string("cm");
return range;
}
Thu Jul 27 2017, 07:52 PM
#2
As the pulse is sent, some part of it will be detected by the receiver side.
This delay ensures you are seeing a reflected signal, not the transmit burst.
Fri Jul 28 2017, 06:15 AM
#3
Hai co-administrator,
i just want to know why can not we control the delay by "Echo" pin.

i got the output without delay in proteus.
i did added extra while loop for checking "echo" pin of SENSOR. I am confused now which one is correct way to do this job.
please explain me.
while(echo)
{

}
while(!echo)
{

}
while(echo)
{
led = 1;
}
//delay(8); // generate a delay of 10 Milli seconds=40000 micro
please explain it
thank you in advance


[ Edited Fri Jul 28 2017, 12:44 PM ]
Fri Jul 28 2017, 09:03 PM
#4


i just want to know why can not we control the delay by "Echo" pin.

rammichael


I'm not sure what you are asking.
After you send the pulse, you need a "dead time" when the echo is ignored.
That means a fixed delay.
You will need to post the full code (zipped) and your Proteus simulation
for me to help more.
Sat Jul 29 2017, 05:29 AM
#5
yeah please find the below attachments
My question is how much delay is we required...?
i understood the code only problem is with the delay please explain it.
thank you,

Attachment
Sun Jul 30 2017, 07:37 PM
#6
Hi Keil says..
"smartbin.c was not found"

It seems to be missing from Proteus as well.


[ Edited Mon Jul 31 2017, 02:52 AM ]
Tue Aug 01 2017, 05:06 AM
#7


Hi Keil says..
"smartbin.c was not found"

It seems to be missing from Proteus as well.

ExperimenterUK


hai

sir i copied the program in notepad please add this to above project please find the below attachment.
thank you,

Ram kumar D


[ Edited Tue Aug 01 2017, 09:08 AM ]
Tue Aug 01 2017, 08:20 PM
#8
There is no attachment.
Try zipping it.

Get Social

Information

Powered by e107 Forum System

Conversation

rawat742
Fri Aug 18 2017, 11:37 AM
hi @ angel patel i will attach a file i hope it will be helpfull for you
ExperimenterUK
Mon Aug 14 2017, 09:57 PM
@ angel patel... just log in and post your problem
Mon Aug 14 2017, 01:45 PM
angel patel
hey any one help to make the led scrolling display
desuza6
Sat Jul 29 2017, 07:09 AM
I see the code for step motor h l 298 to rotate 45 degree, but all delay time, if I want to input sensor to h the pulses to stepmotor
rammichael
Thu Jul 27 2017, 12:05 PM
okay fine
ExperimenterUK
Wed Jul 26 2017, 07:51 PM
Please post questions in the forum, the chat box is for chat
msd007
Wed Jul 26 2017, 11:27 AM
i need code if any one have aduc706 interfacing lcd 16*2
msd007
Wed Jul 26 2017, 11:26 AM
pl help me how to write code of interfacing ADuc7026 controlleo lcd pl any one help me hoe to initializend configure the direction
rammichael
Wed Jul 26 2017, 06:04 AM
can you explain what is timer and how to use their modes ...
rammichael
Wed Jul 26 2017, 06:03 AM
ExperimenterUk thank you for your quick reply okay

Downloads

Comments

Pirateak
Thu Aug 17 2017, 02:02 PM
sathishksk71
Wed Aug 16 2017, 04:47 AM
rawat742
Sun Aug 13 2017, 05:49 PM
alparslanbagriyanik
Fri Aug 11 2017, 08:10 AM
Thanhquan
Sat Aug 05 2017, 05:17 PM
NAMRATHA
Thu Aug 03 2017, 08:32 AM
Kgj
Tue Aug 01 2017, 12:41 PM
Ingketech
Sun Jul 30 2017, 01:03 PM

Online

Guests: 53, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37878
Newest member: Pirateak
Forum Activity
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 02:58 PM
Dear Sir, I have a another program in which I am a...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:45 AM
LCD SCROLLING MESSAGE PROGRAM CODE AND SIMULATION...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:24 AM
Dear Sir , I am not able to increased value by pre...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:19 AM
Dear Sir, as per your attachment I w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Aug 17 2017, 10:54 PM
Try this. Attachment ...
rawat742 Avatar
Posted By rawat742
Thu Aug 17 2017, 08:24 PM
Dear Sir , Please help me for stor...
sathishksk71 Avatar
Posted By sathishksk71
Wed Aug 16 2017, 04:53 AM
Hi.. Iam refreshing c language using this useful r...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Aug 14 2017, 10:19 PM
The original 8051 is a primitive device.Over the ...
rawat742 Avatar
Posted By rawat742
Mon Aug 14 2017, 06:52 AM
Dear sir, First of all i want to thanks to you fo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Aug 13 2017, 11:25 PM
Reading page 11 of the data sheet, it is not clear...