开发工具:
文件大小: 4kb
下载次数: 0
上传时间: 2010-03-23
详细说明: ORG 00H ;初始化程序 JMP START ORG 0BH LJMP TIM0 START:MOV TMOD,#00000001B ;主程序 MOV IE,#10000010B JB P3.5, $ CALL DELAY1 JNB P3.5, $ MOV 31H,#00 START0: MOV 30H,#SONG NEXT: MOV A,30H MOV DPTR,# TABLE MOVC A,@A+DPTR MOV R2,A JZ END0 ANL A,#0FH MOV R5,A MOV A,R2 SWAP A ANL A,#0FH JNZ SING CLR TR0 JMP D1 SING: DEC A MOV 22H,A RL A MOV DPTR,#TABLE 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 D1: CALL DELAY INC 30H JMP NEXT END0: CLR TR0 MOV A,31H XRL A,#00H JNZ END1 JB P3.5,$ CALL DELAY1 JNB P3.5,$ INC 31H MOV 30H,#SONG1 JMP NEXT END1: MOV A,31H XRL A,#01H JNZ END2 JB P3.5,$ CALL DELAY1 JNB P3.5,$ INC 31H MOV 30H,#SONG2 JMP NEXT END2: MOV A,31H XRL A,#02H JNZ END3 JB P3.5,$ CALL DELAY1 JNB P3.5,$ INC 31H MOV 30H,#SONG3 JMP NEXT END3: MOV A,31H XRL A,#03H JNZ END4 JB P3.5,$ CALL DELAY1 JNB P3.5,$ INC 31H MOV 30H,#SONG4 JMP NEXT END4: MOV A,31H XRL A,#04H JNZ END5 JB P3.5,$ CALL DELAY1 JNB P3.5,$ INC 31H MOV 30H,#SONG5 JMP NEXT END5: JMP START TIM0: PUSH ACC ;定时器T0子程序 PUSH PSW SETB RS0 CLR RS1 MOV TL0,20H MOV TH0,21H CPL P1.0 POP PSW POP ACC RETI DELAY: ;延时子程序 MOV R7,#02 D2: MOV R4,#125 D3: MOV R3,#248 DJNZ R3,$ DJNZ R4,D3 DJNZ R7,D2 DJNZ R5,DELAY RET DELAY1: MOV R4,#20 D4: MOV R3,#248 DJNZ R3,$ DJNZ R4,D4 RET ORG 300H ;定时常数T值表 TABLE: DW 64260,64400,64524,64580 DW 64684,64777,64820,64898 DW 64968,65030,65058,65110 DW 65157,65178,65217 ;音符节拍码数据表 SONG: ;生日快乐 ;1 DB 82H,01H,81H,94H,84H DB 0B4H,0A4H,04H DB 82H,01H,81H,94H,84H DB 0C4H,0B4H,04H ;2 DB 82H,01H,81H,0F4H,0D4H DB 0B4H,0A4H,94H DB 0E2H,01H,0E1H,0D4H,0B4H DB 0C4H,0B4H,04H DB 00H SONG1: ;两只老虎 ;1 DB 44H,54H,64H,44H DB 44H,54H,64H,44H DB 64H,74H,88H DB 64H,74H,88H ;2 DB 82H,92H,82H,72H,64H,44H DB 82H,92H,82H,72H,64H,44H DB 44H,84H,48H DB 44H,14H,48H DB 00H SONG2: ;三只小猫 ;1 DB 62H,82H,82H,62H,98H DB 92H,0B2H,0B2H,82H,98H DB 62H,82H,82H,52H,68H DB 92H,0B2H,0B2H,82H,98H ;2 DB 62H,82H,82H,62H,92H,92H,94H DB 92H,0B2H,0B2H,92H,84H,94H DB 0B8H,0B4H,04H DB 00H SONG3: ;哈巴狗 ;1 DB 42H,42H,42H,52H,64H,04H DB 62H,62H,62H,72H,84H,04H DB 92H,92H,82H,72H,64H,04H DB 82H,82H,52H,62H,44H,04H ;2 DB 42H,42H,42H,52H,64H,04H DB 62H,62H,62H,72H,84H,04H DB 92H,92H,82H,72H,64H,04H DB 82H,82H,52H,62H,44H,04H DB 00H SONG4: ;不倒翁 ;1 DB 84H,94H,88H DB 64H,54H,68H DB 84H,64H,54H,44H DB 62H,82H,42H,62H,58H ;2 DB 84H,94H,88H DB 64H,54H,68H DB 84H,64H,54H,44H DB 52H,42H,52H,62H,48H DB 00H SONG5: ;妹妹背着洋娃娃 ;1 DB 84H,02H,82H,64H,54H DB 64H,54H,48H DB 64H,02H,52H,44H,24H DB 14H,24H,18H ;2 DB 24H,02H,22H,42H,24H DB 44H,54H,68H DB 54H,02H,52H,84H,84H DB 54H,64H,48H DB 00H END ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.