LM016L的显示程序.docVIP

  • 268
  • 1
  • 约2.05万字
  • 约 8页
  • 2016-09-13 发布于河南
  • 举报
LM016L的显示程序

#include reg51.h #include intrins.h #define uchar unsigned char #define uint?? unsigned intsbit DQ = P2^7 ;????????????????????? //定义DS18B20端口DQ? void reset();???????????????????????? //DS18B20复位函数? void write_byte(uchar val);?????????? //DS18B20写命令函数? uchar read_byte(void);??????????????? //DS18B20读1字节函数? void read_temp();???????????????????? //温度读取函数?? void work_temp();???????????????????? //温度数据处理函数??? sbit BEEP=P2^5 ;????????????????????? //蜂鸣器驱动线? bit presence?? ;sbit LCD_RS = P3^5 ;???????????? sbit LCD_RW = P3^6 ; sbit LCD_EN = P3^7 ;uchar code?? cdis1[ ] = {?? SETTEMP:? 50.C?? } ; uchar code?? cdis2[ ] = {?? TESTTEMP:???? .?? C } ; uchar code?? cdis3[ ] = { DS18B20?? ERR0R } ; uchar code?? cdis4[ ] = {?? PLEASE CHECK? } ;unsigned char data?? temp_data[2] = {0x00,0x00} ; unsigned char data?? display[5] =??? {0x00,0x00,0x00,0x00,0x00} ; unsigned char code?? ditab[16] =???? {0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x08,0x09,0x09} ; void beep() ; unsigned char code?? mytab[8] = {0x0C,0x12,0x12,0x0C,0x00,0x00,0x00,0x00} ;#define delayNOP() ; {_nop_() ;_nop_() ;_nop_() ;_nop_() ;} ;/*******************************************************************/ void delay1(int ms) { unsigned char y ; ?? while(ms--) { ?? for(y = 0 ; y250 ; y++) ?? { ??? _nop_() ; ??? _nop_() ; ??? _nop_() ; ??? _nop_() ; ?? } } }/******************************************************************/ /*检查LCD忙状态??????????????????????????????????????????????????? */ /*lcd_busy为1时,忙,等待。lcd-busy为0时,闲,可写指令与数据。??? */ /******************************************************************/ bit lcd_busy() {????????????????????????? ???? bit result ; ???? LCD_RS = 0 ; ???? LCD_RW = 1 ; ???? LCD_EN = 1 ; ???? delayNOP() ; ???? result = (bit)(P10x80) ; ???? LCD_EN = 0 ; ???? return(result) ; }/*写指令数据到LCD?????????????????????????????????????????????????? */ /*RS=L,RW=L,E=高脉冲,D0-D7=指令码。?????????? */ /*******************************************************************/ void lcd_wcm

文档评论(0)

1亿VIP精品文档

相关文档