【开源】STM32与DMT80480L070_15WT利用232串口通讯示例
开发背景:关于扬尘监测系统中选定传感器的高温高湿度测试为了更清晰直观地观察出两种传感器在相等温度、湿度下的表现,通过设定程序将传感器测定的PM2.5、PM10、TSP、气压、噪声、温度、风向和风速九个参数显示在迪文lcd屏幕上。本次实验采用的迪文屏幕型号为DMT80480L070_15WT,主板为STM32F103系列。file:///C:/Users/WINGMA~1/AppData/Local/Temp/ksohtml9344/wps1.png 硬件上的连接方式采用232,具体程序如下所示。//设定主板与迪文屏的232通讯协议
voidcommun_232lcd_rx(void){ if(m_Time_Cnt_232lcd==0) { commun_232lcd_rx_process(); m_Time_Cnt_232lcd=-1; }}
void commun_232lcd_rx_process(void)
//设定LCD屏幕为从机,根据其指令读取
if((m_RX_Buff_232lcd==0x5A)&&(m_RX_Buff_232lcd==0xA5)&&(m_RX_Buff_232lcd==0x83)&&(m_RX_Buff_232lcd==0x10)) {
//设定LCD键盘输入指令操作
if((m_RX_Buff_232lcd==)&&(m_RX_Buff_232lcd==)&&(m_RX_Buff_232lcd==)&&(m_RX_Buff_232lcd== )&&(m_RX_Buff_232lcd==)) { data_指令 =(m_RX_Buff_232lcd-'0')*100+(m_RX_Buff_232lcd-'0')*10+(m_RX_Buff_232lcd-'0'); if((data_指令 >=10)&&(data_指令<=2000)) { STMFLASH_Write(FLASH_SAVE_warn,&data_warn,1); lcd_set_display(); } }
//气象参数要在主程序中定义,且将传感器测定数据赋值到LCD屏幕对应的地址
void lcd_data_display(void){ unsigned char i; unsigned char lcd_data={0x5A,0xA5,0x15,0x82,0x00,0x00, 0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F,0x27,0x0F}; if(lcd_data_display_1ms>1000) { lcd_data_display_1ms=0; lcd_data=0x5A; lcd_data=0xA5; lcd_data=0x15; lcd_data=0x82; lcd_data=0x00; lcd_data=0x00; lcd_data=data_PM2dot5_H; lcd_data=data_PM2dot5_L; lcd_data=data_PM10_H; lcd_data=data_PM10_L; lcd_data=data_TSP_H; lcd_data=data_TSP_L; lcd_data=data_qiya_H; lcd_data=data_qiya_L; lcd_data=data_wendu_H; lcd_data=data_wendu_L; lcd_data=data_shidu_H; lcd_data=data_shidu_L; lcd_data=data_fengxiang_H; lcd_data=data_fengxiang_L; lcd_data=data_fengsu_H; lcd_data=data_fengsu_L; lcd_data=data_zaosheng_H; lcd_data=data_zaosheng_L; for(i=0;i<26;i++) {putchar232lcd(lcd_data);delay_ms(2);} } }
//LCD键盘输入的指令十六进制转换
void lcd_set_display(void){ unsigned char i,lcd_set={0}; lcd_set=0x5A; lcd_set=0xA5; lcd_set=41; lcd_set=0x82; lcd_set=0x00; lcd_set=0x10; lcd_set=PMxishu>>8; lcd_set=PMxishu&0x00FF; lcd_set=PMxishu>>8; lcd_set=PMxishu&0x00FF; lcd_set=PMxishu>>8; lcd_set=PMxishu&0x00FF; lcd_set=WDxishu>>8; lcd_set=WDxishu&0x00FF; lcd_set=SDxishu>>8; lcd_set=SDxishu&0x00FF; lcd_set=ZSxishu>>8; lcd_set=ZSxishu&0x00FF; lcd_set=data_warn>>8; lcd_set=data_warn&0x00FF; for(i=0;i<MN_length;i++) { lcd_set=MN_num; } for(i=0;i<44;i++) { putchar232lcd(lcd_set); delay_ms(2); } } 楼主,求原程序工程文件。1196288589@qq.com,谢谢
楼主,请问怎样用迪文屏显示实时数据?
楼主,求原程序工程文件。1021315914@qq.com,谢谢 楼主,求原程序工程文件。2046271896@qq.com,谢谢
楼主,求原程序工程文件。2034801672@qq.com,谢谢
楼主,求原程序工程文件。2827716712@qq.com,谢谢 楼主666:):):) 求源程序工程文件 求源程序工程文件2780978992@qq.com