Paul William

Interrupt trouble MC9S12DP512

Discussion created by Paul William on Feb 19, 2008
Latest reply on Feb 19, 2008 by Guest

Hi all,

I am have problems with a MC9S12DP512, I am using ICC12 and using TwinPeeks
to load the programs.

My question relates to the operation of the timer interrupts. I can get TC7
working correctly.

But if I try and use TC0 nothing appears to happen. I believe it has
something to do with the redirected interrupt vectors. Mainly because of the
redirect vector that works for TC7 is actually that of TC0 in the manual.

Here is a sample of my code just in case something is incorrect:

// Setup
void SetTimer(unsigned int Ticks){
TIOS = 0x81;
TIE = 0x81;
TSCR2 = 0x8c;
TC7 = Ticks*2;
TSCR1 = 0x80;
// Clear Timer Flag
TFLG1 = 0x81;

// ISR for timer 0 this is the same for timer 7
#pragma interrupt_handler Timer0
void Timer0(void){
PTM^=0x01; // Pulse LED
// Clear timer interrupt flag
TFLG1 = 0x01;

Within the main() function:

*((unsigned char *)0x3FE8) = 0x06; // JMP opcode
*((void (**)(void))0x3FE9) = Timer7;

// TC0
*((unsigned char *)0x3FFD) = 0x06; // JMP opcode
*((void (**)(void))0x3FFE) = Timer0;




Any help would be greatly appreciated








Added p/n to subject.

Message Edited by NLFSJ on 2008-02-19 07:08 AM