标签: 杂谈 |
// 头文件
// 使用Eeprom的设备标识符,即器件地址
// 24C64最多可以定定义8个
//#define I2C_FIRST_ID 0xA0 // 1010,000,0B
//#define I2C_SECOND_ID 0xA2 // 1010,001,0B
//#define I2C_THIRD_ID 0xA4 // 1010,010,0B
//#define I2C_FOURTH_ID 0xA6 // 1010,011,0B
//#define I2C_FIFTH_ID 0xA8 // 1010,100,0B
//#define I2C_SIXTH_ID 0xAA // 1010,101,0B
//#define I2C_SEVENTH_ID 0xAC // 1010,110,0B
//#define I2C_EIGHTH_ID 0xAE // 1010,111,0B
// 公用函数
void iicWriteByteAt24c16( const unsigned char I2C_EEPROM_ID, // 器件地址
const unsigned int address, // 要写入的地址
const unsigned char Ddata // 要写入的数据
);
unsigned char iicReadByteAt24c16( const unsigned char I2C_EEPROM_ID, // 器件地址
const unsigned int address // 要读出一个字节的地址
);
void iicWrite_N_ByteAt24c16(
const unsigned char I2C_EEPROM_ID, // 从器件地址
const unsigned int address, // 要写入字节的地址
// 使用Eeprom的设备标识符,即器件地址
// 24C64最多可以定定义8个
//#define I2C_FIRST_ID 0xA0 // 1010,000,0B
//#define I2C_SECOND_ID 0xA2 // 1010,001,0B
//#define I2C_THIRD_ID 0xA4 // 1010,010,0B
//#define I2C_FOURTH_ID 0xA6 // 1010,011,0B
//#define I2C_FIFTH_ID 0xA8 // 1010,100,0B
//#define I2C_SIXTH_ID 0xAA // 1010,101,0B
//#define I2C_SEVENTH_ID 0xAC // 1010,110,0B
//#define I2C_EIGHTH_ID 0xAE // 1010,111,0B
// 公用函数
void iicWriteByteAt24c16( const unsigned char I2C_EEPROM_ID, // 器件地址
const unsigned int address, // 要写入的地址
const unsigned char Ddata // 要写入的数据
);
unsigned char iicReadByteAt24c16( const unsigned char I2C_EEPROM_ID, // 器件地址
const unsigned int address // 要读出一个字节的地址
);
void iicWrite_N_ByteAt24c16(
const unsigned char I2C_EEPROM_ID, // 从器件地址
const unsigned int address, // 要写入字节的地址