How to use timer overflow interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use timer overflow interrupt

ソリューションへジャンプ
3,214件の閲覧回数
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 解決策
444件の閲覧回数
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 返信
445件の閲覧回数
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 件の賞賛
返信