AT24CO2芯片的引脚说明:
SERIAL CLOCK (SCL): The SCL input is used to positive edgeclock data into each
EEPROM device and negativeedge clock data out of each device.
SERIAL DATA (SDA): The SDA pin is bidirectional for serialdata transfer. This pin is
open-drain driven andmay be wire-ORed with any number of other open-drain oropencollector
devices.
DEVICE/PAGE ADDRESSES (A2, A1, A0): The A2, A1 and A0 pins aredevice
address inputs that are hard wired for theAT24C01A and the AT24C02. As many as
eight 1K/2Kdevices may be addressed on a single bussystem
设备地址和数据地址
0x00~0xff;编程时需要考虑读写数据的地址。
void delay_1ms(unsigned int x)
{
}
短暂的延时函数,用在读数据和写数据之间,如果读写之间间隔较短,则芯片来不及反应,读不出数据
void delay(void)
{
}
更短的延时函数大概2us,在时钟周期里做延时函数,不能太长,曾经用for()循环写延时函数,结果延时过长,使时钟周期,和数据周期被破坏。还有一种延时的方法是 { ; ;}
用两个空语句来延时。
void at24c02_init(void)
{
}
初始化函数
void start()
{