24C02的可以正常读写,24C64,地址需要写2次,函数如下,但读出来的数一直不对,不知道是没写成功还是没读成功
void write_add64(u16 address,u8 date)//写24C64D,地址需要写2次
{
start();
write_byte(AddWr);
respons();
write_byte(address/256);
respons();
write_byte(address%256);
respons();
write_byte(date);
respons();
stop();
}
u8 read_add64(u16 address)
{
u8 date;
start();
write_byte(AddWr);
respons();
write_byte(address/256);
respons();
write_byte(address%256);
respons();
start();
write_byte(AddRd);
respons();
date=read_byte();
stop();
return date;
} |