#include <INTRINS.H>
#include "..\config\c8051f350.h"
#include "..\config\const.h"
#include "..\driver\system.h"
#include "..\driver\other.h"
#define IIC_WRITE 0
#define IIC_READ 1
#define VREF 24380
static unsigned long sysclk=24500000;
sbit SDA=P0^0;
sbit SCL=P0^1;
sbit led=P1^2;
void Delay_us(unsigned int times){
unsigned int i;
for(i=0;i<times;i++){
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
} //延时us函数
void Delay_ms(unsigned int times)
{
unsigned int i;
for (i=0;i<times;i++)
Delay_us(1000);
} //延时ms函数
void iic_start(void){
SDA = 1;
Delay_us(2);
SCL = 1;
Delay_us(2);
SDA = 0;
Delay_us(2);
} //iic通信起始信号
void iic_stop(void){
SDA = 0;
Delay_us(2);
SCL = 1;
Delay_us(2);
SDA =1;
} //iic通信终止信号
void iic_ack(void)
51单片机利用IIC总线对LM75A温度进行读取
最新推荐文章于 2023-11-04 16:01:17 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)