Nuvoton NuMicro emWin M480 Series Quick Start Manual

Nuvoton NuMicro emWin M480 Series Quick Start Manual

Hide thumbs Also See for NuMicro emWin M480 Series:

Advertisement

Document Information
Abstract
Introduce the steps to build and launch emWin for the M480 series
microcontroller (MCU).
Apply to
NuMicro
The information described in this document is the exclusive intellectual property of
Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton.
Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based system design.
For additional information or questions, please contact: Nuvoton Technology Corporation.
Oct. 04, 2018
M480 emWin Quick Start Guide
®
M480 series
Nuvoton assumes no responsibility for errors or omissions.
All data and specifications are subject to change without notice.
www.nuvoton.com
Page 1 of 18
M480 emWin
Rev 1.00

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the NuMicro emWin M480 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for Nuvoton NuMicro emWin M480 Series

  • Page 1 The information described in this document is the exclusive intellectual property of Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton. Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based system design. Nuvoton assumes no responsibility for errors or omissions.
  • Page 2: Table Of Contents

    M480 emWin Table of Contents INTRODUCTION ........................3 EMWIN BSP DIRECTORY STRUCTURE ............... 4 2.1 Sample Codes (sampleCode) ....................4 2.2 Configuration Files (ThirdParty\emWin\Config) ..............4 2.3 Documents (ThirdParty\emWin\Doc) ..................4 2.4 Include Files (ThirdParty\emWin\Include) ................4 2.5 Library (ThirdParty\emWin\Lib) ....................4 2.6 Tools (ThirdParty\emWin\Tool) ....................
  • Page 3: Introduction

    GUI for any application that operates with a graphical display. Nuvoton provides emWin GUI library for free with the M480 series microcontroller (MCU) supporting up to 320x240 (16 bpp) resolution. The emWin platform can be implemented on HMI for industrial, machines, appliances, etc.
  • Page 4: Emwin Bsp Directory Structure

    M480 emWin 2 emWin BSP Directory Structure This chapter introduces emWin related files and directories in the M480 BSP. 2.1 Sample Codes (sampleCode) emWin_GUIDemo Utilize emWin library to demonstrate widgets feature. emWin_SimpleDemo Utilize emWin library to demonstrate interactive feature. 2.2 Configuration Files (ThirdParty\emWin\Config) GUI_X.c Configuration and system dependent code for GUI.
  • Page 5: Tools (Thirdparty\Emwin\Tool)

    M480 emWin 2.6 Tools (ThirdParty\emWin\Tool) BmpCvtNuvoton.exe The Bitmap Converter is designed for converting common image file formats like BMP, PNG or GIF into the desired emWin bitmap format. emWinPlayer.exe This tool can show the previously created emWin Movie File (EMF) on a Computer with a Windows operating system.
  • Page 6: Emwin Sample Code

    M480 emWin 3 emWin Sample Code There are two emWin sample code in the M480 BSP SampleCode directory:  emWin_GUIDemo: utilizes the emWin library to demonstrate widgets feature;  emWin_SimpleDemo: utilizes the emWin library to demonstrate interactive feature. 3.1 Project Structure The following uses emWin_SimpleDemo as a sample to explain the emWin project structure in BSP.
  • Page 7: System Initialization

    M480 emWin The project structure is shown in the following figure. The project contains two targets:  emWin_SimpleDemo: stores touch screen calibration parameters in APROM;  emWin_SimpleDemo_SD: stores touch screen calibration parameters in a SD card. The Libraries group contains low level driver and system startup code. The emWin group ®...
  • Page 8: Emwin Initialization

    M480 emWin // Init System, IP clock and multi-function I/O _SYS_Init(); // Init UART to 115200-8n1 for print message UART_Open(UART0, 115200); // Enable Timer0 clock and select Timer0 clock source CLK_EnableModuleClock(TMR0_MODULE); CLK_SetModuleClock(TMR0_MODULE, CLK_CLKSEL1_TMR0SEL_HXT, 0); // Initial Timer0 to periodic mode with 1000Hz TIMER_Open(TIMER0, TIMER_PERIODIC_MODE, 1000);...
  • Page 9: Build Emwin Project

    M480 emWin printf("Main Task -> \n"); GUI_Init(); strcat(acVersion, GUI_GetVersionString()); hWin = CreateFramewin(); FRAMEWIN_SetText(hWin, acVersion); while (1) GUI_Delay(500); 3.4 Build emWin Project To build the emWin project in Keil MDK, click the rebuild icon as shown below or press F7 function key. 3.5 Download and Run Press Ctrl + F5 to download the application and start a debug session or click start/stop debug session icon as shown below.
  • Page 10: Touch Screen

    M480 emWin The following figure shows the application halts in main() function after starting a debug session. 3.6 Touch Screen To support resistive touch screen, use ADC to convert the voltage of X axis and Y axis, and then use the open source tslib to map the ADC conversion result into the coordination. The conversion result can be affected by power noise, mechanical misalignment, etc.
  • Page 11 M480 emWin In the emWin_SimpleDemo_SD, a preprocessor symbol __USE_SD__ is defined to build the sample and use a SD card to store the calibration parameter as shown below. The touch resolution and the APROM offset store calibration parameters in the M48XTouchPanel.h.
  • Page 12 M480 emWin ts_readfile(); /* Disable FMC ISP function */ FMC_Close(); /* Lock protected registers */ SYS_LockReg(); If a SD card is used to store calibration parameters, main function will load the parameter file ts_calib from the SD card root directory. If the parameter doesn’t exist, main function will call ts_calibrate() to generate a copy.
  • Page 13: Emwin Guibuilder

    M480 emWin 4 emWin GUIBuilder 4.1 Create Widget Segger provides a Windows tool GUIBuilder to create application with drag and drop interface. The tool is located under the ThirdParty\emWin\Tool\ directory. This tool can generate a file named FramewinDLG.c for the widget of target application. Please refer to chapter 20 of UM03001_emWin5.pdf for the usage of GUIBuilder.
  • Page 14 M480 emWin sprintf(sBuf,"%d ", value); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, sBuf); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) case ID_BUTTON_0: // Notifications sent by '+ 1' switch(NCode) case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message)
  • Page 15: Change Display Panel

    M480 emWin 5 Change Display Panel 5.1 emWin Display Configuration emWin declares display panel resolution LCDConf.c under ThirdParty\emWin\Config\ directory. The resolution is different from the touch panel resolution defined in the M48XTouchPanel.h. This is because the panel is a portrait display and data is swapped before output for a landscape view by LCD driver IC.
  • Page 16: Display Driver

    M480 emWin GUIDRV_FLEXCOLOR_M16C0B16); ..5.2 Display Driver The project file includes the ebi.c driver since demo system is connected to a MPU display using the EBI interface. For systems connecting display with the SPI or I C interface, spi.c or i2c.c needs to be added to the project.
  • Page 17 M480 emWin Revision History Date Revision Description 2018.10.04 1.00 Initially issued. Oct. 04, 2018 Page 17 of 18 Rev 1.00...
  • Page 18 All Insecure Usage shall be made at customer’s risk, and in the event that third parties lay claims to Nuvoton as a result of customer’s Insecure Usage, customer shall indemnify the damages and liabilities thus incurred by Nuvoton.

Table of Contents