3402 views|1 replies

67

Posts

2

Resources
The OP
 

6. [Learning LPC1768 library functions] Watchdog experiment [Copy link]

The purpose of the watchdog is to generate a reset when an error occurs in the microprocessor. When the watchdog is enabled, if the user does not feed the watchdog within the overflow period (reload the timing value for the watchdog timer), the system will reset.

/************************************************************************************************
Function name: void WDTInit( void )
Function function: Initialize watchdog timer
Parameter: timeout timer
Return value: None
****************************************************************************************/
void WDTInit( uint32_t timeout )
{

//Default peripheral power register is enabled
// First step to initialize watchdog
Chip_WWDT_Init(LPC_WWDT);
// Second step to set timer time
Chip_WWDT_SetTimeOut(LPC_WWDT,timeout); //Set timer time
// Third step to enable watchdog, reset system after timer overflows
Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET|WWDT_WDMOD_WDEN);//Reset and enable
// Fourth step to feed dog
Chip_WWDT_Feed(LPC_WWDT);//Feed dog
}

/************************************************************************************************
Function name: void WDTFeed( void )
Function function: feed the watchdog timer to prevent it from timing out
Parameter: None
Return value: None
Note that the watchdog feeding function is a repeat of the previous one. In fact, directly calling Chip_WWDT_Feed(LPC_WWDT); the function effect is the same
****************************************************************************************************/
void WDTFeed( void )
{
Chip_WWDT_Feed(LPC_WWDT);

}
【06】LPC1768_看门狗实验.rar (249.62 KB, downloads: 20)



This content is originally created by EEWORLD forum user cxmdz . If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

This post is from NXP MCU

Latest reply

PJB
Thanks for sharing, I learned a lot   Details Published on 2019-11-12 13:03
 

7

Posts

0

Resources
2
 

Thanks for sharing, I learned a lot

This post is from NXP MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list