void Read24C64(unsigned int ADDR,unsigned char *s,unsigned char no)
{
// uchar ddata=0;
unsigned char ADDR_L,ADDR_H,i;
ADDR_L=ADDR%256;
ADDR_H=ADDR/256;
IIC_START ();
IIC_TX_DATA (0xA0);
delay(50);
IIC_TX_DATA (ADDR_H);
delay(50);
IIC_TX_DATA (ADDR_L);
delay(50);
IIC_START ();
IIC_TX_DATA (0xA1);
delay(50);
for(i=0;i<no;i++)
{
s[i]= IIC_RX_DATA();
if(i!=no-1)
{
IIC_ACK ();
}
}
delay(50);
IIC_STOP ();
}
void Write24C64(unsigned int ADDR,unsigned char *ddata,unsigned char no)
{
unsigned char ADDR_H,ADDR_L,i;
ADDR_L=ADDR%256;
ADDR_H=ADDR/256;
SDA_OUT;
IIC_START ();
IIC_TX_DATA (0xA0); // E2PROM 片选
IIC_TX_DATA (ADDR_H); // 大于256BIT的EEPROM需加地址高位
IIC_TX_DATA (ADDR_L);
for(i=0;i<no;i++)
{
IIC_TX_DATA(ddata[i]);
delay(50);
}
IIC_STOP ();
delay (0x3FFF); // 等待写时序
}
main()
{
unsigned char temp[32];
unsigned char temp1[32]={9,5,3,4,5,6,7,8,23,10,11,12,13,14,15,16,17,18,
19,20,21,22,23,24,25,26,27,28,29,30,11,33};
Write24C64(0x0030,temp1,8);
delay(0x5000);
Read24C64(0x0030,temp,8);
delay(1000);
}
函数不全啊!IIC_START(),IIC_TX_DATA()都没有啊!呵呵,能不能详细一些