基于单片机液位监控系统仿真控制设计-毕设课设资料
【资源下载】下载地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl
#include <reg51.h>
#include <DS18B20.h>
#include <LCD1602.h>
#include <TLC2543.h>
#define uchar unsigned char
#define uint unsigned int
sbit PWM=P2^4; //电机PWM输出端口
sbit SW=P2^5; //电机正反转控制端口
sbit K1=P3^0; //功能设置按键
sbit K2=P3^1; //加按键
sbit K3=P3^2; //减按键
uchar ratio=10; //PWM占空比
uchar count=0; //PWM定时计数
uchar func=0; //系统功能,0当前状态,1上下限设置,2电机转速
uchar high=150,low=50,height=0;
uchar LCD_Buf1[16]={"W = 000.0m"};
uchar LCD_Buf2[16]={"T = 000.0C"};
uchar LCD_Buf3[16]={"H = 150.0m"};
uchar LCD_Buf4[16]={"L = 050.0m"};
uchar LCD_Buf5[16]={"Full = 384r/m"};
uchar LCD_Buf6[16]={"Now = 000r/m"};
//------------------------------------------------------
//显示温度及液位
//------------------------------------------------------
void Display_HT(void)
{
uint volt,t;
//电压值显示数据处理
volt=TLC2543(0)*50.0/4095*102.3/2.5;
LCD_Buf1[4]=volt/1000+'0';
LCD_Buf1[5]=volt/100%10+'0';
LCD_Buf1[6]=volt/10%10+'0';
LCD_Buf1[8]=volt%10+'0';
//温度值显示数据处理
t=ReadTemperature();
LCD_Buf2[4]=t/1000+'0';
LCD_Buf2[5]=t/100%10+'0';
LCD_Buf2[6]=t/10%10+'0';