如何解决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 举报,一经查实,本站将立刻删除。