求助 MC9S12XDP512能否用XGATE处理IIC中断
- UID
- 804093
|
求助 MC9S12XDP512能否用XGATE处理IIC中断
如题,另哪位大侠能给个MC9S12XDP512的IIC中断例程或给个下载的链接 谢谢!!! |
|
|
|
|
|
- UID
- 804093
|
|
|
|
|
|
- UID
- 804093
|
呃~~~
先上个自己根据spec写的ISR吧
哪位高手能指导下这样写有无问题
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void IIC0_Handler()
{
// NOTE: The routine should include the following actions to obtain
// correct functionality of the hardware.
//
// The ISR is invoked by IBIF flag. The IBIF flag is cleared
// if a "1" is written to the IBIF flag in IIC0_IBSR register.
// Example: IIC0_IBSR_IBIF = 1;
IIC0_IBSR_IBIF = 1;
if(IIC0_IBCR_TX_RX) //tx mode
{
if(IIC_Send_Size == 0) // IIC_Send_Size和IIC_Rec_Size都是用于计算剩余字节数
{
IIC0_IBCR_MS_SL = 0; // generate stop signal
}else
{
if(IIC0_IBSR_RXAK == 0)
{
IIC0_IBDR = Buffer[IICCounter];
IIC_Send_Size --;
IICCounter ++;
}else
{
IIC0_IBCR_MS_SL = 0; // generate stop signal
IIC_Send_Size = 0;
}
}
}else //rx mode
{
if(IIC_Rec_Size == 1)
{
IIC_Rec_Size = 0;
IIC0_IBCR_MS_SL = 0; // generate stop signal
Buffer[IICCounter] = IIC0_IBDR;
}else
{
if(IIC_Rec_Size == 2)
{
IIC_Rec_Size --;
IICCounter ++;
IIC0_IBCR_TXAK = 1;
Buffer[IICCounter] = IIC0_IBDR;
}else
{
Buffer[IICCounter] = IIC0_IBDR;
IIC_Rec_Size --;
IICCounter ++;
}
}
}
}
#pragma CODE_SEG DEFAULT |
|
|
|
|
|
- UID
- 799270
|
|
|
|
|
|
- UID
- 801924
- 性别
- 女
|
MC9S12XDP512 原装现货,可以小批量供应,,有兴趣请联系
深圳市金信通电子有限公司
地址:深圳市深圳南中路中航苑鼎诚国际大厦1819室
电话:0755-82709601 传真:0755-82709323
网站:www.hkkct.com 邮箱:yw06@hkkct.com
QQ:727610097
联系人:罗晓娜 手机:15889639472 |
www.hkkct.com QQ727610097 XILINX FREESCALE |
|
|
|
|
|
- UID
- 143117
- 性别
- 男
|
注意xgate的函数不能调用外部函数这一特性即可。 |
!!!!!!!!!!!!!!!!!!*(***************************************)
SSSSSSSSSSSSSSSSSSSSSSSSS########$$$ |
|
|
|
|
|