程序我改动过了,在开发板上可以实现,就是这是老点的儿歌,我根本没听出来......
附件加上电子书
大家可以看看
我正在改动我的点歌系统,希望能实现
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit P1_1=P1^1;
/*
uchar code MUISIC_SOUNDLONG3[]=
{//三轮车
6,6,9,3,6,6,12,
6,6,6,6,6,6,12,
6,6,9,3,6,6,9,3,
6,3,3,6,3,3,6,6,9};
uchar code MUISIC_SOUNDTONG3[]=
{//三轮车
239,239,212,189,159,159,189,
159,159,142,126,120,120,159,
120,120,142,159,189,142,159,189,
239,212,189,159,142,159,189,212,239};
*/
uchar code MUISIC_SOUNDLONG3[]=
{
//彩虹妹妹
12,6,6,12,6,6,6,12,6,24,
12,6,6,12,6,6,6,12,6,24,
12,6,6,6,6,6,6,
6,12,6,24,12,12,12,6,6,
6,12,6,24
};
uchar code MUISIC_SOUNDTONG3[]=
{
//彩虹妹妹
142,159,189,142,159,189,142,142,159,142,
142,159,189,142,159,189,212,212,239,212,
189,189,159,142,120,142,159,
189,189,159,239,189,189,189,189,189,
142,142,159,142//end
};
void delay(uint z)//普通延时
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main()
{
uchar k,i,j;
uchar SoundLong,SoundTone;
uint m;
for(i=0;i<31;i++)
{
SoundLong=MUISIC_SOUNDLONG3;
SoundTone=MUISIC_SOUNDTONG3[j];
for(j=0;j<SoundLong;j++)
{
for(k=0;k<12;k++)
{
for(m=0;m<SoundTone*1;m++)
P1_1=0;
for(m=0;m<SoundTone*1;m++)
P1_1=1;
}
}
delay(30);
}
}