Using core timer You can enable core timer functionality in MCC, which will generate code and give you these 2 functions: Here’s an example of the code it generates for them
Category: Timers and Delays
Timer (interrupt driven)
Configure the timer in MCC and select interrupt driven. Once you Geneate the MCC code it will have dealt with initialising the timer ready for you to use it. In your code Other timer functions MCC will have created a few useful functions you can call – see the file it generated in: /config/default/peripheral/tmr/