MC9S12C32 Interrupts In CodeWarrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12C32 Interrupts In CodeWarrior

2,275 Views
Assembly
Contributor I
I Have been able to run interrupts on my Microcontroller  but all of the sudden th same interrupts wont work anymore. I am assigning the vector address in the linker file as well as the interrupt Service routine name. I am using the command enable Interrupts in CodeWarrior. I am calling the interrupt service function the same as the one in the linker file. I am using the function Header interrupt void function_Name(void).
Do you have any sugestions as to why the interrupts arnt working any more.
Labels (1)
0 Kudos
3 Replies

327 Views
JimDon
Senior Contributor III
Which interrupt(s) are we talking about.
Maybe the device that was giving the interrupt is no longer enables/set up properly.
0 Kudos

327 Views
Assembly
Contributor I
The Timer Overflow and the Timer Output Capture 0
 
Recentaly I tried a couple of things and i notced that if you set the output on Capture 0 the led will togle but still wont run the interupt service routine.
 
Atached is a coppy of the scource code that i wrote
0 Kudos

327 Views
JimDon
Senior Contributor III
Try this in the int handler

TC0 += PERIOD ;

and

TC0 = TCNT + PERIOD;
When you init it.

Also, you don't need
TFLG1 = 0x01;
in the hander - writing to TC0 clears and rearms the int.

Try something less than FFFF for the period.
Not sure if that will cause a problem, but it might.

If you need longer periods, use a sub counter like:
int subCntr; // global scope

(in the int handler)
++subCntr;
if( subCntr == 100 ) // pick a number that gives you the desired delay.
{

// write to the leds or what ever.

subCntr = 0;
}
(rest of handler)

Message Edited by JimDon on 2007-02-0608:20 PM

Message Edited by JimDon on 2007-02-0608:22 PM

0 Kudos