原程序入下:
void MS561101BA_RESET()
{
/* Send STRAT condition */
I2C_GenerateSTART(I2C1, ENABLE);
I2C_Send7bitAddress(I2C1, PROM_ADDRESS, I2C_Direction_Transmitter);
I2C_SendData(I2C1, Reset);
I2C_GenerateSTOP(I2C1, ENABLE);
printf("
成功1
");
}
/**
void MS561101BA_PROM_READ()
{
u16 d1,d2,i;
for(i=0;i<6;i++)
{
I2C_GenerateSTART(I2C1, ENABLE);
I2C_Send7bitAddress(I2C1, PROM_ADDRESS, I2C_Direction_Transmitter);
I2C_SendData(I2C1, PROM_Read+i*2);
I2C_GenerateSTART(I2C1, ENABLE);
I2C_Send7bitAddress(I2C1, PROM_ADDRESS, I2C_Direction_Receiver);
d1=I2C_ReceiveData(I2C1);
I2C_AcknowledgeConfig(I2C1, ENABLE);
d2=I2C_ReceiveData(I2C1);
I2C_AcknowledgeConfig(I2C1, DISABLE);
I2C_GenerateSTOP(I2C1, ENABLE);
Delay_us(50);
d1<<=8;
C=d1|d2;
printf(&quot;
成功2
&quot;);
}
}
用串口调试的时候只能输出成功1,成功2输不出来是什么情况? |