Trevor Switkowski

PIT not working

Discussion created by Trevor Switkowski on Apr 4, 2006
Latest reply on Apr 12, 2006 by Thomas Zenker
hey everyone,

I am trying to get a PIT to interrupt, so that I can sample a quadrature encoded signal. I have used the following code to initialize the timer:

void quad_gpt_setup(void)
MCF_PIT0_PMR = MCF_PIT_PMR(70); //set modulus to 2!!
| MCF_PIT_PCSR_RLD; //enable PIT (32768 prescaler, interrupts)

and have called this before an empty while loop within main. now, I have created a handler for it:

__interrupt__ void quad_handler(void)
board_led_display((MCF_GPIO_SETTA & 0x03));
MCF_PIT0_PCSR &= 0xFFFE; //clear the interrupt

and initialized the interrupt as follows, in the main:

mcf5xxx_set_handler(64 + 55,quad_handler);

now, this is not working for me. The system sits in the infinite loop, and this is bad. do I need to set up any other registers, or is there an error in my code anywhere, or what?

another question i have is whether i can use a GPT for this purpose if I am using their pins as digital I/O. if so, how do i set this up? specifically, do i select output compare or input capture mode, or does it matter?

any help would be appreciated!



p.s. if it matters, I am using a MCF5213, specifically the M5213EVB...

Message Edited by airswit on 04-04-200602:08 AM