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

Fri Sep 29 2017, 02:45 AM
Maaz
i am doing the same project on verilog please contact me [email protected]
Wed Sep 20 2017, 12:36 AM
Ted
In a missing pulse detector using a 555 timer connected as a monostable vibrator with a PNP transistor,how does the positve input pulse turn on the PNP transistor?
Sun Sep 03 2017, 02:29 PM
martymarty
How do I connect an <NOKIA 1100 LCD > to an atmega328P ?
poojab51296
Sun Aug 20 2017, 10:23 AM
i am intending to interface sd card with STM32F4 and want to write a file in sd card using SPI protocol but using HAL only. Can anyone help me PLEASE!!!!
poojab51296
Sun Aug 20 2017, 10:22 AM
hello
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

Downloads

Comments

bvdb
Wed Oct 18 2017, 01:45 AM
TinkeringJoe
Sun Oct 15 2017, 02:23 AM
Tubai96
Thu Oct 12 2017, 05:30 PM
roberttku
Thu Oct 12 2017, 08:02 AM
Bdavid.sam
Mon Oct 09 2017, 02:23 PM
SUNSHINE
Thu Oct 05 2017, 03:54 AM
Dogg4live77
Wed Oct 04 2017, 01:58 AM
RajeSH190295
Mon Oct 02 2017, 10:08 AM

Online

Guests: 59, Members: 0 ...

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

Members: 37902
Newest member: bvdb
Forum Activity
bvdb Avatar
Posted By bvdb
Wed Oct 18 2017, 01:50 AM
I purchased the RKitL51 8051 C compiler from Raiso...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Oct 16 2017, 11:44 PM
That looks complicated.Is 8051_BLK a standard 80...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 15 2017, 07:29 PM
According to this, gmail should support POP3.https...
Help Avatar
Posted By Help
Sun Oct 15 2017, 03:21 AM
AT+POP3READ=? +POP3READ: (1-1460) OK AT+POP3READ=...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Oct 14 2017, 08:06 PM
What happens if you ask for the full email ieAT+PO...
Help Avatar
Posted By Help
Sat Oct 14 2017, 02:28 AM
Dear all, AT // OK // 3.1 Bearer profile // Conf...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Oct 12 2017, 01:04 AM
I don't think the 0804 works as it should in Prote...
Bdavid.sam Avatar
Posted By Bdavid.sam
Wed Oct 11 2017, 01:54 AM
Are you simulating in Orcad ?Please post your cod...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Oct 10 2017, 09:43 PM
Are you simulating in Orcad ?Please post your cod...
Bdavid.sam Avatar
Posted By Bdavid.sam
Mon Oct 09 2017, 02:38 PM
Hello, This might be a beginner’s mistake but I a...