Chris Büchner

HC(S)12: How to programm a interrupt in C???

Discussion created by Chris Büchner on Jul 26, 2006
Latest reply on Jul 28, 2006 by Chris Büchner
Hi to everyone,
actually I'm new to the Motorola Microcontrollers, but I've to work around with a HCS12.
My first steps where connecting a LCD and using the AD-Converter. As an extra feature I implemented a Button?
But here is my probleme:
I tried to write a Interrupt Routine for Button, that means, when the button is pushed the interrupt should be released, but somehow it doesn't work?!
For further information:
The button is connected to PORT T (I/O Timer) and should occur at a falling edge.
Here is my interrupt Routine:
in the main function I implemented:
    TIOS &= ~(1<<5);   // configure Pin 5 as capture input
    TCTL3 = 0xAA;       //not sure if this is right, want to configure PIN reacting on
    TCTL4 = 0xAA;       // a falling edge
    TIE |= (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7);
                                  //enable interrupt for a pins
when the button is pushed a interrupt should occur, here is the routine:
 PTT = 0x01;  //for testing, a LED connected to PTT should flash
after all; I activated the IRQ in the Vector.s table:
    .word DEF_IRQ /*ATD1_ISR */  /* 0xFFD0 ATD1*/
    .word DEF_IRQ /*ATD0_ISR */  /* 0xFFD2 ATD0*/
    .word SCI1_ISR   /* 0xFFD4 SCI1*/
    .word SCI0_ISR   /* 0xFFD6 SCI0*/
    .word DEF_IRQ        /* 0xFFD8  SPI0                      */
    .word DEF_IRQ        /* 0xFFDA  Pulse acc input edge      */
    .word DEF_IRQ        /* 0xFFDC  Pulse acc A overflow      */
    .word DEF_IRQ        /* 0xFFDE  Timer overflow            */
    .word DEF_IRQ        /* 0xFFE0  Timer channel 7           */
    .word DEF_IRQ        /* 0xFFE2  Timer channel 6           */
    .word BUTTON_ISR        /* 0xFFE4  Timer channel 5           */
    .word DEF_IRQ        /* 0xFFE6  Timer channel 4           */
    .word DEF_IRQ        /* 0xFFE8  Timer channel 3           */
    .word DEF_IRQ        /* 0xFFEA  Timer channel 2           */
    .word DEF_IRQ        /* 0xFFEC  Timer channel 1           */
I'm not sure if this is alright, but perhaps anyone can help me?!
Thanks a lot....