ARM中I2c初始化问题
时间:10-02
整理:3721RD
点击:
void I2C_Init(uint32 fi2c)
{
if(fi2c>4000) fi2c = 400000;
PINSEL0 = (PINSEL0&0xFFFFFF0F) | 0x50;
I2SCLH = (Fqclk/fi2c + 1) / 2; //这一行中为什么加一
I2SCLL = (Fqclk/fi2c) / 2;
//位频率公式:位频率 = Fpclk / (I2SCLH + I2SCLL)
I2CONCLR = 0x2C;
I2CONSET = x040;
.
}
{
if(fi2c>4000) fi2c = 400000;
PINSEL0 = (PINSEL0&0xFFFFFF0F) | 0x50;
I2SCLH = (Fqclk/fi2c + 1) / 2; //这一行中为什么加一
I2SCLL = (Fqclk/fi2c) / 2;
//位频率公式:位频率 = Fpclk / (I2SCLH + I2SCLL)
I2CONCLR = 0x2C;
I2CONSET = x040;
.
}