Hello, we have an LPC55S28 project where we would like to keep track of tick/time that has passed since the beginning of the program, to be able to check if certain actions are completed in time or compare their starting times etc. We can probably do it using timers and interrupts but we were wondering if there is a simple free running counter that continually counts upwards or downwards and overflows automatically once it reaches max value or zero.
In short we were wondering if there is a similar function for LPC55S28 of the millis() function of Arduino: https://www.arduino.cc/reference/en/language/functions/time/millis/
Is there such a function or if not, what is the best way to create such a function on LPC55S28?
Solved! Go to Solution.
Hi @CanolCael,
I'm very sorry, but it appears there is no such example project for the 55s28. I suggest you refer to the _ctimer_match_interrupt_example, the CTimer generates a programmable period interrupt, in the ISR, you can switch the task to increment a variable and count how many seconds have passed in execution.
Another way to configure this would be to utilize Config Tools, as shown in this article: An example to configure a peripheral timer in an F... - NXP Community. You will need to apply it to the LPC, though.
Please feel free to ask me if you have any doubts with the Timer peripheral.
Best regards, Julian
Thank you Julian, I ended up using the UTICK timer which was easier to set up than ctimers but the solution is, as you suggested, incrementing a counter variable during every interrupt.
Hi @CanolCael,
I'm very sorry, but it appears there is no such example project for the 55s28. I suggest you refer to the _ctimer_match_interrupt_example, the CTimer generates a programmable period interrupt, in the ISR, you can switch the task to increment a variable and count how many seconds have passed in execution.
Another way to configure this would be to utilize Config Tools, as shown in this article: An example to configure a peripheral timer in an F... - NXP Community. You will need to apply it to the LPC, though.
Please feel free to ask me if you have any doubts with the Timer peripheral.
Best regards, Julian