|
发表于 2011-12-8 22:41:04
|
显示全部楼层
这个是我的IIC初始化部分,你可以参考下
I2caRegs.I2CPSC.all = 14; // Prescaler - need 7-12 Mhz on module clk (150/15 = 10MHz)
I2caRegs.I2CCLKL = 5; // NOTE: must be non zero
I2caRegs.I2CCLKH = 2; // NOTE: must be non zero
I2caRegs.I2CIER.all = 0x24; // Enable SCD & ARDY interrupts
I2caRegs.I2CMDR.all = 0x0020; // Take I2C out of reset
// Stop I2C when suspended
I2caRegs.I2CFFTX.all = 0x6000; // Enable FIFO mode and TXFIFO
I2caRegs.I2CFFRX.all = 0x2040; // Enable RXFIFO, clear RXFFINT,
return; |
|