MC9S12XDP512-Interrupt Priority settings

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

MC9S12XDP512-Interrupt Priority settings

2,227 次查看
sathish_K
Contributor I
Hi Everyone,
 
I am using codewarrior IDE Version 5.7.0. and controller is MC9S12XDP512. I want to set the different priority to the interrupt. (i.e. For serial port is low priority and MSCAN is high priority).

Can someone give the details for setting priority and sequence also


Regards,
Sathish
标签 (1)
0 项奖励
回复
2 回复数

642 次查看
kef
Specialist I
Codewarrior project wizard generates code, in which you can find ROUTE_INTERRUPT macro:
 
 
#define ROUTE_INTERRUPT(vec_adr, cfdata)                \
  INT_CFADDR= (vec_adr) & 0xF0;                         \
  INT_CFDATA_ARR[((vec_adr) & 0x0F) >> 1]= (cfdata)
 
Where vec_adr argument is vector number and cfdata is interrupt routing and priority level.
 
For example
 
#define SOFTWARETRIGGER0_VEC  0x72 /* vector address= 2 * channel id */
 
This would route software trigger interrupt to XGATE (bit7 of cfdata is set):
 
ROUTE_INTERRUPT(SOFTWARETRIGGER0_VEC, 0x81); /* RQST=1 and PRIO=1 */
 
 
This would route software trigger interrupt to S12X (bit7 of cfdata is cleared) and set interrupt priority to prio:
 
ROUTE_INTERRUPT(SOFTWARETRIGGER0_VEC, (prio & 0x7));
 
 
I wonder why do you want to change interrupt priority? Is some of your ISR handler long to execute? I think CAN interrupt should execute longer, it's more complicated, isn't it? If CAN ISR takes longer, than I would make it lower priority and reenable interrupts in CAN ISR, allowing this way higher priority to interrupt lower priority and longer to execute CAN ISR.


Message Edited by kef on 2007-12-13 09:27 AM
0 项奖励
回复

642 次查看
sathish_K
Contributor I
Thanks kef,


Regards
sathish
0 项奖励
回复