【开源获奖案例】水泥多量测定仪

    ——来自迪文开发者论坛

 

本期为大家推送的论坛获奖开源案例可用于建筑行业检测水泥成分含量——基于T5L智能屏的水泥多量测定仪。工程师基于T5L智能屏来控制电子重量检测模块、测温模块、加热模块、水分传感器、搅拌模块,实现了固溶和液溶水泥成分含量检测功能,并支持速率实时显示、温度设置、历史记录、阶段参数设定等功能。



    完整开发资料含迪文屏DGUS工程资料与C51代码,获取方式:

1. 前往迪文开发者论坛下载:

http://inforum.dwin.com.cn:20080/forum.php?mod=viewthread&tid=9184

2. 微信公众号中回复“水泥多量测定仪”获取。

 

1 方案架构

0 水泥检测仪方案架构

2 UI素材展示


1 2

3 4


3 UI开发示例


5 水泥检测仪- DGUS开发


4 C51软件设计

工程师采用T5L串口2与控制板通讯的初始化命令程序如下:

void app_init()

{

    is_testing = 0;

    test_run_time = 0;

    is_sec = 0;

    period1 = 0;

    is_period1 = 0;

    uart2_init(115200);

    send_bytes("AT+INIT=0\r\n",sizeof("AT+INIT=0\r\n")-1);

    sys_delay_ms(2500);

    sys_pic(1);

    send_bytes("AT+START\r\n",sizeof("AT+START\r\n")-1);

}

 

T5L智能屏与控制板交互实现水泥成分检测功能的主要程序如下:

void btn_click_handler()

{

    #define  BTN_VAL_ADDR  0x1000

    u16 btn_val;

    if(is_testing&&is_sec)

    {

        is_sec = 0;

        test_run_time++;

        btn_val = sprintf(commbuff,"%02u:%02u",(u16)(test_run_time/60),(u16)(test_run_time%60));

        commbuff[btn_val+1] = 0;

        sys_write_vp(TEST_TIME_VP,commbuff,5);

        if(uart2rxsta&UART2_PACKET_OK)

        {

            if(uart2buf[0]==0x01&&uart2buf[1]==0x02)

            {

                init_weight = *(float*)(uart2buf+2);

                init_weight *= (*(float*)flashdat);

                sys_write_vp(0x1178, (u8*)&init_weight, 2);

            }else if(uart2buf[0]==0x02&&uart2buf[1]==0x05)

            {

                init_ml = *(float*)(uart2buf+2);

                init_ml /= (*(float*)flashdat+20);

                sys_write_vp(0x1180, (u8*)&init_ml, 2);

            }else if(uart2buf[0]==0x03&&uart2buf[1]==0x07)

            {

                speed_val = *(float*)(uart2buf+2);

                disp_val += (speed_val*2.45f);

                sys_write_vp(0x1180, (u8*)&disp_val, 2);

            }else if(uart2buf[0]==0x04)

            {

                total_num = uart2buf[1]*256+uart2buf[2];

            }else if(uart2buf[0]==0x05)

            {

                is_en_tmp = uart2buf[2];

            }

            uart2rxsta = 0;

        }

    }

    if(is_period1)

    {

        is_period1 = 0;

        t_sample();

        if(is_testing&&is_en_tmp)

            sys_write_vp(0x1170,(u8*)&tmp,2);

    }

    if(is_btn_scan==0)

        return;

    is_btn_scan = 0;

    sys_read_vp(BTN_VAL_ADDR,(u8*)&btn_val,1);

    if(btn_val==0)

        return;

    if(btn_val<=0x10)

        start_win_btn_click_handler(btn_val);

    btn_val = 0;

    sys_write_vp(BTN_VAL_ADDR,(u8*)&btn_val,1);

}

更多内容请参考源码。