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.

interface of microcontroller(8051) with ultrasound......

Status
Not open for further replies.

ujwol palanchoke

Newbie level 3
Joined
Oct 27, 2006
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
ultrasonic 8051

i got a project to do and i have to interface 8051 with the ultrasound for range finding.....

here i got a problem....

i am confused how to do it .... i have to send a pulse and wait for only few second till the echo has been received.. and if the echo is not detected within that time i have to reset the counter and repeat the process....

i am confused how to program such thing in 8051....

plz any one have solution......

thanx in advance
 

8051 ultrasound

oh! it is slight easy in case of 8051

it has in build counter
use delay to scan the ultrasound port for 10 seconds
 

i have to send a pulse and wait for only few second till the echo has been received.. and if the echo is not detected within that time i have to reset the counter and repeat the process....

1 second is to long, the measurement periode is only tens of mili-second!

Try this
Code:
;    
Ultra_Out EQU	P3.4           ; Ultra sonic signal output
Echo      EQU P3.5           ; Echo detector
;
Measure:
   SET   TR1                 ; start Timer 1
UntilNull:                   ; 
   JNB   TF1,UntilNull       ; wait until Timer 1 = 0
;
; *** Generate 12 periode ultrasonic wave
;
   MOV   R7,#24              ; Nilai awal R7 = 24
Loop:
   NOP                       ; time to execute 9 x NOP + 1 x CPL
   NOP                       ; = 12 micro-second
   NOP
   NOP
   NOP
   NOP
   NOP
   NOP
   NOP
   CPL   Ultra_Out           ; Ultra_Out (P3.4) := not Ultra_Out
   DJNZ  R7,Loop             ; loop until R7=0
;
; *** Waiting echo signal and timing
;
WaitingEcho:              
   JB    TF1,EchoArrive      ; Timer Over flow -> no echo detected
   JB    Echo,WaitingEcho    ; while Echo (P3.5) = 1
EchoArrive:               
   CLR   TR1                 ; disable Timer 0
   RET
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top