How to use timer overflow interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to use timer overflow interrupt

跳至解决方案
3,323 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
553 次查看
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 项奖励
回复
1 回复
554 次查看
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 项奖励
回复