Uc gui¸­–‡‰‹†Œ

  • View
    2.090

  • Download
    158

Embed Size (px)

Text of Uc gui¸­–‡‰‹†Œ

  • 1. 1 C/GUIC/GUI C/GUI LCD LCD C/GUI LCD CPU LCD LCD C/GUI CPU 100% ANSI C C/GUI / LCD C/GUI 2D RAM C/GUI C C Kernighan Richie C ANSI C C/GUI 1

2. 1 C/GUI 1.1 C/GUI CPU8/16/32/64 RAM ROM LCD RAM100 500 ROM1025KB RAM26KB 1200 ROM3060KBROM CPU ANSI C 16/32/64 CPU DSP 8 C++ C++2 C/GUI 3. 1 C/GUI 1.2 C/GUI C/GUI LCD LCD RTOSC/GUI C LCD CPU 8/16/32 CPU ANSI C LCD LCD LCD LCD LCD / / 4*66*86*98*88*98*168*178*18 24*32 8101316 25 C/GUI 3 4. 1 C/GUI ROM X Y Microsoft Windows / WM WM RAM 20 PC C/GUI PC C/GUI sampleEXE Sample SampleGUIDemoC/GUI 4C/GUI 5. 1 C/GUI 1.3 LCD C C/GUI Mitsubishi M30803 CPU SED13705 LCD LCD320240 LCD1/4VGA LCD TFT www.micrium.com1.4 C/GUIC/GUI API C/GUI C/GUI 2 3 C/GUI 5 6. 1 C/GUI Body -Keyword ParameterAPI Sample New Sample 1.5 C/GUI API X Y X Y (X,Y) X Y X 0,0 X Y X Y API 1.6 LCDC/GUI LCD LCD 20 LCD LCD 6 C/GUI 7. 1 C/GUI LCD LCDMicrium LCD LCDConf.h 22 LCD LCD C/GUILCDLCD LCD RAM LCD LCD LCDSEG LCD/ LCD LCDLCD/ LCD - LCD LCD LCD LCD / LCD LCDLCD LCD LCD LCD 4 8 CPU CPU 20% 100% CPU LCD C/GUI LCD LCD M16C M16C/80CC/GUI 7 8. 1 C/GUI 1.7 C C/GUI I8signed char8 U8unsigned char16 I16 signed short 16 U16 unsigned short 16 I32 signed long32 U32 unsigned long32 I16P signed short 16 U16P unsigned short 16 16/32 LCDConf.h 8C/GUI 9. 2 C/GUI C/GUI 1 10. 2 2.1C/GUI root GUI C/GUI GUI GUI Config GUI/AntiAlias *GUI/ConvertMono B/WGUI/ConvertColor GUI/Core C/GUI GUI/Font GUI/LCDDriverLCD GUI/Mendev *GUI/Touch *GUI/Widget *GUI/WM **2C/GUI 11. 2 Include Include Config GUI/Core GUI/Widget GUI/WM C/GUI2.2 C/GUI CPU 2.3 SampleMakelibMakelib.batMakelib.bat GUI Makelib.bat Prep.bat Makelib.bat Makelib.bat CC.bat lib.bat lib.bat Makelib.bat Makelib.bat Prep.bat CC.bat CC.batC/GUI 3 12. 2 lib.bat Makelib.bat6 lib.bat Makelib.batPrep.bat CC.bat Lib.batGUI C/GUI Prep.batCC.bat lib.bat 2.4 C/GUICC/GUI CLCD GUICoreGUIConvertColor GUIConvertMono C GUIFont C4 C/GUI 13. 2 2.5 C/GUI LCDConf.h LCD C/GUIC/GUI 20 LCD C/GUI LCD LCDConf.h B 01010 1 N LCD S LCD LCD A U8unsigned charU8 F C/GUI 5 14. 2 LCD 2.6 C/GUI GUI_Init() LCD C/GUI C/GUI GUI_Init();2.7 C/GUIC/GUI C/GUI LcdConf.h C/GUIU8U16 LCD LCD LcdConf.h / LCD SamplesLcd_x WebC/GUI 6C/GUI 15. 2 GUI_MAXTASK GUI_OS GUITask.cg 21 C/GUI C/GUI C/GUIC/GUI 2.8 Hello World Hello World C C/GUI Hello World Hello.cC/GUI Basic_HelloWorld.c Hello WorldLCD GUI C/GUI GUI_Init() /*-------------------------------------------------------------------------- BASIC_HelloWorld.c Hello world --------------------------------------------------------------------------*/ #include "GUI.H" /*************************************************************************** * * ***************************************************************************/ void main(void) { /* */ GUI_Init(); GUI_DispString("Hello world!"); while(1);C/GUI 7 16. 2 }Hello WordHello WorldLCD/*-------------------------------------------------------------------------- BASIC_HelloWorld1.c Hello world--------------------------------------------------------------------------*/#include "GUI.H"/**************************************************************************** ****************************************************************************/void main(void){int i=0;/* */GUI_Init();GUI_DispString("Hello world!");while(1){GUI_DispDecAt( i++, 20,20,4);if(i>9999) i=0;}}8C/GUI 17. 3 C/GUIPCWindowsCPC PC E-MailC/GUI 1 18. 3 3.1 C/GUIVisual C++6.0IDEPCLCDLCDLCDXYAPIAPICLCDPCLCDLCD3.2 C/GUIC/GUI C/GUIC/GUIC/GUI2C/GUI 19. 3 Application Exeready-to-use GUI Sample Simulation ToolC/GUIVisual C++ Visual C++Simulation-Trial.dswSimulation-Trial.dspIDE Visual C++ ready-to-goVisual C++6.0 Simulation-Trial.dsw Visual C++ Build/Rebuild All F7C/GUI 3 20. 3 Build/Start Debug/Go F5ExitSampleready-to-goC/GUIC Visual C++Application ApplicationDelete Application SampleApplicationC Build/Rebuild AllF7 Build/Start Debug/Go F54C/GUI 21. 3 3.3 C/GUI PCC:workGSCSim2GUIC/GUIGUIC/GUILCDC/GUI 5 22. 3 Visual C++ Visual C++ Simulation.dsw Simulation.dsp Visual C++ GUIC/GUIGUIC/GUICoreFontLCDDriverC/GUI CApplicationVisual C++ 6 C/GUI 23. 3 Simulation.dsw Visual C++ Build/Rebuild AllF7 Build/Start Debug/GoF5 / Visual C++ 3.4 LCDLCDToolC-GUI-View.exe LCD Visual C++ C/GUI 7 24. 3 LCDViewAlways on top3.5 C/GUILCDDevice.bmpextension.rc145 BITMAP DISCARDABLE "Device.bmp"Win32LCDLCDDevice.bmp LCD8C/GUI 25. 3 0xFF0000SIM_SetTransColorHardkey HardkeyHardkeyHardkeyHardkeyHardkeySIM_HARDKEY_SETmode Hardkey Device1.bmpextension.rc 145 BITMAP DISCARDABLE "Device.bmp" 146 BITMAP DISCARDABLE "Device1.bmp" HardkeyDevice1.bmpHardkeyDevice.bmp Hardkey HardkeyHardkey Device.bmpDevice1.bmpC/GUI 9 26. 3 hardkey Device1.bmp/hardkey3.6 APIAPISIM_X_Init()SIM_X.cSIM_SetLCDPos()*/#include #include #include "SIM.h"void SIM_X_Init(){ SIM_SetLCDPos(0,0); // LCD} SIM_SetLCDPos() LCD SIM_SetTransColor() Hardkey SIM_HARDKEY_GetNum()Hardkey SIM_HARDKEY_GetState()Hardkey01 SIM_HARDKEY_GetCallback() Hardkey SIM_HARDKEY_SetMode() Hardkey0 SIM_HARDKEY_SetState()HardkeySIM_SetLCDPos() 10 C/GUI 27. 3 LCD void SIM_SetLCDPos(int x, int y); x LCD X y LCD Y XY0,0LCDSIM_SetTransColor() Hardkey I32 SIM_SetTransColor(I32 Color); ColorRGB 0xFF0000SIM_HARDKEY_GetNum() HardkeyC/GUI 11 28. 3 int SIM_HARDKEY_GetNum(void);HardkeyHardkeyHardkey HardkeyKeyIndexSIM_HARDKEY_GetState()Hardkeyint SIM_HARDKEY_GetState(unsigned int KeyIndex); KeyIndexHardkey0 12 C/GUI 29. 3 Hardkey 0 1 SIM_HARDKEY_SetCallback() Hardkey SIM_HARDKEY_CB* SIM_HARDKEY_SetCallback ( unsigned int KeyIndex, SIM_HARDKEY_CB* pfCallback); KeyIndexHardkey0 pfCallback typedef void SIM_HARDKEY_CB(int KeyIndex, int State); KeyIndex Hardkey0StateHardkey State 0 C/GUI 13 30. 3 1 SIM_HARDKEY_SetMode()Hardkeyint SIM_HARDKEY_SetMode(unsigned int KeyIndex, int Mode); KeyIndex Hardkey0ModeMode0 1 HardkeyHardkeyHardkeyHardkeySIM_HARDKEY_SetState()Hardkeyint SIM_HARDKEY_SetState(unsigned int KeyIndex, int State); 14 C/GUI 31. 3 KeyIndex Hardkey0 State Hardkey State 0 1 SIM_HARDKEY_SetMode 1C/GUI 15 32. 4 C/GUI C/GUI 1 33. 4 4.1 LCDGUI_DispString()GUI_DispString("Hello world!");Hello world!32ASCIIC/GUI ASCII C 10 LFn X=0 Y += - GUI_GetFontDistY()13 CRrx=0LFGUI_GotoXY()GUI_GotoXY(10,10); // GUI_DispString("Hello world!");// 4.2 API2 C/GUI 34. 4 GUI_DispChar() GUI_DispCharAt() GUI_DispChars() GUI_DispString() GUI_DispStringAt() GUI_DispStringAtCEOL() GUI_DispStringInRect() GUI_DispStringLen() GUI_SetTextMode() GUI_GetTextAlign() GUI_SetLBorder() GUI_ SetTextAlign() GUI_GotoX() X GUI_GotoXY()XY GUI_GotoY() Y GUI_GetDispPosX() X GUI_GetDispPosY() Y GUI_Clear() GUI_DispCEOL() 4.3 GUI_DispChar() C/GUI 3 35. 4 void GUI_DispChar(U16 c); c GUI_DispCharAt()GUI_DispString() A GUI_DispChar(A); GUI_DispChars()GUI_DispCharAt()GUI_DispCharAt() void GUI_DispCharAt(U16 c, I16P x, I16P y); c x X y Y X,Y GUI_DispChar()4 C/GUI 36. 4 A GUI_DispCharAt(A,0,0); GUI_DispChar()GUI_DispChars()GUI_DispChars() void GUI_DispChars(U16 c, int Cnt); c Cnt 0Cnt32767 GUI_DispChar() ****************************** GUI_DispChars(*, 30); GUI_DispChar()GUI_DispCharAt()C/GUI 5 37. 4 GUI_DispString() void GUI_DispString(const char GUI_FAR *s); s n Hello worldNext line GUI_DispString("Hello world");// GUI_DispString("nNext line");// GUI_DispStringAt()GUI_DispStringAtCEOL()GUI_DispStringLen()GUI_DispStringAt() void GUI_DispStringAt(const char GUI_FAR *s, int x, int y); s x X6C/GUI 38. 4 y Y 50,20Position 50,20 GUI_DispStringAt("Position 50,20", 50, 20); // GUI_DispString()GUI_DispStringAtCEOL()GUI_DispStringLen()GUI_DispStringAtCEOL() GUI_DispStringAt()GUI_DispCEOLGUI_DispStringInRect() void GUI_DispStringInRect ( const char GUI_FAR *s, const GUI_RECT *pRect, int Align); s pRectGUI_TA_TOPGUI_TA_BOTTOMGUI_TA_VCENTER AlignGUI_TA_LEFTGUI_TA_RIGHTGUI_TA_HCENTER C/GUI 7 39. 4 Text GUI_RECT rClient; GUI_GetClientRect(&rClient); GUI_DispStringInRect("Text", &rClient, GUI_TA_HCENTER | GUI_TA_VCENTER); GUI_DispString()GUI_DispStringAtCEOL()GUI_DispStringLen()GUI_DispStringLen() void GUI_DispStringLen(const char GUI_FAR *s, int Len); 08 s NULL Len GUI_DispString()GUI_DispStringAt()GUI_DispStringAtCEOL()8 C/GUI 40. 4 4.4 C/GUI GUI_TEXTMODE_NORMAL 0 GUI_TEXTMODE_REVERSE GUI_TEXTMODE_TRANS = - - 1 GUI_TEXTMODE_TRANS |GUI_TEXTMODE_REVERSEC/GUI 9 41. 4 GUI_SetFont(&GUI_Font8x16);GUI_SetFont(&GUI_Font8x16);GUI_SetBkColor(GUI_BLUE);GUI_Clear();GUI_SetPenSize(10);GUI_SetColor(GUI_RED);GUI_DrawLine(80, 10, 240, 90);GUI_DrawLine(80, 90, 240, 10);GUI_SetBkColor(GUI_BLACK);GUI_SetColor(GUI_WHITE);GUI_SetTextMode(GUI_TM_NORMAL);GUI_DispStringHCenterAt("GUI_TM_NORMAL", 160, 10);GUI_SetTextMode(GUI_TM_REV);GUI_DispStringHCenterAt("GUI_TM_REV", 160, 26);GUI_SetTextMode(GUI_TM_TRANS);GUI_DispStringHCenterAt("GUI_TM_TRANS" , 160, 42);GUI_SetTextMode(GUI_TM_XOR);GUI_DispStringHCenterAt("GUI_TM_XOR" , 160, 58);GUI_SetTextMode(GUI_TM_TRANS | GUI_TM_REV);GUI_DispStringHCenterAt("GUI_TM_TRANS | GUI_TM_REV", 160, 74); 10 C/GUI 42. 4 GUI_SetTextMode() int GUI_SetTextMode(int TextMode); TextMode TextModeOR GUI_TEXTMODE_NORMAL 0 GUI_TEXTMODE_REVERSE GUI_TEXTMODE_TRANSPARENT GUI_TEXTMODE_XOR 0,0The value is int i = 20; GUI_DispStringAt("The value is", 0, 0); GUI_SetTextMode(GUI_TEXTMODE_REVERSE); GUI_DispDec(20, 3); GUI_SetTextMode(GUI_TEXTMODE_NORMAL);C/GUI 11 43. 4 4.5 GUI_GetTextAlign()int GUI_GetTextAlign(void);GUI_SetLBorder()void GUI_SetLBorder(int x) x 0GUI_SetTextAlign()int GUI_Se