µ¥Æ¬»ú²úÉúɨƵÐźÅ400Hz~3KHz-----Õ¼¿Õ±È50%µÄ·½²¨2010/07/1014:12·¢Ò»¸ö²úÉúɨƵÐźŵijÌÐò£¬´ó¼Ò²Î¿¼Ò»ÏÂ//µ¥Æ¬»ú¾§Õñ12MHz£¬Õâ¸ö³ÌÐòÈç¹ûÒªÌá¸ßɨƵÐźÅÊä³öµÄƵÂʹؼüµÄÒ»¾äÊÇ//dataLoad=10000/(2*(4+i));//153¸öʱÖÓÖÜÆÚ//¼Ç¸ÃÖ¸ÁîµÄÖ´ÐÐʱ¼äÊÇN¸öʱÖÓÖÜÆÚ//¸Ã³ÌÐò¿ÉÒÔÊä³öµØɨƵÐźŵÄ×î¸ßƵÂÊΪfosc/(2*N*12)//Èç¹ûÏëÒªÌá¸ßɨƵÐźŵÄ×î¸ßƵÂÊʹÓÃʱÖÓƵÂʸü¸ßµÄоƬ£¬»òÕß¿ÉÒÔ//¸ü¸ÄÕâÌõÓï¾ä£¬Ê¹Ö®Ö´ÐÐʱ¼äËõ¶Ì//Õâ¸ö³ÌÐòµÄ±à³Ì˼·ÈçÏ£º//¶¨Ê±Æ÷0¸ºÔðÊä³ö·½²¨µÄ¶¨Ê±£¬ÊäÈëÖ¸¶¨ÆµÂʵķ½²¨//¶¨Ê±Æ÷1¸ºÔð0.1Ã붨ʱ£¬Èç¹ûʱ¼äµ½£¬Ôò¸Ä±ä//¶¨Ê±Æ÷0µÄ¿ØÖƵÄÊä³ö·½²¨µÄƵÂÊ#includereg52.hsbitoutWave=P0^0;#defineucharunsignedchar#defineuintunsignedintuchart1Counter;//thetimesoft1interruptuintdataLoad;//theresetdataofthetime0bitt1Int;//theflagoftime1interrupt//¶¨Ê±Æ÷0³õʼ»¯voidInitTimer0(){TMOD|=0x01;//¶¨Ê±Æ÷·½Ê½1ET0=1;//ÔÊÐíT0ÖжÏTH0=(65536-dataLoad)/256;//¶¨Ê±Æ÷³õÖµ10msTL0=(65536-dataLoad)%256;TR0=1;//Æô¶¯T0}//¶¨Ê±Æ÷0ÖжÏvoidTime0Int()interrupt1{TH0=(65536-dataLoad)/256;//¶¨Ê±Æ÷³õÖµ10msTL0=(65536-dataLoad)%256;outWave=!outWave;}//¶¨Ê±Æ÷1³õʼ»¯voidInitTimer1(){TMOD|=0x10;//¶¨Ê±Æ÷·½Ê½1ET1=1;//ÔÊÐíT1ÖжÏTH1=(65536-50000)/256;//¶¨Ê±50msTL1=(65536-50000)%256;TR1=1;//Æô¶¯T1}//time1voidTime1Int()interrupt3{TH1=(65536-50000)/256;//¶¨Ê±50msTL1=(65536-50000)%256;t1Counter++;}//Ö÷º¯Êývoidmain(){uchari;//thenumberofthefrequencydataLoad=1250;//400hz,2.5msInitTimer0();//¶¨Ê±Æ÷0³õʼ»¯InitTimer1();EA=1;//¿ª×ÜÖжÏPT1=1;while(1){//if(t1Int)//{//t1Int=0;//t1Counter++;if(t1Counter==2){//3t1Counter=0;//2//changethedataLoaddataLoad=10000/(2*(4+i));//153¸öʱÖÓÖÜÆÚi++;i=i%26;}//}}}