Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

distance measurement using ultrasonic using 8051

Status
Not open for further replies.

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
hello i want to make distance measurement using ultrasonic sensor by using 8051 and I want to display it on LCD

I written assembly code but there are some errors..
can any one provide me assembly code for this....

I am attaching my project files
 

Attachments

  • code.rar
    21.9 KB · Views: 274

What errors are you receiving?Which compiler are you using for compiling this code?
 
Did you burn the code on the Microcontroller IC?Are you using AT89C51,or 8051 IC?
Did you run the program with the hardware(power supplies,sensor,LCD)?
Can you describe the exact error(s) you are facing?They are hardware related...right?Because as per the LST file,compilation has been performed successfully.
 
Last edited:

I am using Keil uvision....
and in project I used 89s52
I burned hex file of above code.....the problem is no data is displayed on LCD....and it is not converting time into distance...
there are two problems one is distance which is calculated by time...
second is the data which is converted in distance(cm) on LCD is not displaying
 
I was going through the code..and It seems to me that you have put,in your program,a loop to send ASCII data, but that ASCII data which you intend to send to the LCD is missing.I think you should add that.And secondly,If the LCD is blank,as you are saying,then maybe the commands *are* getting sent to the LCD unit.So before you add the ASCII data,can you check whether the cursor continuously flickers in the position as per program?
 

yes I checked LCD it's not continuously flickers...!!!

can you correct my program....??
 

I want to convert 16 bit data which is stored in TH and TL into ASCII.....how do I convert and display on LCD
data is nothing but timer start and stop values.!!!
 

Send TH + 0x30 and TL + 0x30 to LCD character printing routine.
 

I dont understand .......what is the reason behind that....I just want to calculate Distance and display on LCD
 

TH and TL values doesn't give you distance. It gives timer value and you have to calculate distance from remaining value in TH and TL and also any additional counter you used for timer interrupt. You get int value and to convert int value to character for displaying it on LCD you have to split the integer into digits and convert each digit to ASCII char by adding 0x30.

Use US Sensors which can be interfaced to UART and which gives direct distance value in cm(s). You can get rid of using timers and calculating distance.
 

@milan.rajik well hello.....

I able to make interfacing program for HC-SR04 ultrasonic seonsor with AT89S52....
I did everything as you told me.... but there is problem...with accurate distance.....I am not getting accurate distance in (cm)....
I attached program code below with some my project images....can you tell me what is the problem in my code...
IMG_20140402_220032.jpgIMG_20140402_220122.jpg
 

Attachments

  • distancemesr code.rar
    12 KB · Views: 170

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top