?? 新建 文本文檔.txt
字號:
;-----------接口設(shè)置------------
lykey bit p3.2
fykey bit p3.3
NEXT BIT P3.4
REC BIT p1.0
playe bit p1.1
playL bit p1.2
;========================
org 0000h
ajmp main
org 0003h
ajmp ly
org 0013h
ajmp fy
org 0100h
main: mov sp,#80h
mov ie,#85h
SETB P3.2
SETB P3.3
SETB P3.4
;---------------------
MOV R2,#00H
;---------------------
START: JNB NEXT,HERE
AJMP START
HERE: LCALL DELAY10ms
JB NEXT,START
JNB NEXT,$
INC R2
CJNE R2,#0DH,START
MOV R2,#00H
AJMP START
;============================錄音============
LY: CLR EA
PUSH A
PUSH PSW
lcall delay10ms
jb p3.2,LY_EXIT
JNB P3.2,$
MOV A,R2
MOV DPTR,#TAB_1420
MOVC A,@A+DPTR
MOV P2,A
lcall delayL
CLR rec
lcall delay200ms
lcall delay200ms
LCALL DELAY100ms
SETB rec
LY_EXIT:POP PSW
POP A
SETB EA
RETI
;=============================放音===========
FY: CLR EA
PUSH A
PUSH PSW
lcall delay10ms
jb p3.3,FY_EXIT
JNB P3.3,$
MOV A,R2
MOV DPTR,#TAB_1420
MOVC A,@A+DPTR
MOV P2,A
LCALL DELAYL
CLR PLAYE
LCALL DELAY200ms
SETB PLAYE
LCALL DELAY200ms
FY_EXIT:POP PSW
POP A
SETB EA
RETI
;---------------------------
delayL:
mov r3,#0ffh
djnz r3,$
ret
;---------------------------
DELAY10ms:
MOV R7,#10
DELAYA: MOV R6,#0FfH
DELAYB: NOP
NOP
DJNZ R6,DELAYB
DJNZ R7,DELAYA
RET
;----------------------------
DELAY100ms:
MOV R7,#100
DELAYC: MOV R6,#0F9H
DELAYD: NOP
NOP
DJNZ R6,DELAYD
DJNZ R7,DELAYC
RET
;---------------------------
DELAY200ms:
LCALL DELAY100ms
LCALL DELAY100ms
RET
;------------錄音地址表----------------
tab_1420:
db 00h,08h,10h,18h,20h ;01234
db 28h,30h,38h,40h,48h ;56789
db 50h,58h,60h ;點,米,十
;--------------------------------------
END
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -