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.

[SOLVED] [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

Status
Not open for further replies.

PAIJO SULOYO

Newbie level 4
Joined
Jun 5, 2012
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,322
[MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

Hi
I am newbie, please help me
I wanna to measure echo pulse output from ultrasonic sensor SRF05 to LCD 16x2 (in micro second).
I use AT89S51 with crystal clock 12MHz, trigger out pin P3.1, echo pulse in P3.2, LCD mode 8-bit.
I have try with Assembly code but so difficult because "echo pulse output" is 16-bit.

i need someone to teach me how to do it with Assembly code or other codes.

This my schematic project


this datasheet SRF05
https://www.robot-electronics.co.uk/htm/srf05tech.htm

thanks before
 

Re: [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

Hi,

Echo is not the data it is just the pulse and we have to measure the duration of this high pulse to find the distance.

After you give trigger(10 microsec min) pulse from P3.1.

The ultra sonic sensor transmitter transmits the sound wave and receiver receives the echo.

After you given the trigger pulse, the sensor produce the echo pulse in the echo pin(which connected to the P3.2).
what you have to do is to measure the duration of the pulse.

use the timer to measure the duration. like once the low to high pulse received start the timer and when a high to low pulse received stop
the timer and the timer value is corresponds to the distance ( see the link you given).

U can also use the external interrupt to detect the echos.
 

Re: [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

thnks arunraj1984

Echo is not the data it is just the pulse and we have to measure the duration of this high pulse to find the distance.

yes, i mean duration of high pulse

i have measure it with timer 16 bit, then i save value in 44H/45H --> HIGH/LOW (16 bit)
my problem, i can't display it (value of duration high pulse) in LCD 16x2 (in decimal)

how to do it ?

thnks before
 

Re: [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

Hi,
Now you got the timer count, you just have to do some calculations that's all.

First you need to know the duration of single count(pulse) of your timer.

for that you need to know at which frequency your timer works.

for example,

if it is working of 50 kHz the single pulse duration is 1/50kHz = 20 micro sec.

now you got the duration for single count

the echo pulse duration is 17477(4445H) * 20.

the site which you given show how to calculate the distance from the duration of echo.
 

Re: [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

this my assembly code

Code:
ORG	00H
	
	LCD	EQU	P2
	EN	EQU	P3.5
	RW	EQU	P3.6
	RS	EQU	P3.7
	
START:
	CLR	P3.1
	CLR	RW
	MOV	TMOD,#11H	;SET T1/T0 = 16 BIT
	MOV	TH0,#0F1H	;3600 uS (= 2X 60 X 58)
	MOV	TL0,#0F0H	
	SETB	P3.1		;TRIGGER PULSE 
	CALL	WAIT_TRIGGER
	CLR	P3.1		
	JNB	P3.2,$		
	SETB	TR0		
	
IN_RANGE:
	JB	P3.2,OUT_RANGE	
	CLR	TR0
	CLR	TF0		
	CALL	READ_DATA	
	JMP	START
	
OUT_RANGE:
	JNB	TF0,IN_RANGE	
	CLR	TF0				;RANGE > 3600 uS, STOP COUNTER
	CLR	TR0
	CALL	WAIT_PULSE	;DELAY 10 uS
	CALL	LCD_OUT		;WRITE LCD "OUT OF RANGE"
	JMP	START
	
;-----------------------------------------------------------------------------
READ_DATA:
	CALL	GET_DATA
	CALL	TAMPILKAN
	CALL	WAIT_PULSE	
	RET
	
GET_DATA:
	MOV	40H,TH0		;GET DATA REAL TIME
	MOV	41H,TL0
	MOV	42H,#0F1H	;DATA FROM SETTING TIMER
	MOV	43H,#0F0H
	MOV	A,41H		;REAL - SETTING = DURATION
	CLR	C
	SUBB	A,43H
	MOV	45H,A		;DURATION OF HIGH PULSE /echo out 
	MOV	A,40H		;44H/45H -- HIGH/LOW
	SUBB	A,42H		
	MOV	44H,A	
...........
...........

how to display value in (44H/45H) on LCD (in decimal) ?

thnks before
 

Re: [MOVED] Please Help me !! to measure "Echo Pulse Output " from SRF05 ultrasonic

At last I have solved my problem myself. Thanks to all the posts of edaboard related to my problem. very.. very... very.. thanks to all, thanks to my teachers for supporting me

now i can display it on LCD
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top