LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC17xx/40xx 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.

The example works in one of 3 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.

Special connection requirements

Build procedures:
LPC17xx/40xx example quickstart for Keil uVision4
LPC17xx/40xx example quickstart for IAR EWARM
LPC17xx/40xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Embedded Artists' LPC1788 Developer's Kit
Embedded Artists' LPC4088 Developer's Kit
NXP Xpresso LPC1769 board

Submitting LPCOpen issues:
Community support for LPCOpen

Macros

#define FEED_ON_SYSTICKINT   0
 
#define FEED_ON_WARNINT   1
 
#define NO_FEED   2
 

Functions

static void wdt_handle (void)
 
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
 

Macro Definition Documentation

#define FEED_ON_SYSTICKINT   0

Definition at line 73 of file watchdog.c.

#define FEED_ON_WARNINT   1

Definition at line 74 of file watchdog.c.

#define NO_FEED   2

Definition at line 75 of file watchdog.c.

Function Documentation

int main ( void  )

Main entry point.

Main program body.

Returns
Nothing

defined(CHIP_LPC175X_6X)

Definition at line 148 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 136 of file watchdog.c.

static void wdt_handle ( void  )
static

defined(CHIP_LPC175X_6X)

Definition at line 89 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 126 of file watchdog.c.

Variable Documentation

volatile bool On = false
static

Definition at line 78 of file watchdog.c.

volatile int wdtFeedState
static

Definition at line 77 of file watchdog.c.