| 
 
| 我用STM32F030F4P6读写AT24C16,可是写入0x55,读出为0. 我第一次用STM32F030,不知道跟F1有什么不同。
 贴出部分代码:
 
 //I2C??????
 #define SDA     GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_6)
 //I2C??????
 #define SDA_0        GPIO_ResetBits(GPIOA, GPIO_Pin_6)
 #define SDA_1   GPIO_SetBits(GPIOA, GPIO_Pin_6)
 #define SCL_0   GPIO_ResetBits(GPIOA, GPIO_Pin_5)
 #define SCL_1          GPIO_SetBits(GPIOA, GPIO_Pin_5)
 
 
 
 void GPIOForEEPROMInit(void)
 {
 GPIO_InitTypeDef GPIO_InitStructure;
 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5|GPIO_Pin_6;
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//??
 GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;//??
 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
 GPIO_Init(GPIOA,&GPIO_InitStructure);
 GPIO_SetBits(GPIOA,GPIO_Pin_5|GPIO_Pin_6);
 }
 
 主程序
 GPIOForEEPROMInit();
 WriteByteToEEROM(0,0x55);
 ms_delay(1000);
 temp=ReadByteFromEEROM(0);
 
 请高手指教,谢谢!
 
 
 | 
 |