在CW中如何编写代码为中断向量指定对应的处理函数?
- UID
- 124125
- 性别
- 男
|
在CW中如何编写代码为中断向量指定对应的处理函数?
我没有用软件的自动生成代码功能。
所以不知道中断处理函数如何定义,才能保证产生中断时调用对应的处理函数。
请各位高手指点一下!万分感谢 |
|
|
|
|
|
- UID
- 114982
- 性别
- 男
|
1.设置中断向量表,像这表,自动生成的,
void (* const _vect[])() @0xFFCC = { /* Interrupt vector table */
Cpu_Interrupt, /* Int.no. 25 Vrti (at FFCC) Unassigned */
Cpu_Interrupt, /* Int.no. 24 Viic (at FFCE) Unassigned */
Cpu_Interrupt, /* Int.no. 23 Vatd (at FFD0) Unassigned */
Cpu_Interrupt, /* Int.no. 22 Vkeyboard (at FFD2) Unassigned */
Cpu_Interrupt, /* Int.no. 21 Vsci2tx (at FFD4) Unassigned */
Cpu_Interrupt, /* Int.no. 20 Vsci2rx (at FFD6) Unassigned */
Cpu_Interrupt, /* Int.no. 19 Vsci2err (at FFD8) Unassigned */
Cpu_Interrupt, /* Int.no. 18 Vsci1tx (at FFDA) Unassigned */
Cpu_Interrupt, /* Int.no. 17 Vsci1rx (at FFDC) Unassigned */
Cpu_Interrupt, /* Int.no. 16 Vsci1err (at FFDE) Unassigned */
Cpu_Interrupt, /* Int.no. 15 Vspi (at FFE0) Unassigned */
TPM2_OVF, /* Int.no. 14 Vtpm2ovf (at FFE2) Used */
Cpu_Interrupt, /* Int.no. 13 Reserved12 (at FFE4) Unassigned */
Cpu_Interrupt, /* Int.no. 12 Reserved13 (at FFE6) Unassigned */
Cpu_Interrupt, /* Int.no. 11 Reserved14 (at FFE8) Unassigned */
Cpu_Interrupt, /* Int.no. 10 Vtpm2ch1 (at FFEA) Unassigned */
Cpu_Interrupt, /* Int.no. 9 Vtpm2ch0 (at FFEC) Unassigned */
TPM_OVF, /* Int.no. 8 Vtpm1ovf (at FFEE) Used */
Cpu_Interrupt, /* Int.no. 7 Vtpm1ch2 (at FFF0) Unassigned */
Cpu_Interrupt, /* Int.no. 6 Vtpm1ch1 (at FFF2) Unassigned */
Cpu_Interrupt, /* Int.no. 5 Vtpm1ch0 (at FFF4) Unassigned */
Cpu_Interrupt, /* Int.no. 4 Vicg (at FFF6) Unassigned */
Cpu_Interrupt, /* Int.no. 3 Vlvd (at FFF8) Unassigned */
IRQ, /* Int.no. 2 Virq (at FFFA) Used */
Cpu_Interrupt, /* Int.no. 1 Vswi (at FFFC) Unassigned */
_EntryPoint /* Int.no. 0 Vreset (at FFFE) Reset vector */
};
2.定义中断函数
__interrupt void KBI_Int(void);
/*
** ===================================================================
** Interrupt handler : KBI_Int
**
** Description :
** User interrupt service routine.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
|
|
|
|
|
|