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

Thu Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html

Downloads

Comments

pyxus
Sat Dec 14 2019, 12:31 PM
Istika
Thu Dec 12 2019, 12:04 PM
nabiha_anaya
Sun Dec 08 2019, 09:16 AM
ananyagupta
Tue Dec 03 2019, 07:53 AM
wells
Mon Nov 25 2019, 08:25 PM
auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM

Online

Guests: 40, Members: 0 ...

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

Members: 38110
Newest member: pyxus
Forum Activity
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 02:26 PM
wil do.thank you for your advice!
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 07:13 AM
Something like this ?https://www.bing.com/videos/s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 06:58 AM
The layout is a bit different, but it is the same ...
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 04:38 AM
https://i.imgur.com/6S5FcwF.png right now im follo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Dec 10 2019, 04:49 PM
ilylily07 Avatar
Posted By ilylily07
Sun Dec 08 2019, 01:24 PM
Hi .im humbly ask for your advice as i wrongly pur...
nabiha_anaya Avatar
Posted By nabiha_anaya
Sun Dec 08 2019, 09:19 AM
My teacher assign me a project on "voice control h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 29 2019, 04:24 AM
" Is it possible to interface a fingerprint scanne...
ilylily07 Avatar
Posted By ilylily07
Thu Nov 28 2019, 03:50 PM
You will not find any code for an 8051 as no one w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 26 2019, 05:44 PM
You will not find any code for an 8051 as no one w...