|
1. I2C的初始化:
#define I2C_AcknowledgedAddress_7bit ((uint16_t)0x4000)
#define I2C_SLAVE_ADDRESS7 0xA0
/*!< I2C configuration */
/* sEE_I2C configuration */
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = I2C_SLAVE_ADDRESS7;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED;
2. 在官方I2C库文件中,OAR1寄存器被这样设置。
/*---------------------------- I2Cx OAR1 Configuration -----------------------*/
/* Set I2Cx Own Address1 and acknowledged address */
I2Cx->OAR1 = (I2C_InitStruct->I2C_AcknowledgedAddress | I2C_InitStruct->I2C_OwnAddress1);
3. STM32寄存器手册中解释如下,第14位应该是保留,默认值就是0,可是 I2C_AcknowledgedAddress_7bit 的第14位为1,为什么?
无论在STM32F1 STM32F4 系列的库文件和手册中都是这么设置的,所以应该不会是库文件出错,可是有应该如何解释,I2C_AcknowledgedAddress_7bit 到底是什么东西?
[ 本帖最后由 381082014 于 2013-3-1 15:14 编辑 ]
|
|