欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機-7鍵電子琴 [打印本頁]

作者: 18893257326    時間: 2018-5-7 13:51
標題: 單片機-7鍵電子琴
//主文件
#include "common.h"
uint code xSound[]={63624,63832,64019,64104,64260,64399,64523};
uchar keyValue[][2]={{0xfe,0},{0xfd,1},{0xfb,2},{0xf7,3},{0xef,4},{0xdf,5},{0xbf,6},};
uchar x;

sbit sound=P3^0;
void T0_Init()
{
   TMOD=0X01;
   ET0=1;
   EA=1;
}

void main()
{
    uchar keyS,i;
    T0_Init();
    while(1)
     {
       keyS=P1;
        if(keyS!=0xff)
         {
          for(i=0;i<7;i++)
                  {
           if(keyS==keyValue[i][0])
              {
                x=keyValue[i][1];
                TH0=xSound[x]/256;
                TL0=xSound[x]%256;
                TR0=1;
                while(P1!=0xff);
                TR0=0;

              }
                   }
         }

     }

}

void Timer0() interrupt 1
{
        TH0=xSound[x]/256;
        TL0=xSound[x]%256;
        sound=!sound;

}


//common.c文件
#include "common.h"
void delayms(uint i)
{
        uint j;
        for(;i>0;i--)
                for(j=120;j>0;j--)
                        ;
}































歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1