Content originally posted in LPCWare by leon_heller on Sat Mar 16 06:09:12 MST 2013 This simple test program for the LPC812 LPCXpresso might help people who are confused by the example programs:
/* Simple test program for LPC812 LPCXpresso*
*
*/
#include "LPC8xx.h"
#define LED 7 // red LED
void delay(void);
int main(void) {
LPC_GPIO_PORT->DIR0 |= 1<<LED; // set pin as output
while (1)
{
LPC_GPIO_PORT->SET0 = 1<<LED; // LED output high
delay();
LPC_GPIO_PORT->CLR0 = 1<<LED; // LED output low
delay();
}
}
void delay(void)
{
volatile unsigned int i;
for (i = 0; i < 100000; i++)
;
}
It builds and runs OK in debug mode, but gives this error when building in release mode: