標(biāo)題: 各位大俠,我用PIC12F510做ad采樣IO口模擬輸出100KHZ方波,下述程序只能輸出23.5khz [打印本頁(yè)]

作者: becking    時(shí)間: 2015-7-21 18:46
標(biāo)題: 各位大俠,我用PIC12F510做ad采樣IO口模擬輸出100KHZ方波,下述程序只能輸出23.5khz
void main(void)
{
     uchar  ADresult;
     GPIO_init();
    while(1)
      {
             ADresult=get_ad();//ad返回值
             if((ADresult<10)||(ADresult>153)) // The adc sampling result is
              {
                 PWM=0;   //pwm STOP OUT
                 LED1=0;  //ClOSE LED
                 LED2=0;  //ClOSE LED
               }

             else
              {
                    LED1=1;

                    while(!(TMR0==0XFF))//定時(shí)判斷
                     {

                        TMR0=0XFE;
                         GP4=~GP4; //IO口模擬PWM

                     }

               }
           }
}

各位大俠,我用PIC12F510做ad采樣IO口模擬輸出100KHZ方波,上述我自己寫得程序只能輸出23.5khz,大俠們有其他方法嗎?






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