#include <REGX52.H> #include "LCD1602.h" #include "dht11.c" #include "BH1750.c"
float dis_temp; uint dis_temp1; uchar ms=0; bit s0=0;
uchar UART_Upload[9]; // Upload上傳 accord主動 uint pm_rateH,pm_rateL,pm_particle,pm_density,pm_URV;//低脈沖率高位。低脈沖率低位, 比率,顆粒,濃度 PM_URV pm上限值 uchar accord=0; void Multiple_Read_BH1750(); //連續的讀取內部寄存器數據
void display() {
LCD1602_write(0,0x80); LCD1602_writebyte("PM2.5:"); LCD1602_write(1,0x30+pm_density/1000%10); LCD1602_write(1,0x30+pm_density/100%10); LCD1602_write(1,0x30+pm_density/10%10); LCD1602_writebyte("."); LCD1602_write(1,0x30+pm_density%10); LCD1602_writebyte("ug/m3");
LCD1602_write(0,0xC0); dis_temp1=(uint)(dis_temp); if(dis_temp1>9999) LCD1602_write(1,0x30+dis_temp1/10000); else LCD1602_write(1,' '); if(dis_temp1>999) LCD1602_write(1,0x30+dis_temp1%10000/1000); else LCD1602_write(1,' '); if(dis_temp1>99) LCD1602_write(1,0x30+dis_temp1%1000/100); else LCD1602_write(1,' '); if(dis_temp1>9) LCD1602_write(1,0x30+dis_temp1%100/10); else LCD1602_write(1,' '); LCD1602_write(1,0x30+dis_temp1%10); LCD1602_writebyte("Lx ");
LCD1602_write(1,0x30+U8RH_data_H/10%10); LCD1602_write(1,0x30+U8RH_data_H%10); LCD1602_writebyte("% ");
LCD1602_write(1,0x30+U8T_data_H/10%10); LCD1602_write(1,0x30+U8T_data_H%10); LCD1602_write(1,0xdf); LCD1602_writebyte("C");
|