51单片机制作电子琴
unsigned char tone;
unsigned char op;
sbit led=P1^1;
sbit spk=P1^0;
sbit key1=P3^2;
sbit key2=P3^3;
unsigned char code shuma[]={
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
//用于使定时器初值变化以产生相应频率的定时
unsigned char code yinfu_H[]=
{0xfb,0xfc,0xfc,0xfc,0xfd,0xfd,0xfd,0xfd,0x00};
unsigned char code yinfu_L[]=
{0xe9,0x5c,0xc1,0xef,0x45,0x92,0xd0,0xee,0x00};
void delay(unsigned int N)
{
}
unsigned
{1,2,3,1,1,2,3,1,3,4,5,3,4,5,5,6,5,4,3,1,5,6,5,4,3,1,3,1,1,3
,1,1};//两只老虎乐谱
unsigned
{220,220,220,220,220,220,220,220,220,220,235,220,220,210,150
,150,
170,170,200,200,150,150,170,170,200,200,244,240,250,244,220,
250};
//定时器初始化
void initTimer(void)
{
}
//定时器T0中断服务程序
void timer0(void) interrupt 1
{
}
void laohu_yz()//两只老虎 演奏程序
{
}
void yuep_yz()//1~i音符演奏程序
{
}
void jianpan()
{
}
//主程序
void main(void)
{
while(1)
else if(key2==0)//判断K2键是否按下
}
51单片机电子 相关文章:
- 51单片机电子时钟程序(12-01)
- 基于51单片机的电子记分牌C程序编程(12-01)
- 51单片机电子钟制作-升级版(11-29)
- 51单片机电子时钟(11-29)
- 51单片机电子琴C代码(11-27)
- 通过51单片机实现电子时钟功能并通过LCD1602显示(11-26)