群晖 lcd4linux 温度,今天终于把温度显示在LCD液晶显示屏上了 干货!
#include "reg52.h" //此文件中定义了单片机的一些特殊功能寄存器
#include"temp.h"
#include "lcd.h"
typedef unsigned int u16; //对数据类型进行声明定义
typedef unsigned char u8;
sbit LSA=P2^2;
sbit LSB=P2^3;
sbit LSC=P2^4;
char num=0;
u8 DisplayData[8];
u8 code smgduan[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
u8 CNCHAR[]=" 摄氏度 ";
void delay(u16 i)
{
while(i--);
}
void datapros(int temp)
{
float tp;
if(temp< 0) //当温度值为负数
{
DisplayData[0] = 0x40;
temp=temp-1;
temp=~temp;
tp=temp;
temp=tp*0.0625*100+0.5;
}
else
{
DisplayData[0] = 0x00;
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
