[ប្រភពបើកចំហ] ឧបករណ៍ថ្លឹងពហុមុខងារ

—— ពីវេទិកាអ្នកអភិវឌ្ឍន៍ DWIN

នៅក្នុងបញ្ហានេះ យើងជំរុញករណីប្រភពបើកចំហដែលទទួលបានពានរង្វាន់នៃវេទិកាអ្នកអភិវឌ្ឍន៍ DWIN - Multi-function Weigher ។ វិស្វករបានប្រើប្រាស់អេក្រង់ឆ្លាតវៃ COF ទំហំ 4 អ៊ីង ហើយតាមរយៈអន្តរកម្មទិន្នន័យរវាង T5L OS core និង HX711 module និងឧបករណ៍ចាប់សញ្ញាសម្ពាធ 5kg អ្នកប្រើប្រាស់អាចដឹងយ៉ាងងាយស្រួលនូវមុខងារបង្ហាញការរាប់ដូចជាទម្ងន់ តម្លៃឯកតា តម្លៃសរុប tare ជាដើម។ ក៏ដូចជាមុខងារនៃការរាប់ ការតាមដានខ្សែកោងនៃការផ្លាស់ប្តូរទម្ងន់ និងការកែតម្រូវភាពត្រឹមត្រូវនៃទម្ងន់។

1. ការអភិវឌ្ឍន៍ UI

f26af533d43728cd210e0f7af5e7acc

2.C51 រចនា

ផ្នែកនៃលេខកូដយោងសម្រាប់អ្នកថ្លឹងថ្លែងដើម្បីអនុវត្តមុខងារកំណត់តម្លៃមានដូចខាងក្រោម៖

// ទំព័រតម្លៃ ===================

#កំណត់ VALUATION_UNIT_PRICE_ADDR 0x1010

#កំណត់ VALUATION_GRAM_ADDR 0x1000

#កំណត់ VALUATION_TOTAL_PRICES_ADDR 0x1020

uint32_t valuation_decorticate = 0; // ការកំណត់តម្លៃទម្ងន់

uint32_t valuation_unit_price = 0; //តម្លៃ​ឯកតា

// ធ្វើឱ្យតម្លៃឯកតាឡើងវិញ

មោឃៈ page_valuation_unit_price_refresh()

{

uint8_t test_display[10] = {0};

if(valuation_unit_price

{

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);

}

ផ្សេង​ទៀត​ប្រសិន​បើ (valuation_unit_price

{

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);

}

ផ្សេង​ទៀត​ប្រសិន​បើ (valuation_unit_price

{

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);

}

ផ្សេង​ទៀត​ប្រសិន​បើ (valuation_unit_price

{

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);

}

}

 

// សម្រកទំងន់

ទំព័រ_valuation_weight_refresh() ទុកជាមោឃៈ

{

uint8_t test_display[10] = {0x30};

uint32_t gram_display = 0;

if(gram_value>= valuation_decorticate)

{

gram_display = gram_value - ការវាយតម្លៃ_តុបតែង;

ប្រសិនបើ (gram_display

{

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

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

ផ្សេងទៀតប្រសិនបើ (gram_display

{

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);

}

ផ្សេងទៀតប្រសិនបើ (gram_display

{

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);

}

ផ្សេងទៀតប្រសិនបើ (gram_display

{

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);

}

ផ្សេងទៀតប្រសិនបើ (gram_display

{

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);

}

}

ផ្សេងទៀត។

{

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

 

// ធ្វើឱ្យតម្លៃសរុបឡើងវិញ

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;

ប្រសិនបើ (តម្លៃ_តម្លៃ

{

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);

}

ផ្សេងទៀតប្រសិនបើ (price_value

{

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);

}

ផ្សេងទៀតប្រសិនបើ (price_value

{

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);

}

ផ្សេងទៀតប្រសិនបើ (price_value

{

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);

}

}

ផ្សេងទៀត។

{

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

{

valuation_unit_price = valuation_unit_price * 10 + 1;

page_valuation_unit_price_refresh();

}

}

void page_valuation_2()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 2;

page_valuation_unit_price_refresh();

}

}

void page_valuation_3()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 3;

page_valuation_unit_price_refresh();

}

}

void page_valuation_4()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 4;

page_valuation_unit_price_refresh();

}

}

void page_valuation_5()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 5;

page_valuation_unit_price_refresh();

}

}

void page_valuation_6()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 6;

page_valuation_unit_price_refresh();

}

}

void page_valuation_7()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 7;

page_valuation_unit_price_refresh();

}

}

void page_valuation_8()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 8;

page_valuation_unit_price_refresh();

}

}

void page_valuation_9()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 9;

page_valuation_unit_price_refresh();

}

}

void page_valuation_0()

{

if(valuation_unit_price

{

valuation_unit_price = valuation_unit_price * 10 + 0;

page_valuation_unit_price_refresh();

}

}

void page_valuation_back()

{

valuation_unit_price = តម្លៃ_unit_price / 10;

page_valuation_unit_price_refresh();

}

void page_valuation_clear()

{

valuation_unit_price = 0;

page_valuation_unit_price_refresh();

}


ពេលវេលាបង្ហោះ៖ ថ្ងៃទី 28-04-2024