LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC18xx/43xx Watchdog timer example

Detailed Description

Example 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.

Special connection requirements
There are no special connection requirements for this example.

Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4
LPC18xx/43xx example quickstart for IAR EWARM
LPC18xx/43xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Hitex 1850 evaluation boards
Hitex 4350 evaluation boards
Keil 1857 evaluation boards
Keil 4357 evaluation boards
NGX 1830 Xplorer boards
NGX 4330 Xplorer boards

Submitting LPCOpen issues:
Community support for LPCOpen

Functions

static void 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
 

Function Documentation

void EVRT_IRQHandler ( void  )

Event router Interrupt Handler.

Returns
Nothing Handles event router events

Definition at line 127 of file watchdog.c.

int main ( void  )

Main entry point.

Main program body.

Returns
Nothing

Definition at line 165 of file watchdog.c.

void SysTick_Handler ( void  )

SysTick Interrupt Handler.

SysTick 1mS tick handler.

Returns
Nothing
Note
Systick interrupt handler feeds WWDT

Definition at line 153 of file watchdog.c.

static void wdt_handle ( void  )
static

Definition at line 91 of file watchdog.c.

void WDT_IRQHandler ( void  )

watchdog timer Interrupt Handler

Returns
Nothing
Note
Handles watchdog timer warning and timeout events

Definition at line 143 of file watchdog.c.

Variable Documentation

volatile bool On = false
static

Definition at line 80 of file watchdog.c.

volatile bool On1 = false
static

Definition at line 80 of file watchdog.c.

volatile int wdtFeedState
static

Definition at line 79 of file watchdog.c.