云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 基于C51单片机电子琴的设计与实现

基于C51单片机电子琴的设计与实现

  • 62 次阅读
  • 3 次下载
  • 2025/5/4 5:51:04

0x19,0x03,0x19,0x03, 0x1F,0x03, 0x1B,0x03, 0x1F,0x00, 0x18,0x02, 0x18,0x03, 0x1A,0x03, 0x19,0x0D, 0x15,0x03, 0x15,0x02,0x18,0x66, 0x16,0x02, 0x17,0x02, 0x15,0x00, 0xff,0xff};

unsigned char code Music_Code[]={ 0xf8,0x8b,0xf9,0x5b,0xfa,0x14,0xfa,0x66,

10001011

0xfb,0x03,0xfb,0x8f,0xfc,0x0b,0xfd,0xee};

//11111000,

unsigned char const yinfu1[3][14]={

{0xf8,0x8b,0xf9,0x5b,0xfa,0x14,0xfa,0x66,0xfb,0x03,0xfb,0x8f,0xfc,0x0b}

{0xfc,0x43,0xfc,0xab,0xfd,0x08,0xfd,0x33,0xfd,0x81,0xfd,0xc7,0xfe,0x05}

{0xfb,0x21,0xfe,0x55,0xfe,0x84,0xfe,0x99,0xfe,0xc0,0xfe,0xe3,0xff,0x02}}; //11111000, 10001011

unsigned char const length[]={1,2,4,8,16,32,64}; unsigned char sth,stl;

void delay_ms(unsigned int k) { // 12M unsigned int i0; unsigned char i,j;

for(i0=0;i00;i--) for(j=97;j>0;j--); }

void Sys_Init() {

TMOD=0x10; EA=1; ET1=1; P1=0xff; }

uchar Get_Key () {

uchar i,temp; P1=0xff; temp=P1; for(i=0;i<8;i++) {if(temp==keymode[i]) return i; } return 8;

}

void Play(uchar key) { uchar j; if(key==7) { TR1=1;

for(j=0; Music_hzcb[j]!=0xff;j++) {

keycode=Music_hzcb[j]; delay_ms(10);

sth=yinfu1[(Music_hzcb[j]0)/10-1][((Music_hzcb[j])-1)*2];

stl=yinfu1[(Music_hzcb[j]0)/10-1][((Music_hzcb[j])-1)*2+1];

j++;

TR0=1;

delay_ms(4*500/length[Music_hzcb[j]]);

TR0=0; }

for (;;) {

}

else { TR1=1; keycode=key; } }

void timer1(void) interrupt 3 { buz=~buz;

TH1=toneh[keycode]/256; TL1=toneh[keycode]%6; }

void main() {

Sys_Init(); do

while(P3==0x7f); delay_ms(10); if(P3==0x7f) continue; else break; }

using 1

搜索更多关于: 基于C51单片机电子琴的设计与实现 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

0x19,0x03,0x19,0x03, 0x1F,0x03, 0x1B,0x03, 0x1F,0x00, 0x18,0x02, 0x18,0x03, 0x1A,0x03, 0x19,0x0D, 0x15,0x03, 0x15,0x02,0x18,0x66, 0x16,0x02, 0x17,0x02, 0x15,0x00, 0xff,0xff}; unsigned char code Music_Code[]={ 0xf8,0x8b,0xf9,0x5b,0xfa,0x14,0xfa,0x66, 10001011 0xfb,0x03,0xfb,0x8f,0xfc,0x0b,0xfd,0xee}; //11111000,unsigned c

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com