⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i2c.h

📁 AT89C51 I2C接口通信程序例程.rar
💻 H
字号:

#ifndef I2C_H
#define	I2C_H
//***********************************************************************
//包含头文件
#include "REG51.h"
#include "INTRINS.h"

//***********************************************************************
//宏定义 
typedef unsigned char uchar;
typedef unsigned int uint;
#define	SomeNOP();	{_nop_();_nop_();_nop_();_nop_();_nop_();} //用于时序延迟,方便操作

//***********************************************************************
//全局变量定义
static bit	ACK = 0;

//***********************************************************************
//函数声明
bit	NVM_WriteB(uchar sla,uint addr,uchar ch); 	//通过I2C接口向EEPROM写入一个字节数据函数
bit NVM_ReadB(uchar sla,uint addr,uchar *ch); 	//通过I2C接口从EEPROM读出一个字节数据函数,
												//结果放在ch指向的地址单元中
//通过I2C接口向EEPROM写入一个字符串函数
bit	NVM_WriteStr(uchar sla,uint addr,uchar *str,uchar length);
//通过I2C接口从EEPROM读出一个字符串函数
bit NVM_ReadStr(uchar sla,uint addr,uchar *str,uchar length);

#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -