123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687 |
- #include "daScreen.h"
- #include <rtthread.h>
- #include "usart.h"
- #include "buffer.h"
- #include "display.h"
- #include <stdlib.h>
- unsigned char cmdHead[13] = {0x3A,0x2A,0x48,0x46,0x36,0x30,0x31,0x41,0x41,0x53,0x37,0x30,0x31};
- unsigned char cmdEnd[2] = {0x0D,0x0A};
- const unsigned char cmd_kpttmrwatch[24] = {0x20, 0x20, 0x20, 0x20, 0x20, 0xBF, 0xC6, 0xC5, 0xC8, 0xCC, 0xDA, 0x54, 0x4D, 0x52,
- 0x57, 0x61, 0x74, 0x63, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20
- };
- const unsigned char cmd_kpttmrwatchxt[24] = {0x20, 0x20, 0x20, 0xC8, 0xAB, 0xBB, 0xEC, 0xBA, 0xCF, 0xC8, 0xD5, 0xC1, 0xB8, 0xBC,
- 0xE0, 0xB9, 0xDC, 0xCF, 0xB5, 0xCD, 0xB3, 0x20, 0x20, 0x20
- };
- const unsigned char cmd_Stop[24] = {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC7, 0xEB, 0xCD, 0xA3, 0xD6, 0xB9, 0xBC,
- 0xD3, 0xC1, 0xCF, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20
- };
- const unsigned char cmd_Sum[6] = {0xD4, 0xD8, 0xD6, 0xD8, 0xA3, 0xBA};
- const unsigned char cmd_Next[6] = {0xC7, 0xEB, 0xB1, 0xB8, 0xA3, 0xBA};
- unsigned char TempCmd[100];
- //unsigned char Tempdisplay[200]= {0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
- // 0x00,0x00,0x63,0x02,0x37,0x00,0xA3,0x06, //6K3
- // 0x02,0x01,0x00,0x00,0x01,0x2E,0x00,0x00,
- // 0x08,0x80,0x04,0x00,0xB8,0x80,0x10,0x00,
- // 0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,
- // 0x02,0x01,0x01,0x00,0x00,0x00,0x13,0x00,
- // 0x00,0x00
- // };
- unsigned char Tempdisplay[200]= {0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x69,0x02,0x37,0x00,0xA3,0x06, //6K4
- 0x02,0x01,0x00,0x00,0x01,0x2E,0x00,0x00,
- 0x08,0x80,0x04,0x00,0xB8,0x80,0x10,0x00,
- 0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00,
- 0x02,0x01,0x01,0x00,0x00,0x00,0x13,0x00,
- 0x00,0x00
- };
- unsigned char tmep_Weight[10];
- unsigned char i=0;
- unsigned char display_productName_v[40] = {0x5C,0x43,0x31};
- unsigned char display_Current_v[40] = {0x5C,0x43,0x31};
- unsigned char display_Next_v[40] = {0x5C,0x43,0x31};
- unsigned char display_Process_v[40] = {0x20,0x20,0x20};
- unsigned char display_Total_v[40] = {0x20,0x20,0x20};
- unsigned char display_Stop_v[40] = {0x20,0x20,0x20};
- extern unsigned char WeightConst_Run;
- extern unsigned char WeightConst_Product_Run; //开始运行
- extern unsigned char WeightConst_product[];
- extern unsigned short WeightConst_productW; //目标总量
- extern unsigned char WeightConst_feed[]; //原料名称
- extern unsigned char WeightConst_Nextfeed[]; //临时表
- extern signed short WeightConst_NextWeightTarget; //目标重量
- extern signed long WeightConst_WeightCurTem;
- extern unsigned char WeightConst_Weight_display[];
- extern unsigned char ScreenBuf_Pop(void);
- extern int ScreenBufSize(void);
- extern unsigned char WeightConst_SBType;
- extern unsigned char WeightConst_remoteDisplay;
- extern unsigned char inMenu;
- extern unsigned char isn; //是否新大屏
- unsigned char finish_send;
- void cmd_head(uint8_t *buf, unsigned char j)
- {
- for(int i=0; i<13; i++) buf[i] = cmdHead[i];
- buf[6] = j + '0';
- }
- void cmd_end(uint8_t *buf, unsigned char j)
- {
- for(int i=0; i<2; i++)
- buf[j+i] = cmdEnd[i];
- }
- void cmd_null(uint8_t *buf, unsigned char j, unsigned char k)
- {
- for(int i=0; i<k; i++) buf[13+j+i] = 0x20;
- }
- void clearScreen(unsigned char j)
- {
- switch (j){
- case 1:
- rt_memset(display_productName_v, 0x20, 40);
- cmd_head(display_productName_v, j);
- cmd_end(display_productName_v, 37);
- break;
- case 2:
- rt_memset(display_Current_v,0x20,40);
- cmd_head(display_Current_v, j);
- cmd_end(display_Current_v, 37);
- break;
- case 3:
- rt_memset(display_Process_v,0x20,40);
- cmd_head(display_Process_v, j);
- cmd_end(display_Process_v, 37);
- break;
- case 4:
- rt_memset(display_Total_v,0x20,40);
- cmd_head(display_Total_v, j);
- cmd_end(display_Total_v, 37);
- break;
- case 5:
- rt_memset(display_Next_v,0x20,40);
- cmd_head(display_Next_v, j);
- cmd_end(display_Next_v, 37);
- break;
- case 6:
- rt_memset(display_Stop_v,0x20,40);
- cmd_head(display_Stop_v, j);
- cmd_end(display_Stop_v, 37);
- break;
- }
- }
- void display_KPT_TMRWatch(void)
- {
- clearScreen(1);
- for (int j=0; j<39; j++) uart4_send_data[j] = display_productName_v[j];
- send_uart4_send_data();
-
- clearScreen(2);
- for(int i=0; i<24; i++) display_Current_v[13+i] = cmd_kpttmrwatch[i];
- for (int j=0; j<39; j++) uart4_send_data[j] = display_Current_v[j];
- send_uart4_send_data();
-
- clearScreen(3);
- for (int j=0; j<39; j++) uart4_send_data[j] = display_Process_v[j];
- send_uart4_send_data();
-
- clearScreen(4);
- for(int i=0; i<24; i++) display_Total_v[13+i] = cmd_kpttmrwatchxt[i];
- for (int j=0; j<39; j++) uart4_send_data[j] = display_Total_v[j];
- send_uart4_send_data();
-
- clearScreen(5);
- for (int j=0; j<39; j++) uart4_send_data[j] = display_Next_v[j];
- send_uart4_send_data();
-
- clearScreen(6);
- for (int j=0; j<39; j++) uart4_send_data[j] = display_Stop_v[j];
- send_uart4_send_data();
-
- }
- void display_productName(void) //显示产品名称
- {
- clearScreen(1);
- for (int i = 0; i < 22; i++)
- display_productName_v[13+2+i] = WeightConst_product[i];
- }
- void display_Current(int weight) // 苜蓿 300显示当前加工原料合计重
- {
- int Weight_displayW, i; //显示重量
- clearScreen(2);
- if (inMenu)
- {
- for(i=0; i<8; i++)
- display_Current_v[13+2+i] = WeightConst_feed[i];
- }
- else{
- for(i=0; i<16; i++)
- display_Current_v[13+2+i] = WeightConst_feed[i];
- }
-
- i=35;
- Weight_displayW = weight;
- for(;;) {
- i--;
- if (Weight_displayW>0)
- {
- display_Current_v[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- } else break;
- }
- }
- void display_Current_noweight(void) // 苜蓿 300显示当前加工原料合计重
- {
- display_Current(-1);
- }
- void display_menu(void) // 苜蓿 300显示当前加工原料合计重
- {
- display_Current_noweight();
- }
- void display_Now(void) // 少 30显示当前差异重量
- {
- clearScreen(3);
- if (WeightConst_Product_Run || inMenu)
- {
- cmd_head(display_Process_v, 3);
- for(int i = 0; i < 8; i++)
- display_Process_v[13+14+i] = WeightConst_Weight_display[7-i];
- cmd_end(display_Process_v, 37);
- }
- }
- void display_Next(void) // 请备:羊草 500显示当前合计重
- {
- int Weight_displayW, i; //显示重量
- clearScreen(5);
-
- if(WeightConst_Nextfeed[0]==0xD6 &&
- WeightConst_Nextfeed[1]==0xB4 &&
- WeightConst_Nextfeed[2]==0xD0 &&
- WeightConst_Nextfeed[3]==0xD0
- )
- {
- for(int i=0;i<14;i++)
- display_Next_v[13+2+i] = WeightConst_Nextfeed[i];
- }
- else
- {
- for(int i=0; i<6; i++)
- display_Next_v[13+2+i] = cmd_Next[i];
- for(int i=0; i<10; i++)
- display_Next_v[13+2+6+i] = WeightConst_Nextfeed[i];
- i=35;
- Weight_displayW = abs(WeightConst_NextWeightTarget);
- for(;;) {
- i--;
- if (Weight_displayW>0)
- {
- display_Next_v[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- } else break;
- }
- }
- }
- void display_Total(signed long weight) // 合计: 500显示当前合计重
- {
- signed long Weight_displayW, i; //显示重量
- clearScreen(4);
-
- for(i=0; i<6; i++)
- display_Total_v[13+2+i] = cmd_Sum[i];
- i=35;
- Weight_displayW = abs(WeightConst_WeightCurTem);
- if (Weight_displayW==0)
- {
- i--;
- display_Total_v[i] = 0x30;
- }
- else
- for(;;) {
- if (Weight_displayW>0)
- {
- i--;
- display_Total_v[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- }
- else break;
- }
- if (WeightConst_WeightCurTem<0) display_Total_v[i-1] = 0x2d;
- }
- void display_Stop(void) // 请停止加料
- {
- clearScreen(6);
- for (int i = 0; i < 24; i++)
- display_Stop_v[13+i] = cmd_Stop[i];
- }
- void clearScreenAll(void)
- {
- for(int i=1; i<7; i++)
- clearScreen(i);
- }
- #define CRC16(crc,byte) (((crc) >> 8 ) ^ tabel[((crc) ^ (unsigned int) (byte)) & 0XFF])
- static const unsigned short tabel[256] = {
- 0X0000, 0XC0C1, 0XC181, 0X0140, 0XC301, 0X03C0, 0X0280, 0XC241,
- 0XC601, 0X06C0, 0X0780, 0XC741, 0X0500, 0XC5C1, 0XC481, 0X0440,
- 0XCC01, 0X0CC0, 0X0D80, 0XCD41, 0X0F00, 0XCFC1, 0XCE81, 0X0E40,
- 0X0A00, 0XCAC1, 0XCB81, 0X0B40, 0XC901, 0X09C0, 0X0880, 0XC841,
- 0XD801, 0X18C0, 0X1980, 0XD941, 0X1B00, 0XDBC1, 0XDA81, 0X1A40,
- 0X1E00, 0XDEC1, 0XDF81, 0X1F40, 0XDD01, 0X1DC0, 0X1C80, 0XDC41,
- 0X1400, 0XD4C1, 0XD581, 0X1540, 0XD701, 0X17C0, 0X1680, 0XD641,
- 0XD201, 0X12C0, 0X1380, 0XD341, 0X1100, 0XD1C1, 0XD081, 0X1040,
- 0XF001, 0X30C0, 0X3180, 0XF141, 0X3300, 0XF3C1, 0XF281, 0X3240,
- 0X3600, 0XF6C1, 0XF781, 0X3740, 0XF501, 0X35C0, 0X3480, 0XF441,
- 0X3C00, 0XFCC1, 0XFD81, 0X3D40, 0XFF01, 0X3FC0, 0X3E80, 0XFE41,
- 0XFA01, 0X3AC0, 0X3B80, 0XFB41, 0X3900, 0XF9C1, 0XF881, 0X3840,
- 0X2800, 0XE8C1, 0XE981, 0X2940, 0XEB01, 0X2BC0, 0X2A80, 0XEA41,
- 0XEE01, 0X2EC0, 0X2F80, 0XEF41, 0X2D00, 0XEDC1, 0XEC81, 0X2C40,
- 0XE401, 0X24C0, 0X2580, 0XE541, 0X2700, 0XE7C1, 0XE681, 0X2640,
- 0X2200, 0XE2C1, 0XE381, 0X2340, 0XE101, 0X21C0, 0X2080, 0XE041,
- 0XA001, 0X60C0, 0X6180, 0XA141, 0X6300, 0XA3C1, 0XA281, 0X6240,
- 0X6600, 0XA6C1, 0XA781, 0X6740, 0XA501, 0X65C0, 0X6480, 0XA441,
- 0X6C00, 0XACC1, 0XAD81, 0X6D40, 0XAF01, 0X6FC0, 0X6E80, 0XAE41,
- 0XAA01, 0X6AC0, 0X6B80, 0XAB41, 0X6900, 0XA9C1, 0XA881, 0X6840,
- 0X7800, 0XB8C1, 0XB981, 0X7940, 0XBB01, 0X7BC0, 0X7A80, 0XBA41,
- 0XBE01, 0X7EC0, 0X7F80, 0XBF41, 0X7D00, 0XBDC1, 0XBC81, 0X7C40,
- 0XB401, 0X74C0, 0X7580, 0XB541, 0X7700, 0XB7C1, 0XB681, 0X7640,
- 0X7200, 0XB2C1, 0XB381, 0X7340, 0XB101, 0X71C0, 0X7080, 0XB041,
- 0X5000, 0X90C1, 0X9181, 0X5140, 0X9301, 0X53C0, 0X5280, 0X9241,
- 0X9601, 0X56C0, 0X5780, 0X9741, 0X5500, 0X95C1, 0X9481, 0X5440,
- 0X9C01, 0X5CC0, 0X5D80, 0X9D41, 0X5F00, 0X9FC1, 0X9E81, 0X5E40,
- 0X5A00, 0X9AC1, 0X9B81, 0X5B40, 0X9901, 0X59C0, 0X5880, 0X9841,
- 0X8801, 0X48C0, 0X4980, 0X8941, 0X4B00, 0X8BC1, 0X8A81, 0X4A40,
- 0X4E00, 0X8EC1, 0X8F81, 0X4F40, 0X8D01, 0X4DC0, 0X4C80, 0X8C41,
- 0X4400, 0X84C1, 0X8581, 0X4540, 0X8701, 0X47C0, 0X4680, 0X8641,
- 0X8201, 0X42C0, 0X4380, 0X8341, 0X4100, 0X81C1, 0X8081, 0X4040
- };
- unsigned short CalcCRC(unsigned char *data, unsigned short size)//
- {
- unsigned short i;
- unsigned short crc = 0;
- for (i = 0; i < size; i++) {
- crc = CRC16(crc, data[i]);
- }
- return crc;
- }
- void clearScreenAll_(void)
- {
- unsigned short i;
- unsigned short crc16_;
- Tempdisplay[12] = 0x07; // 数据长度
- Tempdisplay[13] = 0x00; // 数据长度
- Tempdisplay[19] = 0xFF; // 是否清除
- Tempdisplay[20] = 0x00; //区域数
- crc16_ = CalcCRC(Tempdisplay, 21);
- Tempdisplay[21] = crc16_&0xFF;
- Tempdisplay[22] = (crc16_>>8)&0xFF;
- //A5 A5 A5 A5 A5 A5 A5 A5 01 00 00 80 00 00 00 00 00 00 63 02 07 00 A3 06 01 00 00 FF 00 A0 DA 5A
- if (isn>1) Tempdisplay[10]=0x69;
- for (i=0; i<8; i++)
- {
- uart4_send_data[i] = 0xA5;
- }
- for(i=0; i<23; i++)
- uart4_send_data[i+8] = Tempdisplay[i];
- uart4_send_data[i+8] = 0x5A;
- rt_sem_take(uart4_lock, RT_WAITING_FOREVER);
- HAL_UART_Transmit_DMA(&huart4, uart4_send_data, i+9);
- rt_sem_release(uart4_lock);
- rt_thread_mdelay(50);
- }
- void display_New_(unsigned char *data, unsigned int datasize, unsigned char isclear, unsigned char areacount,
- unsigned char areaX, unsigned char areaY, unsigned char areaW, unsigned char areaH,
- unsigned char areaID, unsigned char linesize,unsigned char SingleLine,unsigned char NewLine)
- {
- unsigned short i, j, k;
- unsigned short crc16_;
- Tempdisplay[12] = (datasize + 0x1B + 0x09) & 0xFF; // 数据长度
- Tempdisplay[13] = ((datasize + 0x1B + 0x09)>>8) & 0xFF;; // 数据长度
- Tempdisplay[19] = isclear; // 是否清除
- Tempdisplay[20] = areacount; // 区域数
- Tempdisplay[21] = (datasize + 0x1B) & 0xFF; // 区域长度
- Tempdisplay[22] = ((datasize + 0x1B)>>8) & 0xFF; // 区域长度
- Tempdisplay[24] = areaX; //区域x
- Tempdisplay[25] = 0x80; //区域x
- Tempdisplay[26] = areaY; //区域Y
- Tempdisplay[27] = 0x00; //区域Y
- Tempdisplay[28] = areaW; //区域宽
- Tempdisplay[29] = 0x80; //区域宽
- Tempdisplay[30] = areaH; //区域高
- Tempdisplay[31] = 0x00; //区域高
- Tempdisplay[32] = areaID; //区域编号
- Tempdisplay[33] = linesize; //行间隔
- Tempdisplay[40] = SingleLine; //是否多行
- Tempdisplay[41] = NewLine; //是否换行
- Tempdisplay[46] = (datasize) & 0xFF; //区域数据长度
- Tempdisplay[47] = (datasize>>8) & 0xFF; //区域数据长度
- Tempdisplay[48] = 0x00; //区域数据长度
- Tempdisplay[49] = 0x00; //区域数据长度
- if (isn>1) Tempdisplay[10]=0x69;
- i = 50;
- for (j=0; j<datasize; j++) Tempdisplay[i++] = data[j];
- crc16_ = CalcCRC(Tempdisplay, i);
- Tempdisplay[i++] = crc16_&0xFF;
- Tempdisplay[i++] = (crc16_>>8)&0xFF;
- for(j= 50 + datasize; j>0; j--) {
- if (Tempdisplay[j]==0xA5 || Tempdisplay[j]==0xA6 || Tempdisplay[j]==0x5A || Tempdisplay[j]==0x5B) {
- for(k = i ; k>j; k--) Tempdisplay[k]=Tempdisplay[k-1];
- if (Tempdisplay[j]==0xA5)
- {
- Tempdisplay[j] = 0xA6;
- Tempdisplay[j+1] = 0x02;
- }
- else if (Tempdisplay[j]==0xA6)
- {
- Tempdisplay[j] = 0xA6;
- Tempdisplay[j+1] = 0x01;
- }
- else if (Tempdisplay[j]==0x5A)
- {
- Tempdisplay[j] = 0x5B;
- Tempdisplay[j+1] = 0x02;
- }
- else if (Tempdisplay[j]==0x5B)
- {
- Tempdisplay[j] = 0x5B;
- Tempdisplay[j+1] = 0x01;
- }
- i++;
- }
- }
- for (j=0; j<8; j++) uart4_send_data[j] = 0xA5;
- for(j=0; j<i; j++) uart4_send_data[j+8] = Tempdisplay[j];
- uart4_send_data[j+8] = 0x5A;
- rt_sem_take(uart4_lock, RT_WAITING_FOREVER);
- HAL_UART_Transmit_DMA(&huart4, uart4_send_data, j+9);
- rt_sem_release(uart4_lock);
- }
- void display_KPT_TMRWatch_(void)
- {
- unsigned char KPT_TMRWatch[0x24] = {0x20,0x20,0xBF,0xC6,0xC5,0xC8,0xCC,0xDA,
- 0x54,0x4D,0x52,0x57,0x61,0x74,0x63,0x68,
- 0x20,0x20,0xC8,0xAB,0xBB,0xEC,0xBA,0xCF,
- 0xC8,0xD5,0xC1,0xB8,0xBC,0xE0,0xBF,0xD8,
- 0xCF,0xB5,0xCD,0xB3
- };
- display_New_(KPT_TMRWatch, 0x24,
- 0, // 是否清除
- 1, // 区域数
- 0x1A, //区域x
- 0x1E, //区域Y
- 0x96, //区域宽
- 0x22,//区域高
- 0, //区域编号
- 2, //行间隔
- 2,//是否多行
- 2);//是否换行
- rt_thread_mdelay(50);
- }
- void display_KPT_TMRWatch_weight_()
- {
- signed long Weight_displayW; //显示重量
- unsigned char i;
- // unsigned char KPT_TMRWatch[0x24] = {0x20,0x20,0xBF,0xC6,0xC5,0xC8,0xCC,0xDA,
- // 0x54,0x4D,0x52,0x57,0x61,0x74,0x63,0x68,
- // 0x20,0x20,0xC8,0xAB,0xBB,0xEC,0xBA,0xCF,
- // 0xC8,0xD5,0xC1,0xB8,0xBC,0xE0,0xBF,0xD8,
- // 0xCF,0xB5,0xCD,0xB3
- // };
- unsigned char KPT_TMRWatch[0x36] = {0x20,0x20,0xBF,0xC6,0xC5,0xC8,0xCC,0xDA,
- 0x54,0x4D,0x52,0x57,0x61,0x74,0x63,0x68,
- 0x20,0x20,
- 0xC8,0xAB,0xBB,0xEC,0xBA,0xCF,0xC8,0xD5,
- 0xC1,0xB8,0xBC,0xE0,0xBF,0xD8,0xCF,0xB5,
- 0xCD,0xB3,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20
- };
- i=47;
- Weight_displayW = abs(WeightConst_WeightCurTem);
- if (Weight_displayW==0)
- {
- i--;
- KPT_TMRWatch[i] = 0x30;
- }
- else
- for(;;) {
- if (Weight_displayW>0)
- {
- i--;
- KPT_TMRWatch[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- }
- else break;
- }
- if (WeightConst_WeightCurTem<0) KPT_TMRWatch[40] = 0x2d;
- display_New_(KPT_TMRWatch, 0x36,
- 0, // 是否清除
- 1, // 区域数
- 0x1A, //区域x
- 0x1E, //区域Y
- 0x96, //区域宽
- 0x34,//区域高
- 0, //区域编号
- 2, //行间隔
- 2,//是否多行
- 2);//是否换行
- rt_thread_mdelay(50);
- }
- extern unsigned short WeightConst_Product_Run_time; //开始运行时间
- void display_productName_(unsigned char x) //显示产品名称
- {
- unsigned char i;
- int time_display; //显示时间
- for(i=0; i<30; i++) display_productName_v[i] = 0x20;
- i = 0;
- display_productName_v[i++] = 0x5C;
- display_productName_v[i++] = 0x43;
- display_productName_v[i++] = 0x33;
- if (x == 0) for(i=0; i<14; i++) display_productName_v[i+3] = WeightConst_product[i];
-
- if (WeightConst_Product_Run_time>0){
- i = 22;
- time_display = WeightConst_Product_Run_time/60;
- for(;;) {
- i--;
- if (time_display>0)
- {
- display_productName_v[i] = (time_display)%10 + '0';
- time_display = time_display/10;
- } else break;
- }
- display_productName_v[22]=0x3A;
- time_display = WeightConst_Product_Run_time%60;
- display_productName_v[23] = (time_display)/10 + '0';
- display_productName_v[24] = (time_display)%10 + '0';
- }
- }
- void display_Current_(int weight) // 苜蓿 300显示当前加工原料合计重
- {
- int Weight_displayW; //显示重量
- unsigned char i;
- for(i=0; i<30; i++) display_Current_v[i] = 0x20;
- i = 0;
- display_Current_v[i++] = 0x5C;
- display_Current_v[i++] = 0x43;
- display_Current_v[i++] = 0x31;
- if (WeightConst_feed[8]!= 0)
- for(i=0; i<12; i++) display_Current_v[i+3] = WeightConst_feed[i];
- else
- for(i=0; i<8; i++) display_Current_v[i+3] = WeightConst_feed[i];
- i = 19;
- display_Current_v[i++] = 0x5C;
- display_Current_v[i++] = 0x43;
- display_Current_v[i++] = 0x33;
- i=28;
- Weight_displayW = weight;
- for(;;) {
- i--;
- if (Weight_displayW>0)
- {
- display_Current_v[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- } else break;
- }
- }
- void display_Current_noweight_(void) // 苜蓿 300显示当前加工原料合计重
- {
- unsigned char i;
- for(i=0; i<30; i++) display_Current_v[i] = 0x20;
- i = 0;
- display_Current_v[i++] = 0x5C;
- display_Current_v[i++] = 0x43;
- display_Current_v[i++] = 0x31;
- if (WeightConst_feed[8]!= 0)
- for(i=0; i<12; i++) display_Current_v[i+3] = WeightConst_feed[i];
- else
- for(i=0; i<8; i++) display_Current_v[i+3] = WeightConst_feed[i];
- i = 19;
- display_Current_v[i++] = 0x5C;
- display_Current_v[i++] = 0x43;
- display_Current_v[i++] = 0x33;
- }
- void display_Now_(signed long weight) // 少 30显示当前差异重量
- {
- signed long Weight_displayW; //显示重量
- unsigned char KPT_TMRWatch[160] = {0x5C,0x43,0x33};
- unsigned char i,j;
- //0-24
- //25-52
- //67-77
- //78-102
- //103-127
- display_productName_(0);
- for(i=0; i<25; i++) KPT_TMRWatch[i] = display_productName_v[i];
- for(i=25; i<53; i++) KPT_TMRWatch[i] = display_Current_v[i-25];
- for(i=103; i<128; i++) KPT_TMRWatch[i] = display_Next_v[i-103];
- i=67;
- KPT_TMRWatch[i++] = 0x5C;
- KPT_TMRWatch[i++] = 0x43;
- KPT_TMRWatch[i++] = 0x31;
- for(int j=7; j>=0; j--) {
- if (WeightConst_Product_Run || inMenu)
- KPT_TMRWatch[i++] = WeightConst_Weight_display[j];
- else
- KPT_TMRWatch[i++] =0x20;
- }
- KPT_TMRWatch[i++] = 0x5C;
- KPT_TMRWatch[i++] = 0x43;
- KPT_TMRWatch[i++] = 0x33;
- for(j=0; j<6; j++)
- {
- KPT_TMRWatch[i+j] = cmd_Sum[j];
- }
- i= 103;
- Weight_displayW = abs(WeightConst_WeightCurTem);
- if (Weight_displayW==0)
- {
- i--;
- KPT_TMRWatch[i] = 0x30;
- }
- else
- for(;;) {
- if (Weight_displayW>0)
- {
- i--;
- KPT_TMRWatch[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- }
- else break;
- }
- if (WeightConst_WeightCurTem<0) KPT_TMRWatch[96] = 0x2d;
- if (WeightConst_Run || inMenu==1)
- display_New_(KPT_TMRWatch, 128,
- 0, // 是否清除
- 1, // 区域数
- 0x08, //区域x
- 0x02, //区域Y
- 0xB0, //区域宽
- 0x5C,//区域高
- 0, //区域编号
- 2, //行间隔
- 2,//是否多行
- 2);//是否换行
- }
- void display_Next_(void) // 请备:羊草 500显示当前合计重
- {
- int Weight_displayW; //显示重量
- unsigned char i;
- for(i=0; i<30; i++) display_Next_v[i] = 0x20;
- i = 0;
- display_Next_v[i++] = 0x5C;
- display_Next_v[i++] = 0x43;
- display_Next_v[i++] = 0x32;
- if (!(WeightConst_Nextfeed[0]==0xD6 &&
- WeightConst_Nextfeed[1]==0xB4 &&
- WeightConst_Nextfeed[2]==0xD0 &&
- WeightConst_Nextfeed[3]==0xD0 ))
- {
- if ( WeightConst_Nextfeed[0]!=0x20)
- for(; i<9; i++)
- display_Next_v[i] = cmd_Next[i-3];
- if (WeightConst_Nextfeed[8]!= 0)
- for(; i<21; i++) display_Next_v[i] = WeightConst_Nextfeed[i-9];
- else
- for(; i<17; i++) display_Next_v[i] = WeightConst_Nextfeed[i-9];
- i=25;
- Weight_displayW = WeightConst_NextWeightTarget;
- for(;;) {
- if (Weight_displayW>0)
- {
- i--;
- display_Next_v[i] = (Weight_displayW)%10 + '0';
- Weight_displayW = Weight_displayW/10;
- }
- else break;
- }
- }
- }
|