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

Sat Jul 21 2018, 11:51 AM
Dibakar Bhanja Chowdhury
By using a 555 timer how can I expand the range of the mobile phone jammer? Please reply me asap
Sun May 20 2018, 03:31 PM
justinb
how to write and execute a program that read the keypad button and display the number on 7 segment on intel8051 at89s52 in assembly language?
Thu May 17 2018, 12:06 PM
HAMZA TAJ
sir iwant to ask about controller of three phase supply by using back to back thyristor instead of triac....will u give me some guideline?
Sat Apr 28 2018, 06:24 PM
ashutosh jain
IR Remote Switch using TV remote (RC5 Protocol) is not working properly. opp1 & opp2 is in problem.plz help
ExperimenterUK
Sat Apr 28 2018, 01:39 AM
@kaiserslautern Post in forum
Wed Apr 25 2018, 12:39 PM
kaiserslautern
Hello everyone, using software uart is a very good idea for a second serial port. Thank you so much. I would kindly like to know how to connect this port to the PC?
ExperimenterUK
Sun Apr 22 2018, 01:20 AM
This is a community site. Feel free to help anyone needing advice
hareeshchamiyar
Thu Mar 29 2018, 04:17 PM
please help me for the configuration bits for dspic30f2010
hareeshchamiyar
Thu Mar 29 2018, 04:15 PM
can any one using dspic30f2010.
Thu Mar 29 2018, 11:33 AM
Neena
can anybody give solar tracking in 8051 using proteus and keil to mail [email protected]

Downloads

Comments

bdmehta
Tue May 22 2018, 02:30 AM
kmag1953
Sun Apr 29 2018, 07:09 PM
udiwonder
Sat Apr 28 2018, 12:41 PM
pirpiri
Sat Apr 21 2018, 03:35 PM
Pater
Fri Apr 20 2018, 02:38 PM
jamiel
Sat Apr 14 2018, 12:47 AM
akrepkral76
Wed Apr 04 2018, 07:51 PM
samanthaeaves
Mon Apr 02 2018, 06:27 AM

Online

Guests: 51, Members: 0 ...

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

Members: 37998
Newest member: bdmehta
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jul 17 2018, 08:31 PM
Thank you.I'm happy it worked out for you.
LAMBO Avatar
Posted By LAMBO
Tue Jul 17 2018, 09:52 AM
hi sir sorry for the late reply thank u sir for he...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Jul 12 2018, 08:27 PM
I'm glad we got there in the end :)>whats differen...
LAMBO Avatar
Posted By LAMBO
Thu Jul 12 2018, 06:51 AM
hi sir as u mentioned above to change crystal and ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jul 10 2018, 07:20 PM
I assume you meant a AT89S52.It seems to me that...
LAMBO Avatar
Posted By LAMBO
Tue Jul 10 2018, 06:06 AM
hi sir i have checked now much of the distortion ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Jul 09 2018, 06:55 PM
Okay that is very interesting.I have attached two ...
LAMBO Avatar
Posted By LAMBO
Mon Jul 09 2018, 08:14 AM
hi sir as u mentioned above program i have tried ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jul 06 2018, 11:58 PM
Okay..That motor creates a lot of sparks which mig...
LAMBO Avatar
Posted By LAMBO
Fri Jul 06 2018, 01:33 PM
hi sir as u told >Try the original code againi hav...