新建 文本文档.txt
来自「专用语音芯片ISD1420资料打包,内容丰富,不可错过哦.」· 文本 代码 · 共 121 行
TXT
121 行
;-----------接口设置------------
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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?