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.

TMS320F28374S: I2C例程6中的temp设计

Part Number: TMS320F28374S

专家好:

关于TI的I2C例程6,有个疑问,搜到之前的帖子里也有提到过,但并未解决该问题

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1284151/tms320f28374s-why-design-variable-temp-like-this-in-i2c_ex6

这里的temp由以下格式组成:

但在程序里使用了如下方式进行传输

for(i=I2C_Params->NumOfAddrBytes-1;i>=0;i--)
{
I2C_putData(base, (temp >> (i*8U)) & 0xFF);
}

可是这里的I2C_Params->NumOfAddrBytes = 2

因此第一次是将temp向右移动8位,并传输出去;第二次是不进行移位操作,直接把0~7位传输出去

因此最后起作用的也就是0~15位,那这里的NumOfDataBytes在哪里被传输出去了呢?

另外,这里使能了FIFO,但是发送深度和接收深度被分别设置为0和2

I2C_setFIFOInterruptLevel(I2CA_BASE, I2C_FIFO_TXEMPTY, I2C_FIFO_RX2);

发送的FIFO深度设置为0表示什么意思呢?每发送一个字节的数就触发FIFIO中断吗?