#include "common.h" #include "lcd_ili9320.h" #include "LCD_FONT_5x7.h" #include "LCD_FONT_7x16.h" #include "LCD_GRAPH.h" #include
typedef struct { vu16 LCD_REG; vu16 LCD_RAM; } LCD_TypeDef; // LCD is connected to the FSMC_Bank1_NOR/SRAM2 and NE2 is used as ship select signal #define LCD_BASE ((u32)(0x60000000|0x04000000)) #define LCD ((LCD_TypeDef *) LCD_BASE) //-------------------------------------------- //变量 //-------------------------------------------- static u8 Xpos=0; //全局坐标 static u16 Ypos=0; static u16 TextColor=LCD_WHITE, BackColor=LCD_BLACK; //全局颜色 static u8 CPU_Load_History[188]; static u16 CPU_Load_Percent_x10; static u8 CPU_Temp_History[188]; static u8 GPU_Load_History[188]; static u8 GPU_Temp_History[188]; static u8 Memory_History[188]; static u8 MainBoard_Temp_History[188]; static u8 Environment_Temp_History[188]; static u8 HDD_Temp_History[188]; static u32 HDD_Read_Byte; static u8 HDD_Read_History[188]; static u32 HDD_Write_Byte; static u8 HDD_Write_History[188]; static u32 Net_Rcv_Byte; static u8 Net_Rcv_History[188]; static u32 Net_Send_Byte; static u8 Net_Send_History[188]; static u8 History_Index=0; static u16 GraphDispBuff[190][50]; //曲线图显存 190x50 像素 //-------------------------------------------- // 函数 //-------------------------------------------- static void Delay(vu32 nCount) { vu32 i,j; for (i=0;i
LCD_REG = LCD_Reg; LCD->LCD_RAM = LCD_RegValue; } void LCD_ILI9320_Init(void) //屏幕初始化 { u32 index = 0; GPIO_SetBits(GPIOB,GPIO_Pin_1); //关闭背光 GPIO_ResetBits(GPIOB,GPIO_Pin_0); //复位 Delay(5); GPIO_SetBits(GPIOB,GPIO_Pin_0); //复位结束 Delay(5); // delay 50 ms // Start Initial Sequence ----- LCD_WriteReg(0xE5,0x8000); // Set the internal vcore voltage LCD_WriteReg(0x00,0x0000); // Start internal OSC. LCD_WriteReg(0x00,0x0001); // Start internal OSC. Delay(5); LCD_WriteReg(0x01,0x0100); // set SS and SM bit LCD_WriteReg(0x02,0x0700); // set 1 line inversion LCD_WriteReg(0x03,0x1018); // set GRAM write direction and BGR=1. LCD_WriteReg(0x04,0x0000); // Resize register LCD_WriteReg(0x08,0x0202); // set the back porch and front porch LCD_WriteReg(0x09,0x0000); // set non-display area refresh cycle ISC[3:0] LCD_WriteReg(0x0A,0x0000); // FMARK function LCD_WriteReg(0x0C,0x0001); // RGB interface setting LCD_WriteReg(0x0D,0x0000); // Frame marker Position LCD_WriteReg(0x0F,0x0000); // RGB interface polarity // Power On sequence --------------------------------------------------------- LCD_WriteReg(0x10,0x16b0); //Power Control 1.(0x16b0) LCD_WriteReg(0x11,0x0037); //Power Control 2.(0x0001) LCD_WriteReg(0x12,0x0138); //Power Control 3.(0x0138) LCD_WriteReg(0x13,0x1800); //Power Control 4. LCD_WriteReg(0x2B, 0x0000); //110510 LCD_WriteReg(0x29,0x0008); // VCM[4:0] for VCOMH Delay(5); // Delay 50 ms //Adjust the Gamma Curve ---------------------------------------------------- LCD_WriteReg(0x30,0x0503); LCD_WriteReg(0x31,0x0103); LCD_WriteReg(0x32,0x0703); LCD_WriteReg(0x35,0x0706); LCD_WriteReg(0x36,0x0B00); LCD_WriteReg(0x37,0x0007); LCD_WriteReg(0x38,0x0707); LCD_WriteReg(0x39,0x0007); LCD_WriteReg(0x3C,0x0600); LCD_WriteReg(0x3D,0x020B); // Set GRAM area --------- LCD_WriteReg(0x50,0x0000); // Horizontal GRAM Start Address LCD_WriteReg(0x51,0x00EF); // Horizontal GRAM End Address EF LCD_WriteReg(0x52,0x0000); // Vertical GRAM Start Address 13F LCD_WriteReg(0x53,0x013F); // Vertical GRAM End Address LCD_WriteReg(0x60,0x2700); // Gate Scan Line LCD_WriteReg(0x61,0x0003); // NDL,VLE, REV 1 LCD_WriteReg(0x6A,0x0000); // set scrolling line // Partial Display Control ------ LCD_WriteReg(0x80, 0x0000); LCD_WriteReg(0x81, 0x0000); LCD_WriteReg(0x82, 0x0000); LCD_WriteReg(0x83, 0x0000); LCD_WriteReg(0x84, 0x0000); LCD_WriteReg(0x85, 0x0000); // Panel Control ----- LCD_WriteReg(0x90, 0x0010); LCD_WriteReg(0x92, 0x0000); LCD_WriteReg(0x93, 0x0003); LCD_WriteReg(0x95, 0x0110); LCD_WriteReg(0x97, 0x0000); LCD_WriteReg(0x98, 0x0000); LCD_WriteReg(0x07, 0x0173); // 262K color and display ON // 清屏. 左下角开始, 方向改变时此处要更改 = LCD_SetXY(0,319); LCD_WriteReg(0x20,0x0000); // GRAM horizontal Address LCD_WriteReg(0x21,0x013F); // GRAM Vertical Address LCD->LCD_REG = 0x0022; //Write Memory Start for(index = 0; index < 76800; index++) //满屏 240x320= 76,800 个像素 { LCD->LCD_RAM = LCD_BLACK; } GPIO_ResetBits(GPIOB,GPIO_Pin_1); //背光 } void LCD_Logo(void) { u8 i,j; LCD_WriteReg(0x20, 0); LCD_WriteReg(0x21, 15); LCD_WriteReg(0x50, 0); LCD_WriteReg(0x51, 139); LCD_WriteReg(0x52, 0); LCD_WriteReg(0x53, 15); LCD->LCD_REG = 0x0022; for(i = 0; i < 140; i++) { for(j = 0; j < 16; j++) { LCD->LCD_RAM = LOGO[i][j]; } } } void LCD_SetXY(u8 uX, u16 uY) //设置坐标 { //---------------------------------------------------- // 设置坐标 原点在左上角 // o------> x,240 // | // | // | // Vy,320 //----------------------------------------------------- if (uX<239) Xpos=uX; if (uY<319) Ypos=uY; } void LCD_SetColor(u16 tc, u16 bc) //设置全局颜色 { TextColor=tc; BackColor=bc; } void LCD_SetRect(u8 XStart, u8 XEnd, u16 YStart, u16 YEnd) { //---------------------------------------------------- // 设置区域 // // Xstart XEnd // YStart o------o // | | // | | // | | // YEnd o------o //----------------------------------------------------- LCD_WriteReg(0x20, XStart); //x Pos LCD_WriteReg(0x21, YEnd); //由于绘图方向设置为 从左下角开始, 所以初始坐标在左下角 LCD_WriteReg(0x50, XStart); // 相对水平方向 GRAM Start Address LCD_WriteReg(0x51, XEnd); // Horizontal GRAM End Address LCD_WriteReg(0x52, YStart); // Vertical GRAM Start Address LCD_WriteReg(0x53, YEnd); // Vertical GRAM End Address } void LCD_ColorBar(void) //显示彩条 { u32 index = 0; u8 i=0; u16 colortable[8]={LCD_RED,LCD_GREEN,LCD_BLUE,LCD_WHITE,LCD_BLACK,LCD_MAGENTA,LCD_BLUE2,LCD_YELLOW}; LCD_SetXY(0,319); LCD->LCD_REG = 0x22; for(i = 0; i < 8; i++) { for(index = 0; index < 3600; index++) { LCD->LCD_RAM = colortable[i]; } } } void LCD_PutChar5x7(char Ascii) //在坐标位置输出一个英文字符 字体 5x7 { u8 index = 0; u8 i=0; u8 tASC = 0; //检查坐标是否超出范围 // if (Xpos>234) return; // if (Ypos>312) return; //设置起始坐标 LCD_WriteReg(0x20, Xpos); //x Pos LCD_WriteReg(0x21, Ypos+7); //Y pos //设置写入区域 LCD_WriteReg(0x50, Xpos); // Horizontal GRAM Start Address LCD_WriteReg(0x51, Xpos+5); // Horizontal GRAM End Address LCD_WriteReg(0x52, Ypos); // Vertical GRAM Start Address LCD_WriteReg(0x53, Ypos+7); // Vertical GRAM End Address LCD->LCD_REG = 0x22; for(index = 0; index < 6; index++) { tASC=FONT_5x7[Ascii][index]; for(i = 0; i < 8; i++) { if((tASC & 0x01) == 0x01) { LCD->LCD_RAM=TextColor; } else { LCD->LCD_RAM=BackColor; } tASC>>=1; } } //坐标增加到下一个字符 Xpos+=6; if (Xpos>234) { Xpos=0; Ypos+=8; if (Ypos>312) Ypos=0; } } void LCD_PutChar6x16(char Ascii) //在坐标位置输出一个英文字符 字体 6x16 { u8 index = 0; u8 i=0; u16 tASC = 0; //检查坐标是否超出范围 // if (Xpos>234) return; // if (Ypos>312) return; //设置起始坐标 LCD_WriteReg(0x20, Xpos); //x LCD_WriteReg(0x21, Ypos+15); //y LCD_WriteReg(0x50, Xpos); // Horizontal GRAM Start Address LCD_WriteReg(0x51, Xpos+6); // Horizontal GRAM End Address LCD_WriteReg(0x52, Ypos); // Vertical GRAM Start Address LCD_WriteReg(0x53, Ypos+15); // Vertical GRAM End Address LCD->LCD_REG = 0x22; for(index = 0; index < 7; index++) { tASC=FONT_7x16[Ascii][index]; for(i = 0; i < 16; i++) { if((tASC & 0x0001) == 0x0001) { LCD->LCD_RAM=TextColor; } else { LCD->LCD_RAM=BackColor; } tASC>>=1; } } //坐标增加到下一个字符 Xpos+=7; if (Xpos>233) { Xpos=0; Ypos+=17; if (Ypos>303) Ypos=0; } } void LCD_PutStr5x7(char *ptr) //在当前位置输出字符串,字符串必须以0结束 { while (*ptr != 0) { switch(*ptr) { case '\n': Xpos=0; Ypos+=8; if (Ypos>312) Ypos=0; break; case '\r': Xpos=0; break; default: LCD_PutChar5x7(*ptr); break; } ptr++; } } void LCD_PutStr6x16(char *ptr) //在当前位置输出字符串,字符串必须以0结束 { while (*ptr != 0) { switch(*ptr) { case '\n': Xpos=0; Ypos+=17; if (Ypos>303) Ypos=0; break; case '\r': Xpos=0; break; default: LCD_PutChar6x16(*ptr); break; } ptr++; } } void LCD_ClearToLineEnd(u8 ucLines) { u16 i,j=(240-Xpos)*ucLines; LCD_WriteReg(0x20, Xpos); LCD_WriteReg(0x21, Ypos+ucLines-1); LCD_WriteReg(0x50, Xpos); // Horizontal GRAM Start Address LCD_WriteReg(0x51, 239); // Horizontal GRAM End Address LCD_WriteReg(0x52, Ypos); // Vertical GRAM Start Address LCD_WriteReg(0x53, Ypos+ucLines-1); // Vertical GRAM End Address LCD->LCD_REG = 0x22; for(i = 0; i < j; i++) { LCD->LCD_RAM=LCD_BLACK; } } static u16 BytesToWord(u8* Ds) //连接u8的数据为 u16 { u16 Dat; Dat=(*Ds<<8)|(*(Ds+1)); return Dat; } static u32 BytesToInt(u8* Ds) //连接u8的数据为 u32 { u32 Dat; Dat=(*Ds<<24)|(*(Ds+1)<<16)|(*(Ds+2)<<8)|(*(Ds+3)); return Dat; } void LCD_InsertData(u8* pBuff) //更新图表历史数据,同时转换到与图表适应的比例.每次都要检查是否超过范围, 以防绘图时数组越界. { // 串口数据定义 //---------------------------------------------------------------------------------------------------- // 0 1 2 3 4 5 6,7 8,9 10,11 12,13 14,15 16,17 18 19 // 'W' 'O' 'W' 'H' 'M' 1 2 3 4 5 // [ SIG ] [Version] [ID] [ Voltages [5] mV ] [Environment Temp] [MainBoard Temp] //---------------------------------------------------------------------------------------------------- Environment_Temp_History[History_Index]=(*(pBuff+18))-20; if (Environment_Temp_History[History_Index]>49) Environment_Temp_History[History_Index]=49; //限定最大值,防至绘图时数组越界 MainBoard_Temp_History[History_Index]=(*(pBuff+19))-20; if (MainBoard_Temp_History[History_Index]>49) MainBoard_Temp_History[History_Index]=49; //---------------------------------------------------------------------------------------------------- // 20 21 22 23 24 25,26 27,28 29,30 31,32 33,34 35 36 37 38 39 40,41 // T 0 1 2 3 Total Core0 Core1 Core2 Core3 // [CPU Temp [5]] [ CPU Load %[5] ] [Mem Avail %] [MemAvailMB] [Reserve] [MainBoard Bus Speed] //---------------------------------------------------------------------------------------------------- CPU_Temp_History[History_Index]=(*(pBuff+20))-20; CPU_Load_Percent_x10=BytesToWord(pBuff+25); CPU_Load_History[History_Index]=(CPU_Load_Percent_x10/10)>>1; //Buff[25,26] 是CPU使用率x10, 范围 0-1000; //图像显示范围 0-50 所以除以2 即右移一位 Memory_History[History_Index]=(*(pBuff+35))>>1; //内存使用率 //---------------------------------------------------------------------------------------------------- // 42,43 44,45 46,47 48,49 50,51 52 53 54,55 56,57 58,59 60,61 // Total 0 1 2 3 // [ CPU Frq ] [GPU Temp] [GPU Load %] [GPU CoreVol] [GPU CoreFrq] [GPU Mem Frq] [GPU Fan] //---------------------------------------------------------------------------------------------------- GPU_Temp_History[History_Index]=(*(pBuff+52))-20; if (GPU_Temp_History[History_Index]>49) GPU_Temp_History[History_Index]=49; GPU_Load_History[History_Index]=(*(pBuff+53))>>1; //---------------------------------------------------------------------------------------------------- // 62 63 64 65,66 67,68 69,70 71,72 73,74 75,76 77,78,79,80 81,82,83,84 // 0 1 2 // [Disk Temp] [ FanSpeed ] [Processes] [Threads] [Reserve] [DiskReadByte] [DiskWriteByte] //---------------------------------------------------------------------------------------------------- HDD_Temp_History[History_Index]=(*(pBuff+62))-20; if (HDD_Temp_History[History_Index]>49) HDD_Temp_History[History_Index]=49; HDD_Read_Byte=BytesToInt(pBuff+77); HDD_Read_History[History_Index]= HDD_Read_Byte>>20; //数据缩小 16,384倍 最大量程 800KB if (HDD_Read_History[History_Index]>49) HDD_Read_History[History_Index]=49; HDD_Write_Byte=BytesToInt(pBuff+81); HDD_Write_History[History_Index]= HDD_Write_Byte>>20; //数据缩小 16,384倍 最大量程 800KB if (HDD_Write_History[History_Index]>49) HDD_Write_History[History_Index]=49; //---------------------------------------------------------------------------------------------------- // 85,86,87,88 89,90,91,92 93,94,95,96 97 98 99 100 101 102-- 125 126 127 // M D H M S 0xFF // [NetReceivedByte] [NetSentByte] [ Up Time ] [ Date Time ] [Reverse] [CheckSum] //---------------------------------------------------------------------------------------------------- Net_Rcv_Byte=BytesToInt(pBuff+85); Net_Rcv_History[History_Index]= Net_Rcv_Byte>>14; //数据缩小 16,384倍 最大量程 800KB if (Net_Rcv_History[History_Index]>49) Net_Rcv_History[History_Index]=49; Net_Send_Byte=BytesToInt(pBuff+89); Net_Send_History[History_Index]= Net_Send_Byte>>14; if (Net_Send_History[History_Index]>49) Net_Send_History[History_Index]=49; //---------------------------------------------------------------------------------------------------- History_Index++; //历史缓存索引增加, if (History_Index>187) History_Index=0; //超出历史缓存最大值, 则重定位到 开头 0 } static void LCD_GrapgInit(void) //初始化图表背景 { u8 i,j; for (i=1;i<189;i++) for (j=1;j<49;j++) GraphDispBuff[i][j]=LCD_GRAPH_BG; //背景蓝色 for (i=0;i<190;i++) { GraphDispBuff[i][0]=LCD_GRAPH_GIRD; //水平线条 GraphDispBuff[i][12]=LCD_GRAPH_GIRD; GraphDispBuff[i][24]=LCD_GRAPH_GIRD; GraphDispBuff[i][37]=LCD_GRAPH_GIRD; GraphDispBuff[i][49]=LCD_GRAPH_GIRD; } for (i=0;i<50;i++) { GraphDispBuff[0][i]=LCD_GRAPH_GIRD; //垂直线条 GraphDispBuff[9][i]=LCD_GRAPH_GIRD; GraphDispBuff[29][i]=LCD_GRAPH_GIRD; GraphDispBuff[49][i]=LCD_GRAPH_GIRD; GraphDispBuff[69][i]=LCD_GRAPH_GIRD; GraphDispBuff[89][i]=LCD_GRAPH_GIRD; GraphDispBuff[109][i]=LCD_GRAPH_GIRD; GraphDispBuff[129][i]=LCD_GRAPH_GIRD; GraphDispBuff[149][i]=LCD_GRAPH_GIRD; GraphDispBuff[169][i]=LCD_GRAPH_GIRD; GraphDispBuff[189][i]=LCD_GRAPH_GIRD; } } void LCD_UpdateGraph1(void) //图表1 CPU 温度和使用率 { u8 i,j,k, History_Index2=History_Index; //不影响全局索引, 需要单独定义索引 LCD_GrapgInit(); for (i=1;i<189;i++) //绘图区为 1-198 两边各留1像素的边框 { k=CPU_Load_History[History_Index2]; for (j=1;j<49;j++) { if (k>j) { GraphDispBuff[i][j]=LCD_GREEN; //CPU 使用率柱状图 绿色 } } GraphDispBuff[i][Memory_History[History_Index2]]=LCD_YELLOW; //内存使用率 GraphDispBuff[i][CPU_Temp_History[History_Index2]]=LCD_RED; //CPU 温度 //温度变化不大, 只需打点, 无需连线 History_Index2++; if (History_Index2>187) History_Index2=0; } } void LCD_UpdateGraph2(void) //温度 { u8 i, History_Index2=History_Index; LCD_GrapgInit(); for (i=1;i<189;i++) { GraphDispBuff[i][Environment_Temp_History[History_Index2]]=LCD_RED; //机箱温度 红色 GraphDispBuff[i][MainBoard_Temp_History[History_Index2]]=LCD_GREEN; //主板温度 绿色 GraphDispBuff[i][HDD_Temp_History[History_Index2]]=LCD_YELLOW; //硬盘温度 黄色 GraphDispBuff[i][GPU_Temp_History[History_Index2]]=LCD_MAGENTA; //GPU温度 History_Index2++; if (History_Index2>187) History_Index2=0; } } void LCD_UpdateGraph3(void) //网络流量 { u8 i,j,tR,tS, History_Index2=History_Index; u16 tColor; LCD_GrapgInit(); for (i=1;i<189;i++) { tR=Net_Rcv_History[History_Index2]; tS=Net_Send_History[History_Index2]; for (j=1;j<49;j++) { tColor=LCD_BLACK; if (tS>j) tColor|=LCD_RED; if (tR>j) tColor|=LCD_GREEN; if (tColor) GraphDispBuff[i][j]=tColor; } History_Index2++; if (History_Index2>187) History_Index2=0; } } void LCD_UpdateGraph4(void) //硬盘读写速度 { u8 i,j,tR,tW, History_Index2=History_Index; u16 tColor; LCD_GrapgInit(); for (i=1;i<189;i++) { tR=HDD_Read_History[History_Index2]; tW=HDD_Write_History[History_Index2]; for (j=1;j<49;j++) { tColor=LCD_BLACK; if (tW>j) tColor|=LCD_RED; if (tR>j) tColor|=LCD_GREEN; if (tColor) GraphDispBuff[i][j]=tColor; } History_Index2++; if (History_Index2>187) History_Index2=0; } } void LCD_ShowGraph(u8 Xpos, u16 Ypos) //将"显存"数据刷新到屏幕 { u8 i,j; //----------------------------- // Xpos Xpos+199 // Ypos o------o // | | // | | // | | //Ypos+49 o------o //----------------------------- LCD_WriteReg(0x20, Xpos); //x Pos LCD_WriteReg(0x21, Ypos+49); LCD_WriteReg(0x50, Xpos); // 相对水平方向 GRAM Start Address LCD_WriteReg(0x51, Xpos+199); // Horizontal GRAM End Address LCD_WriteReg(0x52, Ypos); // Vertical GRAM Start Address LCD_WriteReg(0x53, Ypos+49); // Vertical GRAM End Address LCD->LCD_REG = 0x22; // [49] [49] ... [49] // ... ... ... ... // [2] [2] ... [2] // [1] [1] ... [1] // [0] [0] ... [0] // ---- ---- ---- ----- // [0] [1] ... [199] for(i = 0; i < 190; i++) { for(j = 0; j < 50; j++) { LCD->LCD_RAM= GraphDispBuff[i][j]; } } } void LCD_ShowPackageCount(u32 uErr, u32 uTotal) { char strTemp[30]; u16 i,j=240*9; LCD_WriteReg(0x20, 0); LCD_WriteReg(0x21, 319); LCD_WriteReg(0x50, 0); // 相对水平方向 GRAM Start Address LCD_WriteReg(0x51, 239); // Horizontal GRAM End Address LCD_WriteReg(0x52, 311); // Vertical GRAM Start Address LCD_WriteReg(0x53, 319); // Vertical GRAM End Address LCD->LCD_REG = 0x22; for(i = 0; i < j; i++) { LCD->LCD_RAM=LCD_BLUE; } LCD_SetXY(STATUS_BAR_X,STATUS_BAR_Y); LCD_SetColor(LCD_YELLOW,LCD_BLUE); sprintf(strTemp,"[PACKAGE] ERROR:%d, TOTAL:%d",uErr,uTotal); LCD_PutStr5x7(strTemp); } void LCD_UpdateScreen(u8* pBuff) { char strTemp[10]; //--------------------------------------- //显示CPU温度 [20] LCD_SetColor(LCD_RED,LCD_BLACK); LCD_SetXY(CPU_TEMP_T_X,CPU_TEMP_T_Y); LCD_PutStr5x7("CPU"); LCD_SetXY(CPU_TEMP_X,CPU_TEMP_Y); sprintf(strTemp,"%2d\x1F",*(pBuff+20)); LCD_PutStr6x16(strTemp); //显示CPU使用率 CPU_Load_Percent_x10 LCD_SetColor(LCD_GREEN,LCD_BLACK); LCD_SetXY(CPU_USAGE_T_X,CPU_USAGE_T_Y); LCD_PutStr5x7("USAGE"); LCD_SetXY(CPU_USAGE_X,CPU_USAGE_Y); LCD_ClearToLineEnd(16); sprintf(strTemp,"%.01f%%",(float)CPU_Load_Percent_x10/10); LCD_PutStr6x16(strTemp); //内存剩余 [36,37] LCD_SetColor(LCD_YELLOW,LCD_BLACK); LCD_SetXY(MEM_MB_X,MEM_MB_Y); sprintf(strTemp,"%4dM",BytesToWord(pBuff+36)); LCD_PutStr5x7(strTemp); //显示内存使用率 [35] LCD_SetXY(MEM_USAGE_X,MEM_USAGE_Y); sprintf(strTemp,"%2d%%",*(pBuff+35)); LCD_PutStr6x16(strTemp); //显示机箱温度 [18] LCD_SetColor(LCD_RED,LCD_BLACK); LCD_SetXY(E_TEMP_T_X,E_TEMP_T_Y); LCD_PutStr5x7("ET"); LCD_SetXY(E_TEMP_X,E_TEMP_Y); sprintf(strTemp,"%2d\x1F",*(pBuff+18)); LCD_PutStr6x16(strTemp); //显示主板温度 [19] LCD_SetColor(LCD_GREEN,LCD_BLACK); LCD_SetXY(MB_TEMP_T_X,MB_TEMP_T_Y); LCD_PutStr5x7("MBT"); LCD_SetXY(MB_TEMP_X,MB_TEMP_Y); sprintf(strTemp,"%2d\x1F",*(pBuff+19)); LCD_PutStr6x16(strTemp); //显示HDD温度 [62] LCD_SetColor(LCD_YELLOW,LCD_BLACK); LCD_SetXY(HDD_TEMP_T_X,HDD_TEMP_T_Y); LCD_PutStr5x7("HDD"); LCD_SetXY(HDD_TEMP_X,HDD_TEMP_Y); sprintf(strTemp,"%2d\x1F",*(pBuff+62)); LCD_PutStr6x16(strTemp); //显示GPU温度 [52] LCD_SetColor(LCD_MAGENTA,LCD_BLACK); LCD_SetXY(GPU_TEMP_T_X,GPU_TEMP_T_Y); LCD_PutStr5x7("GPU"); LCD_SetXY(GPU_TEMP_X,GPU_TEMP_Y); sprintf(strTemp,"%2d\x1F",*(pBuff+52)); LCD_PutStr6x16(strTemp); //显示上传速率 Net_Send_Byte LCD_SetColor(LCD_RED,LCD_BLACK); LCD_SetXY(NET_UP_T_X,NET_UP_T_Y); LCD_PutStr5x7("NET UP"); LCD_SetXY(NET_UP_X,NET_UP_Y); LCD_ClearToLineEnd(16); sprintf(strTemp,"%3.02f\x1E",(float)Net_Send_Byte/1024); LCD_PutStr6x16(strTemp); //显示下载速率 Net_Rcv_Byte LCD_SetColor(LCD_GREEN,LCD_BLACK); LCD_SetXY(NET_DL_T_X,NET_DL_T_Y); LCD_PutStr5x7("NET DL"); LCD_SetXY(NET_DL_X,NET_DL_Y); LCD_ClearToLineEnd(16); sprintf(strTemp,"%3.02f\x1E",(float)Net_Rcv_Byte/1024); LCD_PutStr6x16(strTemp); //显示写入速度 HDD_Write_Byte LCD_SetColor(LCD_RED,LCD_BLACK); LCD_SetXY(HDD_WR_T_X,HDD_WR_T_Y); LCD_PutStr5x7("HDD WRTE"); LCD_SetXY(HDD_WR_X,HDD_WR_Y); LCD_ClearToLineEnd(16); sprintf(strTemp,"%3.02f\x1D",(float)HDD_Write_Byte/1048576); LCD_PutStr6x16(strTemp); //显示读取速度 HDD_Read_Byte LCD_SetColor(LCD_GREEN,LCD_BLACK); LCD_SetXY(HDD_RD_T_X,HDD_RD_T_Y); LCD_PutStr5x7("HDD READ"); LCD_SetXY(HDD_RD_X,HDD_RD_Y); LCD_ClearToLineEnd(16); sprintf(strTemp,"%3.02f\x1D",(float)HDD_Read_Byte/1048576); LCD_PutStr6x16(strTemp); //--------------------------------------------------- LCD_UpdateGraph1(); //CPU温度/使用率 LCD_ShowGraph(GRAPH_1_X,GRAPH_1_Y); LCD_UpdateGraph2(); //温度 LCD_ShowGraph(GPAPH_2_X,GRAPH_2_Y); LCD_UpdateGraph3(); //网络流量 LCD_ShowGraph(GRAPH_3_X,GRAPH_3_Y); LCD_UpdateGraph4(); //硬盘读写 LCD_ShowGraph(GRAPH_4_X,GRAPH_4_Y); //---------------------------------------------------- //当前时间 LCD_SetColor(LCD_WHITE,LCD_BLACK); LCD_SetXY(TIME_X,TIME_Y); sprintf(strTemp,"%2d-%2d %2d:%02d:%02d",*(pBuff+97),*(pBuff+98),*(pBuff+99),*(pBuff+100),*(pBuff+101)); LCD_PutStr6x16(strTemp); //系统启动时间 LCD_SetColor(LCD_WHITE,LCD_BLACK); LCD_SetXY(SYS_UP_TIME_T_X,SYS_UP_TIME_T_Y); LCD_PutStr5x7(" SYS UP TIME"); LCD_SetXY(SYS_UP_TIME_X,SYS_UP_TIME_Y); sprintf(strTemp,"%2d\x19%02d:%02d:%02d",*(pBuff+93),*(pBuff+94),*(pBuff+95),*(pBuff+96)); LCD_PutStr6x16(strTemp); //VCC3V [8,9] LCD_SetColor(0xE2C2,LCD_BLACK); LCD_SetXY(VCC3V_T_X,VCC3V_T_Y); LCD_PutStr5x7("VCC3V"); LCD_SetXY(VCC3V_X,VCC3V_Y); sprintf(strTemp,"%.02f\x18",(float)BytesToWord(pBuff+8)/1000); LCD_PutStr6x16(strTemp); //CPU VCORE [10,11] LCD_SetColor(0x5C18,LCD_BLACK); LCD_SetXY(VCPU_T_X,VCPU_T_Y); LCD_PutStr5x7("VCPU"); LCD_SetXY(VCPU_X,VCPU_Y); sprintf(strTemp,"%.02f\x18",(float)BytesToWord(pBuff+10)/1000); LCD_PutStr6x16(strTemp); //CPU VCORE [12,13] LCD_SetColor(0x9647,LCD_BLACK); LCD_SetXY(VSB3V_T_X,VSB3V_T_Y); LCD_PutStr5x7("VSB3V"); LCD_SetXY(VSB3V_X,VSB3V_Y); sprintf(strTemp,"%.02f\x18",(float)BytesToWord(pBuff+12)/1000); LCD_PutStr6x16(strTemp); //CPU VCORE [14,15] LCD_SetColor(0x94BF,LCD_BLACK); LCD_SetXY(VBAT_T_X,VBAT_T_Y); LCD_PutStr5x7("VBAT"); LCD_SetXY(VBAT_X,VBAT_Y); sprintf(strTemp,"%.02f\x18",(float)BytesToWord(pBuff+14)/1000); LCD_PutStr6x16(strTemp); }