单片机电子琴电路图及源程序代码
实验仿真图
源程序代码:(弹奏部分代码暂时去掉,见谅,需要的留言,转载请注明出处,谢谢!)
MAIN:
MOV DPTR,#LED0
MOV A,#00H
MOVX @DPTR,A
NEXT:
;确定不同歌曲的基地址
START1:
START2:
START3:
;键盘弹奏程序入口
KEYPLAY:
;确定高中低音基地址
LOWTONE:
MIDDLETONE:
HIGHTONE:
;歌曲播放程序
NEXT1: MOV DPTR,#SEG7
SING:
D1:
END0:
;按键查询程序
KEY:
;按键软件防抖动程序
M0:
M1:
M2:
M3:
M4:
M5:
M6:
;确定按键的偏移地址程序
M00:
M11:
M22:
M33:
M44:
M55:
M66:
;按键音弹奏程序
;音符对应的定时器初值表:
TABLE1:
DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
LOWTABLE:
DW 63628,63835,64021,64103,64260,64400,64524
MIDDLETABLE:
DW 64580 ,64684,64777,64820,64898,64968,65030
HIGHTABLE:
DW 65058,65110,65157,65178,65217,65252,65283
SEG7:
DB 06H, 5BH, 4FH,66H, 6DH, 7DH,07H
;音符节拍表:
TABLE:
DB 02H,82H
DB 16H,32H,54H,02H,52H
DB 0A6H,32H,54H,02H,52H
DB 64H,74H,0B6H,64H
DB 52H,5CH,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,12H,94H,22H,32H
DB 2CH
DB 32H,52H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 96H,0A2H,96H,82H
DB 3CH,54H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 16H,12H,14H,22H,32H
DB 2CH,02H,82H
DB 16H,32H,56H,12H
DB 0A6H,32H,56H,52H
DB 66H,72H,0B6H,62H
DB 62H,52H,58H,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,92H,0A4H,12H,22H
DB 1CH
DB 00
TABLE2:
DB 88h,14h,24h,36H,42H,34H,14H,28H,14H,94H
DB 1fH,88H,14H,24H,34H,32H,42H,54H,14H
DB 46H,32H,54H,22H,32H,32H,22H,2CH,38H,54H,74H
DB 76H,62H,68H,54H,52H,62H,74H,62H,52H,3fH
DB 46H,42H,54H,64H,54H,42H,32H,28H,0a4H,0a2H
DB 92H,84H,94H,1fH,0b8H,68H,46H,52H,68H
DB 74H,72H,72H,74H,62H,52H,3fH,0b8H,68H
DB 46H,52H,68H,64H,62H,62H,64H,42H,32H,2fH
DB 58H,14H,24H,36H,42H,34H,12H,12H,26H,22H,24H,22H,12H
DB 94H,9cH,0a8H,0a6H,92H,84H,64H,54H,22H,22H,46H,42H,44H,32H,22H,5fH
DB 00
TABLE3:
DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,94H,1cH
DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,22H,12H,1cH,32H,52H
DB 62H,64H,62H,64H,0b2H,62H,52H,54H,62H,54H,32H,22H
DB 12H,14H,12H,14H,24H,3cH,32H,22H,12H,14H,12H,14H,0b2H,62H,52H,54H,62H,54H,32H,52H
DB 66H,0b2H,0b4H,62H,52H,5cH,32H,52H,62H,64H,62H,64H,0b2H,62H,52H,54H
DB 62H,54H,32H,22H,12H,14H,12H,14H,54H,3cH,32H,22H,12H,14H,12H,14H,22H,32H
DB 52H,54H,32H,54H,32H,52H,6fH,04H,02H,92H,32H,24H,12H,1fH
DB 00
单片机电子琴程序代 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)