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){
asm("sei");
TIOS = 0x81;
TIE = 0x81;
TSCR2 = 0x8c;
TC0=Ticks-1;
TC7 = Ticks*2;
TSCR1 = 0x80;
// Clear Timer Flag
TFLG1 = 0x81;
HPRIO = 0xEE;
asm("cli");
}
// ISR for timer 0 this is the same for timer 7
#pragma interrupt_handler Timer0
void Timer0(void){
PTM^=0x01; // Pulse LED
//putstring("abcd\n\r");
// Clear timer interrupt flag
TFLG1 = 0x01;
}
Within the main() function:
//TC7
*((unsigned char *)0x3FE8) = 0x06; // JMP opcode
*((void (**)(void))0x3FE9) = Timer7;
// TC0
*((unsigned char *)0x3FFD) = 0x06; // JMP opcode
*((void (**)(void))0x3FFE) = Timer0;
SetTimer(200);
while(1){
}
Any help would be greatly appreciated
Paul
Added p/n to subject.