……
摘要: 一、创建头文件i2c.h代码如下: #ifndef __I2C_H_ #define __I2C_H_ #include <reg52.h> sbit SCL=P2^1; sbit SDA=P2^0; void I2cStart(); // I2c启动 void I2cStop(); // I2c停 阅读全文
posted @ 2020-06-01 11:14 十零 阅读(1320) 评论(0) 推荐(0) 编辑
摘要: 一、创建头文件pcf8591.h代码如下: #ifndef __FPC8591_H_ #define __FPC8591_H_ #include <reg52.h> void init_pcf8591(void); //pcf8591初始化 unsigned char adc_pcf8591(voi 阅读全文
posted @ 2020-06-01 11:07 十零 阅读(2158) 评论(0) 推荐(0) 编辑
摘要: 一、创建头文件lcd1602.h代码如下: #ifndef __LCD1602_H_ #define __LCD1602_H_ #include <reg52.h> #include <stdio.h> #define uint unsigned int //定义常用数据类型替代码 #define 阅读全文
posted @ 2020-06-01 11:01 十零 阅读(1983) 评论(0) 推荐(0) 编辑
摘要: 一、主函数如下: #include <reg52.h> //此文件中定义了单片机的一些特殊功能寄存器 #include "lcd1602.h" #include"fpc8591.h" #include"i2c.h" /***************************************** 阅读全文
posted @ 2020-06-01 10:56 十零 阅读(2623) 评论(2) 推荐(0) 编辑