如何解决wdt on pic with c get errors
我有这个:
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 not recommended.
RCONBITS.SWDTEN = 1; // Software Enable of WDT => page 99 PIC24FJ1024GA610/GB610 documentation
// #pragma config WDT = ON. => Page 43 - MPLAB_XC16_C_Compiler_Users_Guide.pdf
// 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.
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: In function 'ButtonDebounce':
main.c:123:25: error: expected identifier or '(' before '.' token
make[2]: *** [build/default/debug/main.o] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:135: recipe for target 'build/default/debug/main.o' failed
有什么建议吗?我试图按照文档中的说明实现所有内容:PIC24FJ1024GB610,我有很多年参与 pic 的工作,然后我从事了组装工作。问题出在 RCONBITS.SWDTEN = 1;
解决方法
将 RCONBITS.SWDTEN = 1;
更改为 RCONbits.SWDTEN = 1;
这可能会解决错误。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。