打印

【求助】 S12X 中断的问题 急求 在线等

[复制链接]
5337|11
手机看帖
扫描二维码
随时随地手机跟帖
楼主

??

你问的是HCS12 CORE的中断还是XGATE的中断?
实际上使用codewarrior新建一个工程,或者参考demo工程就可以了.
static void SetupXGATE(void) {
  /* initialize the XGATE vector block and
     set the XGVBR register to its start address */
  XGVBR= (unsigned int)(void*__far)(XGATE_VectorTable - XGATE_VECTOR_OFFSET);

  /* switch software trigger 0 interrupt to XGATE */
  ROUTE_INTERRUPT(SOFTWARETRIGGER0_VEC, 0x81); /* RQST=1 and PRIO=1 */

  /* enable XGATE mode and interrupts */
  XGMCTL= 0xFBC1; /* XGE | XGFRZ | XGIE */

  /* force execution of software trigger 0 handler */
  XGSWT= 0x0101;
}
const XGATE_TableEntry XGATE_VectorTable[] = {
                         // Channel # = Vector address / 2
  /* channel 0..8 are not used, first used must match macro XGATE_VECTOR_OFFSET in xgate.h */
  {ErrorHandler, 0x09},  // Channel 09 - Reserved
  {ErrorHandler, 0x0A},  // Channel 0A - Reserved
  {ErrorHandler, 0x0B},  // Channel 0B - Reserved
  {ErrorHandler, 0x0C},  // Channel 0C - Reserved
  {ErrorHandler, 0x0D},  // Channel 0D - Reserved
  {ErrorHandler, 0x0E},  // Channel 0E - Reserved
......
};

使用特权

评论回复
沙发
ssoftboy| | 2008-9-10 10:53 | 显示全部楼层

??

中断向量就存放在FLASH中。然后通过XGVBR寄存器配置一下就可以了。
为什么不看文档呢?

使用特权

评论回复
板凳
ssoftboy| | 2008-9-10 20:23 | 显示全部楼层

kkk

编译的问题

/* XGATE vector table */
typedef void (*_NEAR XGATE_Function)(int);

你的函数没有传参数,应该写作:
interrupt void CPU12PIT3ISR(MyDataType* __restrict pData) {
// Add your code here
}
 


使用特权

评论回复
地板
ssoftboy| | 2008-9-11 10:07 | 显示全部楼层

.

不客气。那个是传入的参数。通常是一个全局变量。
S12X的书我一本也没有,市面上也似乎没什么深入讲XGate的书。大多是翻译一下datesheet而已。
我都是看手册以及一些appnotes和代码。

使用特权

评论回复
5
ssoftboy| | 2008-9-11 13:11 | 显示全部楼层

MSN

上班的时候只上MSN
jackchen06@gmail.com

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则