This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28030中I2C模块的中断源寄存器使用问题

我使能了停止条件检测中断位,即I2caRegs.I2CIER.bit.SCD = 1;

然后在中断程序中读取中断源寄存器,即:

__interrupt void I2Cinterrupt()
{
UINT16 IntSource;

// Read interrupt source
IntSource = I2caRegs.I2CISRC.bit.INTCODE;
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP8;
}

在主程序while循环中产生STOP,将I2caRegs.I2CMDR.bit.STP添加到观察窗口,其值为0,即产生了STOP,这时在观察窗口查看I2caRegs.I2CISRC.bit.INTCODE,其值为0。但是进入到中断程序后,I2caRegs.I2CISRC.bit.INTCODE的值为6,表示检测到停止条件。

那么问题来了,为什么只有进入中断程序后查看I2caRegs.I2CISRC.bit.INTCODE的值才为6,而在主程序while循环中产生STOP后查看I2caRegs.I2CISRC.bit.INTCODE的值仍为0?难道I2caRegs.I2CISRC.bit.INTCODE的值只能在中断服务程序中读取?