Anand Akella

TIMER_ INTERRUPT gives me error while execution in MC9S12C64

Discussion created by Anand Akella on Dec 19, 2007
Latest reply on Dec 21, 2007 by Khanindra Deka
if have writen a code for the timer interrupt of MC9S12C64. The following is my code and while execution it gives me an error L1907:FIXup overflow in _Vector_8, to Timer_int type 1,at offset 0x0

And i want  15 sec delay and my bus clock is 4 Mhz and  prescalar is 128 then the value to be loaded in the int register is 0x7270E how to load this value into 8bit register. please help me.


#include <hidef.h>      /* common defines and macros */
#include <MC9S12C64.h>     /* derivative information */



#define TIMER_TO_CAPTURE TIOS
#define TIMER_COMPARE_FORCE CFORC
#define OUTPUT_COMPARE_MASKREG OC7M
#define OUTPUT_COMPARE_DATAREG OC7D
#define TIMER_COUNT_REG TIOS

#define TIMER_SYSTEM_CONTROL_REGISTER2 TSCR2

#define TIMER_FAST_FLAG_CLEAR TSCR1_TFFCA                    
#define TIMER_STOPS_FREEZE_MODE TSCR1_TSFRZ                   
#define TIMER_MODULE_STOP TSCR1_TSWAI                  
#define TIMER_ENABLE TSCR1_TEN    

#define Timer_Toggle_On_Overflow_Register1 TTOV
#define TIMER_CONTROL_REGISTER1 TCTL1 
#define TIMER_CONTROL_REGISTER2 TCTL2 

#define TIMER_CONTROL_REGISTER3 TCTL3
#define TIMER_CONTROL_REGISTER4 TCTL4
#define Timer_Interrupt_Enable_Register TIE
#define Timer_Overflow_Flag TFLG2_TOF

#define MAIN_TIMER_INTERRUPT_FLAG1 TFLG1
#define TIMER_OVERFLOW_FLAG TFLG2_TOF

#define SET 1
#define RESET 0

#define TIMERSET4MS 1600




void Timer_InterruptINT(void)
  {
     /* The corresponding  channel acts as an input capture */
     TIMER_TO_CAPTURE=0xFF;
    
     /*Timer  Compare force is set zero */
     // TIMER_COMPARE_FORCE=0xFF;
     
     /* Output compare mask register is set zero */ 
     //OUTPUT_COMPARE_MASKREG =0x00;
     
     /* Output compare DATA register is set zero */ 
     //OUTPUT_COMPARE_DATAREG=0x00;
     
     /* TIMER Count Register is of 2 BYTES of size*/     
  //     TIMER_COUNT_REGH=0x4E;
  //    TIMER_COUNT_REGL=0x20;
     
     
      /* if u want to enable the timer interrupt then set it*/
      TIMER_ENABLE=SET;
     /* Timer Module Stops While in Wait is set to zero*/
      TIMER_MODULE_STOP=RESET;
     /* Timer Stops While in Freeze Mode is set to zero*/
      TIMER_STOPS_FREEZE_MODE=RESET;
     /* Timer Fast Flag Clear All   is zero.
      * 0 means  Allows the timer flag clearing to function normally.    */
      TIMER_FAST_FLAG_CLEAR=RESET;
     
    //  Timer_Toggle_On_Overflow_Register1=0xFF; 
      
      TIMER_CONTROL_REGISTER1=0x00;
      TIMER_CONTROL_REGISTER2=0x00;
     
      Timer_Interrupt_Enable_Register=0x02;
      TIMER_SYSTEM_CONTROL_REGISTER2=0x01;
     
      /* Maint timer interrupt flag1 is used to check whether any error has occured*/
    
     TC0=TIMERSET4MS;
    
                       
   }
  
interrupt 8 void Timer_int(void)
 {
   
    PORTB_BIT0=~PORTB_BIT0;
    PORTB_BIT1=~PORTB_BIT1;
    TFLG1 = 0x02 ;
     
 }
 
   
 void PortInit(void)
 {
     /* Mode register config as Normal single chip*/
     MODE=0x80;
      
     // Port E Assignement Resgister (PEAR) Normal single chip
     PEAR=0x10;
      
     /* PLL clock init */
     /* Selecting the clock source as OSCCLK */
     CLKSEL &= 0x7f;
     /* Disable the PLL */
     PLLCTL &= 0xBF;
    
    
     /* Pull UP device enable */
     PERT=0xFF ;         
     /* default  configured as output */
     DDRAB=0xFF;
    
     DDRB=0xFF;
    
  }
 

void main(void)
{
    Timer_InterruptINT();
   
    PortInit();

    EnableInterrupts;
}

Outcomes