[Foinse oscailte] Gléas Meáite Ilfheidhmeach

——Ó Fhóram Forbróirí DWIN

San eagrán seo, táimid ag brú ar chás foinse oscailte a bhuaigh duaiseanna Fóram Forbróirí DWIN - Weigher Ilfheidhme. Glacann an t-innealtóir scáileán cliste COF 4-orlach, agus tríd an idirghníomhú sonraí idir croí T5L OS agus modúl HX711 agus sraith braiteoir brú 5kg, is féidir le húsáideoirí na feidhmeanna taispeána comhaireamh a bhaint amach go héasca ar nós meáchan, praghas aonaid, praghas iomlán, tare, etc. ., Chomh maith leis na feidhmeanna a bhaineann le comhaireamh, rianú cuair athraithe meáchain, agus cruinneas meáigh a cheartú, etc., ionas go mbeidh sé éasca aistriú idir cásanna iarratais éagsúla chun taitneamh a bhaint as taithí mheá áisiúil agus éifeachtach.

1. Forbairt Chomhéadain

f26af533d43728cd210e0f7af5e7acc

2.C51 Dearadh

Seo a leanas cuid den chód tagartha don mheáchain chun an fheidhm phraghsála a chur chun feidhme:

// Leathanach Praghsála================

#define VALUATION_UNIT_PRICE_ADDR 0x1010

#define VALUATION_GRAM_ADDR 0x1000

#define VALUATION_TOTAL_PRICES_ADDR 0x1020

uint32_t luacháil_decorticate = 0; // Meáchan Tare Praghsáil

uint32_t luacháil_unit_price = 0; //Praghas aonaid

// Athnuachan Praghas Aonaid

leathanach ar neamhní_luacháil_aonad_praghsanna_athnuachan()

{

uint8_t test_display[10] = {0};

má(luach_aonad_praghas

{

test_display[0] = luacháil_unit_praghsanna / 100 % 10 + 0x30;

test_display[1] = '.';

test_display[2] = luacháil_unit_praghsanna / 10 % 10 + 0x30;

test_display[3] = luacháil_unit_praghsanna / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

eile más rud é(valuation_unit_price

{

test_display[0] = luacháil_unit_praghsanna / 1000 % 10 + 0x30;

test_display[1] = luacháil_unit_praghsanna / 100 % 10 + 0x30;

test_display[2] = '.';

test_display[3] = luacháil_unit_praghsanna / 10 % 10 + 0x30;

test_display[4] = luacháil_unit_praghsanna / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

eile más rud é(valuation_unit_price

{

test_display[0] = luacháil_aonad_praghsanna / 10000 % 10 + 0x30;

test_display[1] = luacháil_unit_praghsanna / 1000 % 10 + 0x30;

test_display[2] = luacháil_unit_praghsanna / 100 % 10 + 0x30;

test_display[3] = '.';

test_display[4] = luacháil_unit_praghsanna / 10 % 10 + 0x30;

test_display[5] = luacháil_unit_praghsanna / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

eile más rud é(valuation_unit_price

{

test_display[0] = luacháil_aonad_praghsanna / 100000 % 10 + 0x30;

test_display[1] = luacháil_unit_praghsanna / 10000 % 10 + 0x30;

test_display[2] = luacháil_unit_praghsanna / 1000 % 10 + 0x30;

test_display[3] = luacháil_unit_praghsanna / 100 % 10 + 0x30;

test_display[4] = '.';

test_display[5] = luacháil_unit_praghsanna / 10 % 10 + 0x30;

test_display[6] = luacháil_unit_praghsanna / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_UNIT_PRICE_ADDR, test_display, 4);

}

}

 

// Athnuachan Meáchan

leathanach ar neamhní_luacháil_meáchan_athnuachan()

{

uint8_t test_display[10] = {0x30};

uint32_t gram_display = 0;

if(gram_value>= luacháil_maisiúchán)

{

gram_display = gram_value - luacháil_decorticate;

má(gram_taispeáint

{

test_display[0] = gram_taispeáint / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

eile má (gram_display

{

test_display[0] = gram_taispeáint / 10 % 10 + 0x30;

test_display[1] = gram_taispeáint / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

eile má (gram_display

{

test_display[0] = gram_taispeáint / 100 % 10 + 0x30;

test_display[1] = gram_taispeáint / 10 % 10 + 0x30;

test_display[2] = gram_taispeáint / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

eile má (gram_display

{

test_display[0] = gram_taispeáint / 1000 % 10 + 0x30;

test_display[1] = gram_taispeáint / 100 % 10 + 0x30;

test_display[2] = gram_taispeáint / 10 % 10 + 0x30;

test_display[3] = gram_taispeáint / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

eile más rud é(gram_display

{

test_display[0] = gram_taispeáint / 10000 % 10 + 0x30;

test_display[1] = gram_taispeáint / 1000 % 10 + 0x30;

test_display[2] = gram_taispeáint / 100 % 10 + 0x30;

test_display[3] = gram_taispeáint / 10 % 10 + 0x30;

test_display[4] = gram_taispeáint / 1 % 10 + 0x30;

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

eile

{

dgus_show_text_value_set(VALUATION_GRAM_ADDR, test_display, 3);

}

}

 

// Athnuachan Praghas Iomlán

leathanach ar neamhní_luacháil_praghsanna_athnuachan()

{

uint32_t price_value = 0;

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

if(gram_value>= luacháil_maisiúchán)

{

price_value = (gram_value - luacháil_decorticate) * luacháil_unit_price * 2 / 1000;

má(praghas_luach

{

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

test_display[1] = '.';

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

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

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

eile má (praghas_luach

{

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

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

test_display[2] = '.';

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

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

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

eile má (praghas_luach

{

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

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

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

test_display[3] = '.';

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

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

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

eile má (praghas_luach

{

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

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

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

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

test_display[4] = '.';

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

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

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

}

eile

{

dgus_show_text_value_set(VALUATION_TOTAL_PRICES_ADDR, test_display, 4);

}

}

page_valuation_decorticate_folamh()

{

luacháil_decorticate = gram_value;

page_valuation_weight_refresh();

}

page_valuation_1() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 1;

page_valuation_unit_price_refresh();

}

}

page_valuation_2() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 2;

page_valuation_unit_price_refresh();

}

}

page_valuation_3() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 3;

page_valuation_unit_price_refresh();

}

}

leathanach ar neamhní_luacháil_4()

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 4;

page_valuation_unit_price_refresh();

}

}

page_valuation_5() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 5;

page_valuation_unit_price_refresh();

}

}

leathanach ar neamhní_luacháil_6()

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 6;

page_valuation_unit_price_refresh();

}

}

page_valuation_7() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 7;

page_valuation_unit_price_refresh();

}

}

page_valuation_8() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 8;

page_valuation_unit_price_refresh();

}

}

leathanach ar neamhní_luacháil_9()

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 9;

page_valuation_unit_price_refresh();

}

}

page_valuation_0() ar neamhní

{

má(luach_aonad_praghas

{

luacháil_unit_price = luacháil_unit_price * 10 + 0;

page_valuation_unit_price_refresh();

}

}

page_valuation_back_folamh()

{

luacháil_unit_price = luacháil_unit_price / 10;

page_valuation_unit_price_refresh();

}

leathanach ar neamhní_luacháil_soiléir()

{

luacháil_unit_price = 0;

page_valuation_unit_price_refresh();

}


Am postála: Aibreán-28-2024