大学生
最后登录1970-1-1
在线时间 小时
注册时间2015-3-15
|
void OnICON5Clicked(void)
{
WM_HWIN hWin;
WM_HWIN hGraph;
GRAPH_SCALE_Handle hScaleVert,hScaleH;
uint8_t i=0;
char pValue[25]={0};
OS_DEBUG("ADCapp create\n");
hWin=GUI_CreateDialogBox(_aDialogCreateADC, GUI_COUNTOF(_aDialogCreateADC), _cbDialogADC, WM_HBKWIN, 0, 0);
hGraph = GRAPH_CreateEx (0, 55, 795,420, WM_GetClientWindow(hWin), WM_CF_SHOW|WM_CF_MEMDEV , 0, GUI_ID_GRAPH0);
hData = GRAPH_DATA_YT_Create(GUI_RED,
1000,
0,
0);
hScaleVert = GRAPH_SCALE_Create(40,
GUI_TA_RIGHT,
GRAPH_SCALE_CF_VERTICAL,
100);
hScaleH = GRAPH_SCALE_Create(360, GUI_TA_HCENTER, GRAPH_SCALE_CF_HORIZONTAL, 100);
GRAPH_SCALE_SetTextColor(hScaleH, GUI_YELLOW);
GRAPH_SCALE_SetFont(hScaleH,GUI_FONT_20B_ASCII);
GRAPH_SCALE_SetFont(hScaleVert,GUI_FONT_20B_ASCII);
WIDGET_SetEffect(hGraph, &WIDGET_Effect_Simple);
GRAPH_SetBorder (hGraph,
0,
0,
0,
0);
GRAPH_SetUserDraw(hGraph, _UserDraw);
GRAPH_SetGridDistY(hGraph, 50);
GRAPH_SetGridVis(hGraph, 1);
GRAPH_SetGridFixedX(hGraph, 1);
GRAPH_DATA_YT_SetAlign(hData, GRAPH_ALIGN_RIGHT);
GRAPH_SCALE_SetFactor (hScaleVert, 0.01f);这个0.01f是怎么得到的,我看了emwin指导手册还是无法理解,求火哥指导一下。
GRAPH_SCALE_SetOff(hScaleVert,50);
GRAPH_SCALE_SetTextColor(hScaleVert, GUI_YELLOW);
GRAPH_AttachData (hGraph, hData);
GRAPH_AttachScale(hGraph, hScaleVert);
GRAPH_AttachScale(hGraph, hScaleH);
while(OnICON5)
{
i++;
if(i>=50)
{
data=(float)ADC_ConvertedValue;
//printf("\r\n1 The current AD value = %f \r\n", data);
data=data*3.3/4096;
//printf("\r\nThe current AD value = 0x%04X -> %f\r\n", ADC_ConvertedValue,data);
sprintf(pValue,"0x%04X --> %fV",ADC_ConvertedValue,data);
pValue[24]='\0';
TEXT_SetText(WM_GetDialogItem(hWin, GUI_ID_TEXT0), pValue);
GRAPH_DATA_YT_AddValue(hData,data*100+50);
i=0;
}
GUI_Delay(10);
}
}
|
|