Hello, I cam currently working on a MCF5213 coldfire microcontroller. I was wondering if anyone can link me an example code to set up a pulse accumulator interrupt for both over flow and event driven rising edge detection.
on my main function i have an infinite while loop that constantly reads the pulse accumulator counter. I have a line that outputs the pulse accumulator counter, the GPTPAFLG, and I also have two variables that are in the pulse_handler function ad the overflow_handler function that are set to a specific number if those functions are called. To test my code I set a high signal to the input and watch the output values. The counter seems to be working fine and so does the GPTPAFLG. Everytime I set a high signal the PAIF flag gets set in the GPTPAFLG register. However what's not happenging is that the variables for the pulse_handler or the overflow_handler are not being set. This tells me that an interrupt never happened. What I don't understand is why the PAIF flag gets set in the GPTPAFLG register and an interrrupt service request never gets called. Thank you all in advance fo any advice you can give me.
I figured out what the problem was. It turns out that i needed to enable the Interrupt mask register, more specifically IMRH. On boot up IMRH is set default to disable all registers it controlls. After setting the specific bits to "0" for the specific vector source I attempted to run in again but still had no response from the interrupt. So then i had to set the interrupt control registers for the specific iterrupts like this:
After setting these registers my interrupts started working fine. I was wondering if anyone could answer the following questions. 1) Is there a default setting written somewhere for the Interrupt control module? 2) Does the software not set the ICR when an interrupt is used?