本帖最后由 ergelove 于 2014-12-30 14:17 编辑
ltbytyn 发表于 2014-12-30 12:36
发送/接收的时候无需人为判断总线状态。因为28027中的I2C模块是纯硬件的,硬件自己会去检测,在总线空闲的时候发送/接收。“还有为什么要先把地址写进DXR寄存器再写寄存器”没搞懂你的意思想说什么
就是如下语句 I2caRegs.I2CDXR = I2C_EEPROM_HIGH_ADDR; //Send eeprom high address
I2caRegs.I2CMDR.bit.TRX = 1; //Set to Transmit mode
I2caRegs.I2CMDR.bit.MST = 1; //Set to Master mode
I2caRegs.I2CMDR.bit.FREE = 1; //Run in FREE mode
I2caRegs.I2CMDR.bit.STP = 0; //Dont release the bus after Tx
I2caRegs.I2CMDR.bit.STT = 1; //Send the start bit, transmission will follow
先把eeprom的地址写入DXR寄存器
再写MDR寄存器,为什么这么操作呢,谢谢