⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 此程序用于测温度值
💻 C
字号:
#include<reg51.h>
#include "LCD_Dis.h"
#include"math.h" 
#define uchar                   unsigned char
#define uint                    unsigned int
uchar dat=0;
long int r_buff[9];
uchar r_in,s = 0;
//uchar j;
uint sum,kk;
uchar r_len;
bit	urtflag;

#include"com.c"
#include"show.c"
#include"18B20.c"
delay(uint k)
{
  uint i , j ;
  for(i = 0 ; i < k ; i++)
    for(j = 0 ; j < 121 ; j++)
        ;
}



main()
{   
     signed int tmpvalue,i;
	 int j = 34 ;
     urtinit();
	  EA=1;
	  ES=1;
	  urtflag=0;
	  r_in=0; 
  	  show_name();
	  putbyte(0x55);
  	  while(1)
	  {

	    tmpvalue = gettemp();   //读取传感器中的数据
        i = getTmpValue(tmpvalue);   //将18B20中的数据转成温度值
		cover(i) ;   //显示温度值
		
		putbyte(0) ; //数据头
		delay(50);
		putbyte(i/100) ;   //数据
		delay(50);
		putbyte(i % 100) ;                 //数据
		delay(50);
		putbyte(1) ;    //数据尾
		delay(50);
        //delay(300);
		//show(get());
		 
		FontSet(0,0xff);
	    //putbyte(r_buff[0]);
	

	//if(urtflag==1)
	   { 
	    //urtflag=0;
       
        PutChar(0,2,r_buff[0]+0x30);  //显示接收到的数据
		PutChar(8,2,r_buff[1]+0x30);
		PutChar(16,2,r_buff[2]+0x30);
		PutChar(24,2,r_buff[3]+0x30);
		//delay(400);
       }
		
	   }
	  
	  }


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -