//-------------------------------------------------
//名称:可演奏的电子琴
#include<reg51.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xbf};
//0123456789ABCDEF
uint code music[]={64080,64684,64787,
64820,64898,64968,65030,65058,65010,65157,65578};//各音符对应的延时
sbit BEEP = P2^1; //蜂鸣器
uchar KeyNO; //按键序号
//-----------------------------------------------------------------------
//延时
//-------------------------------------------------------------------------
void delayms(unsigned int t)
{
unsigned int i,j;
for(i=0;i<t;i++)
for(j=0;j<120;j++)
}
void Keys_Scan()
{
uchar Tmp,key;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载