2440 SPI 中断服务程序求教~

[复制链接]
3689|1
 楼主| avlee 发表于 2009-10-20 10:37 | 显示全部楼层 |阅读模式
各位大哥~小弟在研究2440 SPI 中断模式传送,对中断服务程序不是很理解,望各位指教下~
程序如下:
void __irq Spi_Int(void)
{
    unsigned int status;
    ClearPending(BIT_SPI0);
    status=rSPSTA0;
    if(rSPSTA0&0x6)
     Uart_Printf("Data Collision or Multi Master Error(0x%x)!!!\n", status);
    while(!(rSPSTA0&0x1));       //Check ready state
    *spiRxStr++=rSPRDAT0;    //First Rx data is garbage data
   
    if(*spiTxStr!='\0')
     rSPTDAT0=*spiTxStr++;
    else
    {
  rINTMSK|=BIT_SPI0;
     endSpiTx=1;
    }
}
 楼主| avlee 发表于 2009-10-20 11:28 | 显示全部楼层
本帖最后由 avlee 于 2009-10-20 11:37 编辑

按这个程序写的,是说在发送时,中断使能,让数据发送到SPTDAT0寄存器,然后在屏蔽中断,是这个意思吗?不太明白接收怎么中断?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

30

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部