精品国产Av无码久久久蜜臀-免费看a级淫秽真实动作衫视频-人妻无码一区二区三区免费视频-奶好大 好长 好紧免费视频

logo

【開(kāi)源獲獎(jiǎng)案例】多功能稱重器

                ——來(lái)自迪文開(kāi)發(fā)者論壇


    本期為大家推送迪文開(kāi)發(fā)者論壇獲獎(jiǎng)開(kāi)源案例——多功能稱重器。工程師采用4英寸COF智能屏,通過(guò)T5L OS核與HX711模塊及5kg壓力傳感器套裝進(jìn)行數(shù)據(jù)交互,用戶可輕松查看重量、單價(jià)、總價(jià)、去皮等計(jì)價(jià)顯示功能,以及計(jì)數(shù)、重量變化曲線跟蹤和稱重器精準(zhǔn)度矯正等功能,輕松切換不同應(yīng)用場(chǎng)景,享受便捷高效稱重體驗(yàn)。

 【演示視頻】

                         


完整開(kāi)發(fā)資料含迪文屏DGUS工程資料與C51代碼,獲取方式:

1. 前往迪文開(kāi)發(fā)者論壇獲?。?span style="text-decoration: underline; line-height: 150%; color: rgb(51, 102, 153); background: rgb(255, 255, 255); font-size: 18px; font-family: 微軟雅黑, "Microsoft YaHei";">http://inforum.dwin.com.cn:20080/forum.php?mod=viewthread&tid=10017&extra=page%3D1

2. 微信公眾號(hào)中回復(fù)“多功能稱重器”獲取。

 

 

【UI開(kāi)發(fā)示例】

UI界面

 


【C51工程設(shè)計(jì)】

稱重器實(shí)現(xiàn)計(jì)價(jià)功能的部分參考代碼如下:

 

//計(jì)價(jià)頁(yè)面===================

#define VALUATION_UNIT_PRICE_ADDR 0x1010

#define VALUATION_GRAM_ADDR 0x1000

#define VALUATION_TOTAL_PRICES_ADDR 0x1020

uint32_t valuation_decorticate = 0;   //計(jì)價(jià)去皮重量

uint32_t valuation_unit_price = 0;    //單價(jià)

//單價(jià)刷新

void page_valuation_unit_price_refresh()

{

    uint8_t test_display[10] = {0};

    if(valuation_unit_price < 1000)

    {

        test_display[0] = valuation_unit_price / 100 % 10 + 0x30;

        test_display[1] = '.';

        test_display[2] = valuation_unit_price / 10 % 10 + 0x30;

        test_display[3] = valuation_unit_price / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

    }

    else if(valuation_unit_price < 10000)

    {

        test_display[0] = valuation_unit_price / 1000 % 10 + 0x30;

        test_display[1] = valuation_unit_price / 100 % 10 + 0x30;

        test_display[2] = '.';

        test_display[3] = valuation_unit_price / 10 % 10 + 0x30;

        test_display[4] = valuation_unit_price / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

    }

    else if(valuation_unit_price < 100000)

    {

        test_display[0] = valuation_unit_price / 10000 % 10 + 0x30;

        test_display[1] = valuation_unit_price / 1000 % 10 + 0x30;

        test_display[2] = valuation_unit_price / 100 % 10 + 0x30;

        test_display[3] = '.';

        test_display[4] = valuation_unit_price / 10 % 10 + 0x30;

        test_display[5] = valuation_unit_price / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

    }

    else if(valuation_unit_price < 1000000)

    {

        test_display[0] = valuation_unit_price / 100000 % 10 + 0x30;

        test_display[1] = valuation_unit_price / 10000 % 10 + 0x30;

        test_display[2] = valuation_unit_price / 1000 % 10 + 0x30;

        test_display[3] = valuation_unit_price / 100 % 10 + 0x30;

        test_display[4] = '.';

        test_display[5] = valuation_unit_price / 10 % 10 + 0x30;

        test_display[6] = valuation_unit_price / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

    }

}

 

//重量刷新

void page_valuation_weight_refresh()

