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.
最近需要用28335读I2C的气压计,初始化I2C为:
I2caRegs.I2CMDR.bit.IRS =0; I2caRegs.I2CSAR = 0x0050; // Slave address - EEPROM control code
I2caRegs.I2CPSC.all = 15; // Prescaler - need 7-12 Mhz on module clk
I2caRegs.I2CCLKL = 15; // NOTE: must be non zero
I2caRegs.I2CCLKH = 15; // NOTE: must be non zero
I2caRegs.I2CIER.all = 0x00; // Enable SCD & ARDY interrupts
I2caRegs.I2CMDR.bit.IRS = 1; // Take I2C out of reset
写程序:
Uint16 WriteData(Uint16 Address) {
Uint16 i; if (I2caRegs.I2CSTR.bit.BB == 1) { return I2C_BUS_BUSY_ERROR; }
while(!I2C_xrdy());
I2caRegs.I2CSAR = 0x1E;
I2caRegs.I2CCNT = 1;
I2caRegs.I2CDXR = Address;
I2caRegs.I2CMDR.all = 0x6E20;
if (I2caRegs.I2CSTR.bit.NACK == 1)
return I2C_BUS_BUSY_ERROR;
return I2C_SUCCESS; }
为什么我在主程序中调用 WriteData(0X1E),用示波器看引脚波形,发现什么都没有,是什么情况?求指导~