Content originally posted in LPCWare by tdl on Tue Dec 17 14:25:25 MST 2013 I have created a C++ project for an LPC1227 using LPCExpresso 6.1.0. The project, up until now, builds and runs fine. I have not made any changes to cr_startup_lpc12xx.cpp.
I would like to add a SysTick_Handler(). In my main.cpp I have added a method:
void SysTick_Handler(void)
{
timerCounter++; // these variables are all declared globally in main.cpp
timer_10ms_tick = true;
if ((timerCounter % 10) == 0) //every 100ms
{
timer_100ms_tick = true;
}
if ((timerCounter % 100) == 0) //every 1000ms
{
timer_1000ms_tick = true;
}
}
I have also add the following line in my main() method:
SysTick_Config(12000000/100);
When I run my code via debug, the interrupt is firing, but it is getting stuck in the default SysTick_Handler() that is inside of cr_startup_lpc12xx.cpp (which is just an infinite while loop). If I delete the default SysTick_Handler from cr_startup_lpc12xx.cpp, my program hard faults.
I have looked at the Blinky example (which is C, not C++) and it adds a new handler into main.cpp without deleting the handler from the startup file.
Can anyone suggest why my overriding handler is not being called? Is this a C++ difference?