基于 SHT10和LCD1602的程序.docVIP

  1. 1、本文档被系统程序自动判定探测到侵权嫌疑,本站暂时做下架处理。
  2. 2、如果您确认为侵权,可联系本站左侧在线QQ客服请求删除。我们会保证在24小时内做出处理,应急电话:400-050-0827。
  3. 3、此文档由网友上传,因疑似侵权的原因,本站不提供该文档下载,只提供部分内容试读。如果您是出版社/作者,看到后可认领文档,您也可以联系本站进行批量认领。
查看更多
基于 SHT10和LCD1602的程序

/*********************************************************************************** SHT110温湿度+LCD1602 C ***********************************************************************************/ #include REG52.h //Microcontroller specific library, e.g. port definitions #include intrins.h //Keil library (is used for _nop()_ operation) #include math.h //Keil library #include stdio.h //Keil library typedef union { unsigned int i; float f; } value; int tem,humi,x,y,z,m; enum {TEMP,HUMI}; sbit DATA = P1^7; sbit SCK = P1^6; #define noACK 0 #define ACK 1 //adr command r/w #define STATUS_REG_W 0x06 //000 0011 0 #define STATUS_REG_R 0x07 //000 0011 1 #define MEASURE_TEMP 0x03 //000 0001 1 #define MEASURE_HUMI 0x05 //000 0010 1 #define RESET 0x1e //000 1111 0 #define uchar unsigned char uchar jgh[10]={000%c}; void show_time(); //液晶显示程序 /************************** 1602液晶显示部分子程序 *****************************/ //Port Definitions********************************************************** sbit LcdRs = P3^5; sbit LcdRw = P3^6; sbit LcdEn = P3^4; sfr DBPort = 0x80; //P0=0x80,P1=0x90,P2=0xA0,P3=0xB0.数据端口 //内部等待函数************************************************************************** unsigned char LCD_Wait(void) { LcdRs=0; LcdRw=1; _nop_(); LcdEn=1; _nop_(); LcdEn=0; return DBPort; } //向LCD写入命令或数据************************************************************ #define LCD_COMMAND 0 // Command #define LCD_DATA 1 // Data #define LCD_CLEAR_SCREEN 0x01 // 清屏 #define LCD_HOMING 0x02 // 光标返回原点 void LCD_Write(bit style, unsigned char input) { LcdEn=0; LcdRs=style; LcdRw=0; _nop_(); DBPort=input; _nop_();//注意顺序 LcdEn=1; _nop_();//注意顺序 LcdEn=0; _nop_(); LCD_Wait(); } //设置显示模式************************************************************ #define LCD_SHOW

文档评论(0)

xcs88858 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档