mclr 使用 #pragma

问题描述

我有这个 ISR:

static void ButtonDebounce(void)
{    
   static uint16_t debounceCounter = 0;
    // Check if only one S3 or s4 button pressed since if I have bouncing several
   // interrupts will occur and will result on several resets on board.

    if ((BUTTON_Ispressed( BUTTON_S3 ) == true) || (BUTTON_Ispressed( BUTTON_S4 ) == true)){
      if(debounceCounter == 0)
      {
        LED_Toggle( LED_D4 ); //Led blinks when Btn3 or Btns4 is pressed.
        if (BUTTON_Ispressed( BUTTON_S3 ) == true){
            //__asm__ volatile ("reset"); // soft-reset is not the better choice
            #pragma config WDT=ON // Enable WDT. The safer way to implement 
            // reset on the system is via WDT since this timer is resetting the whole
            // board and not only the microcontroller.
            // Page 43 - MPLAB_XC16_C_Compiler_Users_Guide.pdf
            while(1){} // Just wait for wdt to reset the system.
        }
        else if (BUTTON_Ispressed( BUTTON_S4 ) == true){
            printf("Avg Temp = %4f\r\n Avg Hmdt = %4f\r\n Min Temp = %4d\r\n Max Temp = %4d\r\n Min Hmdt = %4d\r\n Max Hmdt = %4d\r\n",calculateAvgTemp(),calculateAvgHumidity(),calculateMinTemp(),calcuateMaxTemp(),calculateMinHumidity(),calcuateMaxHumidity());
        }
    }        
    debounceCounter = BUTTON_DEBOUCE_TIME_MS;
} else{
    if(debounceCounter != 0)
    {
        debounceCounter--;
    }
 }
}

但我得到:main.c:在函数“ButtonDebounce”中: main.c:102:25: 错误:未知的配置设置:'WDT'

有什么建议吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)