SHT21.C
#include<reg52.h>
#include<intrins.h>
#include<math.h>
#include<SHT21.h>
#include<LCD1602.h>
sbit SCL=P2^6;
sbit SDA=P2^7;
sbit LED=P1^7;
//bit ACK;
int
TEMP,HUMI;
unsigned
int
i;
unsigned char
DATAT,DATAH;
float T=0,H=0;
/************************ 延时 *************************/
void Delay15us()
{
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();
}
/************************ 启动 I2C**********************/
void StartI2C()
{
SDA=1;
SCL=1;
_nop_();
SDA=0;
_nop_();
SCL=0;
}
/************************ 停止 I2C**********************/
void StopI2C()
{
SDA=0;
_nop_();
SCL=1;
_nop_();
SDA=1;
Delay15us();
}
/************************* 应答 ***********************/
void Respons(bit a)
{
if(a==0)
评论2
最新资源