|
unsigned char EEPROM_ByteWrite(unsigned int addr,unsigned char data)
{
unsigned char Dev_addr; //设备地址
unsigned char AddrLow;
unsigned char AddrHigh;
AddrLow = (unsigned char)addr;
AddrHigh = (unsigned char)(addr>>8);
Dev_addr = 0xa0|(AddrHigh<<1);
i2c_start();
i2c_SendByte(Dev_addr);
if(i2c_check_ACK() == FALSE)
{
return AckError;
}
i2c_SendByte(AddrHigh);
if(i2c_check_ACK() == FALSE)
{
return AckError;
}
i2c_SendByte(AddrLow);
if(i2c_check_ACK() == FALSE)
{
return AckError;
}
i2c_SendByte(data);
if(i2c_check_ACK() == FALSE)
{
return AckError;
}
i2c_stop();
i2c_delay_ms(10);
return 0;
}
问题:为什么设备地址要 Dev_addr = 0xa0|(AddrHigh<<1); |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|