资源介绍
/*************************************************
*文件名称: PlayMusic.c
*作 者:
*版 本: V1.00
*环 境: Keil uVision4
*说 明: 单片机演奏音乐实验
*修改记录: 2012.5
--------------------------------------------------
*Descriptoon: 演奏世上只有妈妈好
*接线说明: P30——蜂鸣器
**************************************************/
#include
#define uchar unsigned char
#define uint unsigned int
sbit speaker=P3^0;
uchar timer0h,timer0l,time;
//世上只有妈妈好数据表
uchar code jiepai[]={ 3,1,2,2, 2,1,1,4, 2,1,1,2,2, 1,1,1,1,4,
3,1,2,1,1, 2,2,4, 3,1,1,1,1,1, 6
};
uchar code FREQH[]={0xFD,0xFD,0xFD,0xFD, 0xFE,0xFD,0xFD,0xFD,
0xFD,0xFD,0xFD,0xFD,0xFD, 0xFC,0xFB,0xFD,0xFD,0xFC,
0xFC,0xFD,0xFD,0xFD,0xFD, 0xFD,0xFC,0xFC,
0xFD,0xFD,0xFC,0xFC,0xFB,0xFC, 0xFB
};
uchar code FREQL[]={0xF4,0xB4,0x44,0xB4, 0x47,0xF4,0xB4,0xF4,
0x44,0xB4,0xF4,0xB4,0x44, 0x8F,0xE9,0xB4,0x44,0xEE,
0xEE,0x44,0xB4,0xB4,0xF4, 0x44,0xEE,0x8F,
0xB4,0x44,0xEE,0x8F,0xE9,0x8F, 0x68
};
void delay(uchar t) //延时大约250ms
{
uchar t1;
unsigned long int t0;
for(t1=0;t1=34) m=0;
}
}
}