How to use timer overflow interrupt

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

How to use timer overflow interrupt

Jump to solution
3,115 Views
dan23
Contributor III

Hi I’m new using codewarrior and the HCS12 T-board, onboard is the mc9s12dp512 chip.

 

I want to use the timer to count 1 millisecond till a overflow occurs. When a overflow occurs I want to use an interrupt to call a sub routine.

 

Here is a bit of my code. This interrupt implementation doesn’t work. What am I doing wrong?

 

void SetTimer(void)

{ 

  TCNT = 0xE0C0;

  TSCR1 = 0x90;

}

 

interrupt 16 void TimerCount(void)

{

  ms++;            //global variable 

 

  TCNT = 0xE0C0;

}

 

when I built my project I’ll get the following error message.

 

Link error:    L1907: fixup overflow in _Vector_16, TimerCount type 1, at offset 0x0

 

Could anyone help me with this problem?

 

Greetings dan23

Labels (1)
Tags (1)
0 Kudos
1 Solution
345 Views
stanish
NXP Employee
NXP Employee
Hi dan23,

Similar issue was already discussed here. You should ensure your ISR routine is placed in NON_BANKED memory. For more information  I'd invite you to see e.g.:

http://forums.freescale.com/freescale/board/message?board.id=CW816COMM&message.id=3698&query.id=1959...

Regards,

stanish

View solution in original post

0 Kudos
1 Reply
346 Views
stanish
NXP Employee
NXP Employee
Hi dan23,

Similar issue was already discussed here. You should ensure your ISR routine is placed in NON_BANKED memory. For more information  I'd invite you to see e.g.:

http://forums.freescale.com/freescale/board/message?board.id=CW816COMM&message.id=3698&query.id=1959...

Regards,

stanish
0 Kudos