簡易電子琴的設計
INT_0: ;中斷程序
DJNZ R0,RE ;R0不等于0時,返回
CPL P1.0
MOV A,R1
MOV R0,A
RE: RETI
DELAY:MOV R7,#100 ;延長時間等待,鍵盤消抖
D1: MOV R6,#10
D2: DJNZ R6,D2
DJNZ R7,D1
RET
END
生日快樂歌:(擴展功能部分程序)
ORG 0000H
JMP MAIN
ORG 000BH
JMP TT0
MAIN: MOV TMOD,#01H ;設置定時器0工作方式
MOV IE,#82H ;設置中斷
MAIN0:MOV 30H,#00H
NEXT: MOV A,30H
MOV DPTR,#TABLE ;查表
MOVC A,@A+DPTR
MOV R2,A
JZ STOP
ANL A,0FH
MOV R5,A
MOV A,R2
SWAP A
ANL A,#0FH
JNZ SING
CLR TR0
JMP W1
SING: DEC A
MOV 22H,A
RL A
MOV DPTR,#TABLE1 ;查表
MOVC A,@A+DPTR
MOV TH0,A
MOV 21H,A
MOV A,22H
RL A
INC A
MOVC A,@A+DPTR
MOV TL0,A
MOV 20H,A
SETB TR0
W1: CALL DELAY
INC 30H
JMP NEXT
STOP: CLR TR0
JMP MAIN0
TT0: PUSH ACC ;中斷服務程序
PUSH PSW
MOV TL0,20H
MOV TH0,21H
CPL P1.0
POP PSW
POP ACC
RETI
DELAY:MOV R7,#2 ;延時187ms
W2: MOV R4,#187
W3: MOV R3,#248
DJNZ R3,$
DJNZ R4,W3
DJNZ R7,W2
DJNZ R5,DELAY
RET
TABLE1:DW 64260,64400,64524,64580 ;音符計數(shù)植
DW 64684,64777,64820,64898
DW 64968,65030,65058,65110
DW 65157,65178,65217
TABLE:DB 82H,01H,81H,94H,84H ;節(jié)拍表
DB 0B4H,0A4H,04H
DB 82H,01H,81H,94H,84H
DB 0C4H,0B4H,04H
DB 82H,01H,81H,0F4H,0D4H
DB 0B4H,0A4H,94H
DB 0E2H,01H,0E1H,0D4H,0B4H
DB 0C4H,0B4H,04H
DB 82H,01H,81H,94H,84H
DB 0B4H,0A4H,04H
DB 82H,01H,81H,94H,84H
DB 0C4H,0B4H,04H
DB 82H,01H,81H,0F4H,0D4H
DB 0B4H,0A4H,94H
DB 0E2H,01H,0E1H,0D4H,0B4H
DB 0C4H,0B4H,04H
DB 00H
看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
相關推薦
-
-
-
武松打虎 | 2004-03-27
-
hpnet | 2003-05-20
-
-
-
taxigo | 2005-04-28
-
younghuang | 2004-08-12
-
-
-
-
hwenlong | 2005-03-20
評論