各位朋友:
您们好!现在正在使用emwin创建一个显示界面,想通过TEXT控件动态显示系统AD的采集值。以下为测试时使用的部分程序:
//界面显示的控件
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_BUTTON_0 (GUI_ID_USER + 0x01)
#define ID_BUTTON_1 (GUI_ID_USER + 0x02)
#define ID_BUTTON_2 (GUI_ID_USER + 0x03)
#define ID_BUTTON_3 (GUI_ID_USER + 0x04)
#define ID_BUTTON_4 (GUI_ID_USER + 0x05)
#define ID_TEXT_0 (GUI_ID_USER + 0x06)
#define ID_TEXT_1 (GUI_ID_USER + 0x07)
#define ID_TEXT_2 (GUI_ID_USER + 0x08)
#define ID_TEXT_3 (GUI_ID_USER + 0x09)
#define ID_TEXT_4 (GUI_ID_USER + 0x0A)
#define ID_TEXT_5 (GUI_ID_USER + 0x0B)
#define ID_TEXT_6 (GUI_ID_USER + 0x11)//用于显示ADC的值
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "master", ID_WINDOW_0, 0, 1, 320, 240, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Data set", ID_BUTTON_0, 229, 10, 90, 36, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Fault query", ID_BUTTON_1, 230, 56, 90, 36, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Timer set", ID_BUTTON_2, 230, 102, 90, 36, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Passsword", ID_BUTTON_3, 230, 148, 90, 36, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Return", ID_BUTTON_4, 230, 194, 90, 36, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Parameter display", ID_TEXT_0, 78, 0, 116, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Voltage", ID_TEXT_1, 49, 30, 80, 29, 0, 0x64, 0 },
{ TEXT_CreateIndirect, "Current", ID_TEXT_2, 134, 30, 80, 29, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Phase A:", ID_TEXT_3, 5, 62, 53, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Phase B:", ID_TEXT_4, 5, 93, 53, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Phase C:", ID_TEXT_5, 5, 123, 53, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text", ID_TEXT_6, 68, 67, 43, 20, 0, 0x64, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
//主程序
void MainTask(void) {
char pValue=10;//系统运行时应该显示的变量
GUI_Init();
WM_HWIN hWin;
hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
while (1)
{
TEXT_SetText(WM_GetDialogItem(hWin, ID_TEXT_6), pValue);
GUI_Delay(100);
}
}
红色部分是为了做测试,这里设定一个参数。编译后,程序运行正常的话,会在 ID_TEXT_6指向
的文本控件显示10,但下载后没有任何显示。
由于是刚刚学习,所以请知道的朋友不吝赐教,多谢!
|