lpc824 LpcOpen Stopwatch and RIT ... possible problem

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by efiLabs on Sun Dec 14 22:18:07 MST 2014

friends :

after creating my own timer class i had to revisit StopWatch_Init() and StopWatch_Start() where i took a few ideas from

my code didn't work right on timer over-runs and i stared  at the LpcOpen code until i noticed that the 31 bit mask had one "F" to few and afterwards my code worked

sample copied from LpcOpen

in StopWatch_Init() :

Chip_MRT_SetInterval(LPC_MRT_CH1, 0x7ffffff | MRT_INTVAL_LOAD);

in StopWatch_Start() :

return 0x7ffffff - Chip_MRT_GetTimer(LPC_MRT_CH1);

unless lpcopen has something else in mind, i consider it wrong it should contain 0x7FFFFFFF

it works for me now

cheers efiLabs