——From DWIN Developer Forum
The award-winning open source case recommended by the DWIN forum can be used in the construction industry to detect cement component content - a cement multi-amount measuring instrument based on T5L smart screen. Engineers use the T5L smart screen to control the electronic weight detection module, temperature measurement module, heating module, moisture sensor, and mixing module to realize the detection function of solid solution and liquid cement component content, and support real-time display of rate, temperature setting, history record, Stage parameter setting and other functions.
1. Program Structure
2.UI Material Display
3.UI Development Example
4.C51 software design
The initialization command program for the engineer to communicate with the control board using the T5L serial port 2 is as follows:
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);
}
The main program of the T5L intelligent screen interacting with the control board to realize the function of cement composition detection is as follows:
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);
}
Refer to the source code for more.
Post time: Dec-02-2023