Joseph Rowland

MCF5213 Pulse accumulator interrupt problems

Discussion created by Joseph Rowland on Mar 11, 2008
Latest reply on Mar 17, 2008 by Joseph Rowland
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.

currently I have the following registers set at.

GPTSCR1 = 0x90;
GPTPACTL = 0x5B;

my handlers are defined as

mcf5xxx_set_handler(64+42, pulse_handler);
mcf5xxx_set_handler(64+43, overflow_handler);

then i set

mcf5xxx_irq_enable();

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.


Outcomes