LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Watchdog timer example

Functions

static wdt_handle (void)
 
void EVRT_IRQHandler (void)
 Event router Interrupt Handler.
 
void WDT_IRQHandler (void)
 watchdog timer Interrupt Handler
 
void SysTick_Handler (void)
 SysTick Interrupt Handler.
 
int main (void)
 Main entry point.
 

Variables

static volatile int wdtFeedState
 
static volatile bool On = false
 
static volatile bool On1 = false
 

Detailed Description

This example shows how to use Windowed watchdog timer to generate interrupts to manage the watchdog timer. If the watchdog timer isn't 'fed' within it's window time, it will reset the device. The LED will toggle states on each watchdog feed event. You can also use a terminal program with the UART to select the feed event. If the feed is disabled, the chip will reset.

No special setup is required for the demo. Just build and run. NGX Xplorer users (no UART) should modify the code to test the different watchdog events.

The example works in one of 4 ways. If '1' is selected, WDT is fed by the sysTick at 20Hz and should never time out (fast LED). If '2' is selcted, the WDT is fed by the watchdog window interrupt (slow LED). If '3' is selected, the watchdog times out and resets the device. If '4' is selected, the interrupt for the WDT timeout events are routed via the event router handler instead of the watchdog interrupt handler.

Build procedure: LPCOpen 18xx/43xx build instructions

Supported boards and board setup:

Submit bug reports for LPCOpen code here.

Function Documentation

void EVRT_IRQHandler ( void  )

Event router Interrupt Handler.

Returns
Nothing Handles event router events

Definition at line 118 of file watchdog.c.

int main ( void  )

Main entry point.

Returns
Nothing

Definition at line 156 of file watchdog.c.

void SysTick_Handler ( void  )

SysTick Interrupt Handler.

Returns
Nothing Systick interrupt handler feeds WWDT

Definition at line 144 of file watchdog.c.

static wdt_handle ( void  )
static

Definition at line 81 of file watchdog.c.

void WDT_IRQHandler ( void  )

watchdog timer Interrupt Handler

Returns
Nothing Handles watchdog timer warning and timeout events

Definition at line 134 of file watchdog.c.

Variable Documentation

volatile bool On = false
static

Definition at line 70 of file watchdog.c.

volatile bool On1 = false
static

Definition at line 70 of file watchdog.c.

volatile int wdtFeedState
static

Definition at line 69 of file watchdog.c.