www.pudn.com > 24C02-external-I2C-bus-EEPROM-.rar > 24c02.h, change:2013-03-21,size:627b


#ifndef __24C02_H__ 
#define __24C02_H__ 
 
#include "stc12le5a60s2.h" 
 
//I2C接口定义 
sbit SCL = P2^6;                //AT24C02的时钟 
sbit SDA = P2^7;                //AT24C02的数据 
 
//AT24C02页大小 
#define PAGE_SIZE 8 
 
//AT24C02测试开始地址 
#define TEST_ADD  0x00 
 
//AT24C02应答定义 
#define ACK    0 
#define NOACK  1 
 
//AT24C02读写地址 
#define AT24C02_ADD_WR  0xa0		//写地址 
#define AT24C02_ADD_RD  0xa1		//读地址 
 
//外部函数声明 
void AT24C02_Start(void); 
void AT24C02_Stop(void); 
void AT24C02_SendACK(bit ack); 
void AT24C02_SendByte(unsigned char dat); 
unsigned char AT24C02_RecvByte(void); 
 
#endif