大家好,
24C08的读写程序如下,其中地址是uchar型的,取值范围是0-256,但24C08的容量是1024个BYTE,我试了一下,用write_add(896,78),然后再read_add(896),读出的数字是78,但让我疑惑的是,地址896早就超出了uchar的范围了啊.这是什么原因呢?
void write_add(uchar address,uchar date)
{
start();
write_byte(0xa0);
respons();
write_byte(address);
respons();
write_byte(date);
respons();
stop();
}
uchar read_add(uchar address)
{
uchar date;
start();
write_byte(0xa0);
respons();
write_byte(address);
respons();
start();
write_byte(0xa1);
respons();
date=read_byte();
stop();
return date;
} |