单片机超声波传感器测量距离
mova,r7
jz dela1
inc r6
dela1: mov r5,#50d
djnz r5, $
djnz r7,dela1
djnz r6,dela1
pop acc
ret
end
NAME DISPLAY
?PR?_DISPLAY?display segment code
?co?_DISPLAY?display segment data
EXTRN CODE (_DELAY)
PUBLIC _DISPLAY
RSEG ?CO?_DISPLAY?DISPLAY
?_display?byte:
dispbit: ds 1
dispnum: ds 1
rseg ?pr?_display?display
_display: push acc
push dph
push dpl
push psw
inc dispnum
mov a,dispnum
cjne a,#4d,disp1
DISP1: JC DISP2
MOV DISPNUM,#00H
MOV DISPBIT,#0FEH
DISP2: MOV A,R1
ADD A,DISPNUM
MOV R0,A
MOV A,@R0
MOV DPTR,#DISPTABLE
MOVC A,@A+DPTR
MOV P0,A
MOV A,DISPNUM
CJNE A,#2D,DISP3
CLR P0.7
DISP3: MOV P2,DISPBIT
MOV R5,#00H
MOV R7,#0AH
LCALL _DELAY
MOV P0,#0FFH
MOV P2,#0FFH
MOV A,DISPBIT
RL A
MOV DISPBIT,A
POP PSW
POP DPL
POP DPH
POP ACC
RET
DISPTABLE: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,88H,83H,0C6H,0A1H,86H,8EH,0BFH,0FFH
END
单片机超声波传感器测量距 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)