mhe
Junior Member level 1
ultrasonic 8051
hi ,i will create a project distance finder with 89c51 and ultrasonic sensor.i use assembly language.but i have any problem.i create a40khz freq and send it then i start timer and with first trigger in reciver i stop timer.i obtain 2 value in TL1,TH1.well i want conver 2 byte
TH1,TL1 to a word and then (word/2) * 340(speed of sound) and show in seven segment.i write afew program but i cant commpleate calculate and show TH1,TL1. please commpleate it or help me.plzzzzzzzzzzzz
ORG 0H
MOV P0,#0FFH
MOV P1,#0
LJMP MAIN
ORG 0013H
SETB TR1
HERE: JNB INT1,HERE
CLR TR1
MOV R0,TL1
MOV R1,TH1
LJMP CAL
;====================FREQ=========
FREQ: SETB TR0
H: JNB TF0,H
CLR TR0
CLR TF0
CPL P2.0
SJMP FREQ
;============MAIN========
ORG 30H
MAIN: MOV IE,#10000100B
MOV TMOD,#12H
MOV TH0,#-12
MOV TL1,#0
MOV TH1,#0
F: JB P0.0,F
SJMP FREQ
;===============CALCULATE=======
.
.
.
hi ,i will create a project distance finder with 89c51 and ultrasonic sensor.i use assembly language.but i have any problem.i create a40khz freq and send it then i start timer and with first trigger in reciver i stop timer.i obtain 2 value in TL1,TH1.well i want conver 2 byte
TH1,TL1 to a word and then (word/2) * 340(speed of sound) and show in seven segment.i write afew program but i cant commpleate calculate and show TH1,TL1. please commpleate it or help me.plzzzzzzzzzzzz
ORG 0H
MOV P0,#0FFH
MOV P1,#0
LJMP MAIN
ORG 0013H
SETB TR1
HERE: JNB INT1,HERE
CLR TR1
MOV R0,TL1
MOV R1,TH1
LJMP CAL
;====================FREQ=========
FREQ: SETB TR0
H: JNB TF0,H
CLR TR0
CLR TF0
CPL P2.0
SJMP FREQ
;============MAIN========
ORG 30H
MAIN: MOV IE,#10000100B
MOV TMOD,#12H
MOV TH0,#-12
MOV TL1,#0
MOV TH1,#0
F: JB P0.0,F
SJMP FREQ
;===============CALCULATE=======
.
.
.