You're writing "PMR" wrong. You think you're starting the counter running from "1999", but you're not. It will START from "65535" and count down from there the first time. The way you have it set you won't get the first interrupt for about 32ms. This may not be important in your setup, but for some people it matters. You should at least be "surprised" by that. You have to set the OVW bit before writing PMR. Then you can clear OVW. Try finding that in the manual.
You're not ACKing the interrupt (yet), but you'll get that wrong too when you write it. See later.
Back to your question.
How you declare interrupts and link them together depends on the IDE you're using.
At the hardware level, you have to fill in the appropriate entry in the interrupt vector table (for that specific interrupt) to point to the address of your interrupt service routine. How you do that depends on the IDE. Some provide more help than others, but there should be some DOCUMENTATION that tells you how to do that, so you should read that first.
The "handler function" can't be a "normal function" as an interrupt service routine has to save more state and registers than a normal C function does.
So in real "bare metal programming" you can write some assembly code to do that and have that call your C function.
Or if using GCC you just add "__attribute__((interrupt_handler)) " before the function and it sets that up for you.
Or if using the NXP IDE - I don't know as I've never used it. It will do something similar. There should be documentation, and there's a Forum for CW where it might be worth asking these questions. There should also be example projects you can find that should give you a "worked example" of interrupts to copy from. Look for those. Like this ref:
https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/how-to-setup-Interrupt-handler-for-UART0-...
You should search this forum for keywords. There's about 15 years worth of people having the same problems.
Mose Coldfire interrupts require specific acknowledgement. For the PIT you have to write a "1" to the interrupt status bit to clear it. But you can't do that with the NXP supplied headers without making the PIT lose time.
And since you're using the "Bear PIT" you should be careful not to fall into it. EVERYONE has programmed this device wrong (in two different ways) for all of its lifetime, and continue to do so. That's because because the Reference Manuals don't warn of two surprising characteristics. Headers have always been wrong for this chip which means that using them it is impossible not to trigger this problem. NXP's "response" was:
I talked with the apps team and they told me that the
redaction doesn’t seems to implies that writing the
same value to the PRE bits doesn't reset the timer.
Yes, that's the response. No manual updates. No errata.
And having to set OVR to get the PMR written the first time is just weird.
The PIT was derived from a working (simpler) timer back in 1998. That one was fine. Then they put the prescaler in the upper byte of the control register and then didn't declare proper headers. This has been causing problems ever since then.
Read this from me in 2010 and then be one of the few people on the planet who has programmed this peripheral so it doesn't lose time:
https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-hw-boo-boo-Read-if-you-need-accurate-...
Here's the current Linux source code still showing the bug:
https://elixir.bootlin.com/linux/latest/source/arch/m68k/coldfire/pit.c
There's another trap with interrupts on the MCF52 series that causes weird unreliability. The ICR registers have to be set up with UNIQUE AND DIFFERENT Levels and Priorities. If you get that wrong the chip goes randomly crazy. The NXP sample code gets this wrong which doesn't help at all. Check these:
https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52233-DEMO-Interrupt-Priorities-and-Le...
https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/CFV2-vector-125-vector-or-ing/m-p/156249
https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/INTERRUPT-PROBLEM-INTERRUPTS-STOPS-TO-WOR...
Tom