1、采用51单片机作为主控芯片;
2、采用LCD1602同时显示温度/PH/浊度;
3、采用TLC2543作为ADC模数转换处理;
4、温度/浊度/PH值任一超标时蜂鸣器报警;
5、采用串口通信将数据发送至电脑端;
上传信息:T26-Z60-P7.5
信息表示:温度26°-浊度60%-PH值为7.5
采用Proteus作为仿真设计工具。Proteus是一款著名的EDA工具(仿真软件),从原理图布图、代码调试到单片机与外围电路协同仿真,一键切换到PCB设计,真正实现了从概念到产品的完整设计。
登录后复制
void main(void){ LcdInit(); ShtConnectReset(); UART_Init();
while(1) { ReadShtData(); DisplayListChar(4,0,"temp:");
DisplayOneChar(10,0,(char)(temp/10+'0')); DisplayOneChar(11,0,(char)(temp%10+'0'));
DisplayOneChar(12,0,(char)(' ')); DisplayOneChar(13,0,(char)('C')); Uart1Send( 'T' );
Uart1Send( (char)(temp/10+'0') ); Uart1Send( (char)(temp%10+'0') ); Uart1Send( '-' );
read2543(0);//调用2543驱动程序测量地址为 LUX_now=volt*2; DisplayListChar(0,1,"ZD:");
DisplayOneChar(3,1,(char)(volt*2/1000000+'0')); DisplayOneChar(4,1,(char)((volt*2/100000)%10+'0'));
DisplayOneChar(6,1,(char)('%')); Uart1Send( 'Z' ); Uart1Send( (char)(volt*2/1000000+'0') );
Uart1Send( (char)((volt*2/100000)%10+'0') ); Uart1Send( '-' );
read2543(1);//调用2543驱动程序测量地址为 C2_now=volt*2; DisplayListChar(10,1,"PH:");
DisplayOneChar(13,1,(char)(volt*2/1000000+'0')); DisplayOneChar(14,1,(char)('.'));
DisplayOneChar(15,1,(char)((volt*2/100000)%10+'0')); Uart1Send( 'P' );
Uart1Send( (char)(volt*2/1000000+'0') ); Uart1Send( '.' );
Uart1Send( (char)((volt*2/100000)%10+'0') ); Uart1Send( '-' );
if(LUX_now>LUX_max || C2_now>C2_max || temp>temp_max) { BEEP=0; }else { BEEP=1; }
} }1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35
.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删