{

    uint8_t test_display[10] = {0x30};

    uint32_t gram_display = 0;

    if(gram_value >= valuation_decorticate)

    {

        gram_display = gram_value - valuation_decorticate;

        if(gram_display < 10)

        {

            test_display[0] = gram_display / 1 % 10 + 0x30;

            dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

        }

    else if(gram_display < 100)

    {

        test_display[0] = gram_display / 10 % 10 + 0x30;

        test_display[1] = gram_display / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

    }

    else if(gram_display < 1000)

    {

        test_display[0] = gram_display / 100 % 10 + 0x30;

        test_display[1] = gram_display / 10 % 10 + 0x30;

        test_display[2] = gram_display / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

    }

    else if(gram_display < 10000)

    {

        test_display[0] = gram_display / 1000 % 10 + 0x30;

        test_display[1] = gram_display / 100 % 10 + 0x30;

        test_display[2] = gram_display / 10 % 10 + 0x30;

        test_display[3] = gram_display / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

    }

    else if(gram_display < 100000)

    {

        test_display[0] = gram_display / 10000 % 10 + 0x30;

        test_display[1] = gram_display / 1000 % 10 + 0x30;

        test_display[2] = gram_display / 100 % 10 + 0x30;

        test_display[3] = gram_display / 10 % 10 + 0x30;

        test_display[4] = gram_display / 1 % 10 + 0x30;

        dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

        }

    }

    else

    {

        dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

    }

}

 

//總價(jià)刷新

void page_valuation_price_refresh()

{

    uint32_t price_value = 0;

    uint8_t test_display[10] = {0x30, '.', 0x30, 0x30};

    if(gram_value >= valuation_decorticate)

    {

        price_value = (gram_value - valuation_decorticate) * valuation_unit_price * 2 / 1000;

        if(price_value < 1000)

        {

            test_display[0] = price_value / 100 % 10 + 0x30;

            test_display[1] = '.';

            test_display[2] = price_value / 10 % 10 + 0x30;

            test_display[3] = price_value / 1 % 10 + 0x30;

            dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

        }

        else if(price_value < 10000)

        {

            test_display[0] = price_value / 1000 % 10 + 0x30;

            test_display[1] = price_value / 100 % 10 + 0x30;

            test_display[2] = '.';

            test_display[3] = price_value / 10 % 10 + 0x30;

            test_display[4] = price_value / 1 % 10 + 0x30;

            dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

        }

        else if(price_value < 100000)

        {

            test_display[0] = price_value / 10000 % 10 + 0x30;

            test_display[1] = price_value / 1000 % 10 + 0x30;

            test_display[2] = price_value / 100 % 10 + 0x30;

            test_display[3] = '.';

            test_display[4] = price_value / 10 % 10 + 0x30;

            test_display[5] = price_value / 1 % 10 + 0x30;

            dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

        }

        else if(price_value < 1000000)

        {

            test_display[0] = price_value / 100000 % 10 + 0x30;

            test_display[1] = price_value / 10000 % 10 + 0x30;

            test_display[2] = price_value / 1000 % 10 + 0x30;

            test_display[3] = price_value / 100 % 10 + 0x30;

            test_display[4] = '.';

            test_display[5] = price_value / 10 % 10 + 0x30;

            test_display[6] = price_value / 1 % 10 + 0x30;

            dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

        }

    }

    else

    {

        dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

    }

}

void page_valuation_decorticate()

{

    valuation_decorticate = gram_value;

    page_valuation_weight_refresh();

}

void page_valuation_1()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 1;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_2()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 2;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_3()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 3;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_4()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 4;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_5()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 5;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_6()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 6;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_7()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 7;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_8()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 8;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_9()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 9;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_0()

{

    if(valuation_unit_price < 100000)

    {

        valuation_unit_price = valuation_unit_price * 10 + 0;

        page_valuation_unit_price_refresh();

    }

}

void page_valuation_back()

{

    valuation_unit_price = valuation_unit_price / 10;

    page_valuation_unit_price_refresh();

}

void page_valuation_clear()

{

    valuation_unit_price = 0;

    page_valuation_unit_price_refresh();

}

????????