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

sahar7478
Fri Dec 08 2017, 12:47 PM
can i get gsm a6 library? can anybody help? tia
Faiqa
Sat Nov 25 2017, 08:32 AM
Can i get the code of Monitering and controlling of green house effect? ... Can anyone help me ?
Wed Nov 08 2017, 01:35 PM
Anirudh jain
I want to burn code in atmel 89s51 24pc 0329 but cannot get the connection with the burner. Can somebody provide me with the circuit diagram for connecting controller to burner. I'm using usb burner
Thu Nov 02 2017, 11:44 AM
karpal
write a program to exchange the content of b register with external RAM address 02CFH help me
Wed Nov 01 2017, 05:47 PM
sanae
i am using the DHT11 but i'm getting some errors in the simulate the programe in proteus 8 professional,: 1)cannot find model file 'DHTXX.MDF'.2)simulation failed due to netlist linker error(s).
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

Downloads

Comments

roopay
Wed Dec 13 2017, 07:11 AM
janvimandeep
Mon Dec 11 2017, 01:05 PM
fernanmonroy2
Mon Dec 11 2017, 08:33 AM
sahar7478
Fri Dec 08 2017, 12:34 PM
zhudao
Tue Dec 05 2017, 06:14 AM
chetan6379
Sat Dec 02 2017, 03:42 PM
HaloSpartanOdst
Fri Dec 01 2017, 12:05 PM
workzone
Sat Nov 25 2017, 01:13 PM

Online

Guests: 53, Members: 0 ...

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

Members: 37928
Newest member: roopay
Forum Activity
fernanmonroy2 Avatar
Posted By fernanmonroy2
Mon Dec 11 2017, 08:40 AM
Que significa que el contador de programa abordar...
zhudao Avatar
Posted By zhudao
Wed Dec 06 2017, 03:08 AM
I think either your 120 - 5 volt adapter, or the L...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Dec 05 2017, 08:12 PM
I think either your 120 - 5 volt adapter, or the L...
zhudao Avatar
Posted By zhudao
Tue Dec 05 2017, 06:41 AM
Hi to all, in the period time I'm doing an project...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 20 2017, 10:18 PM
Here is a version of the tutorial that reads a key...
Ansh12 Avatar
Posted By Ansh12
Mon Nov 20 2017, 02:15 AM
As a starting point, can you tell us how much of t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Nov 19 2017, 08:35 PM
As a starting point, can you tell us how much of t...
Ansh12 Avatar
Posted By Ansh12
Fri Nov 17 2017, 04:07 AM
I am looking keypad interfacing program. I was rea...
JardCrocker Avatar
Posted By JardCrocker
Wed Nov 08 2017, 05:29 PM
Hi...i am a new user here. I was also facing the s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 07 2017, 07:13 PM
> It employs a fairly advanced technique to detect...