Nuvoton N9H26 emWin User manual

Mar. 28, 2023 Page 1of 23 Rev 1.02
N9H26 emWin
Quick Start Guide for 32-bit NuMicro®Family
Document Information
Abstract
This document introduces the steps to build and launch SEGGER
emWin for the N9H26 series microprocessor (MPU).
Apply to
N9H26 series
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 and microprocessor based
system design. Nuvoton assumes no responsibility for errors or omissions.
All data and specifications are subject to change without notice.
For additional information or questions, please contact: Nuvoton Technology Corporation.
www.nuvoton.com
N9H26 emWin Quick Start Guide

Mar. 28, 2023 Page 2of 23 Rev 1.02
N9H26 emWin
Table of Contents
1INTRODUCTION.................................................................................................................... 3
2EMWIN INSTALLATION AND BSP DIRECTORY STRUCTURE.......................... 4
2.1 emWin Installation.......................................................................................................................4
2.2 BSP\SampleCode\emWin ...........................................................................................................4
2.3 BSP\ThirdParty\emWin\Config..................................................................................................4
2.4 BSP\ThirdParty\emWin\Doc.......................................................................................................4
2.5 BSP\ThirdParty\emWin\Include.................................................................................................5
2.6 BSP\ThirdParty\emWin\Lib.........................................................................................................5
2.7 BSP\ThirdParty\emWin\Tool......................................................................................................5
3EMWIN SAMPLE CODE ..................................................................................................... 6
3.1 Development Environment.........................................................................................................6
3.2 Project Structure..........................................................................................................................6
3.3System Initialization....................................................................................................................8
3.4 emWin Initialization ...................................................................................................................10
3.5 Build emWin Project..................................................................................................................10
3.6 Download and Run ....................................................................................................................10
3.7 Touch Screen .............................................................................................................................13
4EMWIN GUIBUILDER........................................................................................................16
4.1 Create Widget.............................................................................................................................16
4.2 Handle Widget Event.................................................................................................................16
5CHANGE DISPLAY PANEL.............................................................................................20
5.1 emWin Display Configuration..................................................................................................20
5.2 Display Driver.............................................................................................................................20
6SUPPORTING RESOURCES..........................................................................................21

Mar. 28, 2023 Page 3of 23 Rev 1.02
N9H26 emWin
1 Introduction
SEGGER emWin is a graphic library with graphical user interface (GUI) designed to provide an
efficient processor and display controller-independent GUI for any application that operates
with a graphical display.
Nuvoton provides emWin GUI library for free with the N9H26 series microprocessor (MPU)
supporting up to 800x480 (24 bpp) resolution (depending on frame rate). The emWin platform
can be implemented on HMI for industrial, machines, appliances, etc.

Mar. 28, 2023 Page 4of 23 Rev 1.02
N9H26 emWin
2 emWin Installation and BSP Directory Structure
This chapter introduces emWin installation and related files and directories in the N9H26 BSP.
2.1 emWin Installation
First, download “N9H26 emWin package from this link”, create a working folder and unzip
“N9H26_emWin_NonOS.zip” into this folder. Then, create a new directory called “emWin”
under BSP path “BSP\SampleCode\”. Then, move “GUIDemo”, “SimpleDemo” and
“SimpleDemoAppWizard” from the working folder into “BSP\SampleCode\emWin\”. Finally,
move “emWin”from working folder into “BSP\ThirdParty\”.
2.2 BSP\SampleCode\emWin
GUIDemo
Utilize emWin library to demonstrate widgets feature.
SimpleDemo
Utilize emWin library to demonstrate interactive feature.
SimpleDemoAppWizard
Utilize AppWizard to demonstrate interactive feature.
2.3 BSP\ThirdParty\emWin\Config
GUI_X.c
Configuration and system dependent code for GUI.
GUIConf.c
emWin heap memory initialization.
GUIConf.h
A header file configures emWin features.
LCDConf.c
Display controller configuration source code.
LCDConf.h
Display driver configuration header file.
2.4 BSP\ThirdParty\emWin\Doc
AN03002_Custom_
Widget_Type.pdf
emWin custom widget type creation guide.
UM03001_emWin.pdf
emWin user guide and reference manual.
UM_Font_Architect_
EN_Rev1.03.pdf
Nuvoton font tool “FontArchitect.exe” user guide and reference
manual in English.
UM_Font_Architect_
TC_Rev1.03.pdf
Nuvoton font tool “FontArchitect.exe” user guide and reference
manual in Chinese.

Mar. 28, 2023 Page 5of 23 Rev 1.02
N9H26 emWin
Changelog.pdf
Introduce N9H26 emWin HMI change log.
Release.html
Release notes for emWin.
2.5 BSP\ThirdParty\emWin\Include
This directory contains header files for emWin project.
2.6 BSP\ThirdParty\emWin\Lib
NUemWin_ARM9_Keil.lib
emWin library for N9H26 series MPU.
libNUemWin_ARM9_GNU.a
emWin library for N9H26 series MPU. Note: for non-OS GCC
toolchain ONLY.
2.7 BSP\ThirdParty\emWin\Tool
AppWizard
The latest AppWizard is designed for creating complete and ready-
to-use emWin applications consisting of a number of screens.
Bitmap Converter
The latest 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.
FontArchitect.exe
A Nuvoton tool for creating emWin bitmap font format.
GUIBuilder.exe
A tool for creating dialogs by drag and drop operation.
JPEG2Movie.exe
A tool to convert JPEG files to an EMF file.

Mar. 28, 2023 Page 6of 23 Rev 1.02
N9H26 emWin
3 emWin Sample Code
There are three emWin sample codes in the N9H26 “BSP\SampleCode\emWin\” directory:
GUIDemo: Utilizes emWin library to demonstrate widgets feature;
SimpleDemo: Utilizes emWin library to demonstrate interactive feature.
SimpleDemoAppWizard: Utilizes AppWizard to demonstrate interactive feature.
Figure 3-1 BSP emWin Sample Name
3.1 Development Environment
Keil IDE and Eclipse are used as Non-OS BSP development environment, which uses J-Link
ICE or ULINK2 ICE (optional) for debugging. This document uses Keil IDE to describe the
project structure. To support ARM9, MDK Plus or Professional edition shall be used.
Note that Keil IDE and ICE need to be purchased from vendor sources.
Figure 3-2 Keil MDK License Chart
3.2 Project Structure
The following uses SimpleDemo as a sample to explain the emWin project structure in BSP.
This sample contains a frame window, four buttons, a text and a text editor. User can update

Mar. 28, 2023 Page 7of 23 Rev 1.02
N9H26 emWin
the number shown in the text field by clicking four buttons shown on the display panel.
Figure 3-3 emWin SimpleDemo on NuMaker Board
The project structure is shown in Figure 3-4. The project contains a default target:
SimpleDemo_N9H26K6_SD_800x480.bin:Uses 800x480 16bpp LCD panel and stores
touch screen calibration parameters in SD card.
The Libraries group contains low level driver and system startup code. The emWin group
contains emWin library and panel configuration for the N9H26. The emWin library will use BitBlt
and JPEG codec to improve the graphic performance. Thus, the project file must include
N9H26_BLT.lib and N9H26_JPEG.lib. The Application group contains the C code generated
by emWin GUIBuilder. The tslib group is the touch screen library. The N9H26_NVTFAT.lib
contains the file system library to access the SD card. The Src group contains the main.c file.

Mar. 28, 2023 Page 8of 23 Rev 1.02
N9H26 emWin
Figure 3-4 emWIn SImpleDemo Project Tree on Keil MDK
3.3 System Initialization
The system initialization code is located in main function, including peripheral clock preparation,
cache, LCD interface, touch screen interface and UART debug port setting. Also, a 1000Hz
timer is configured to keep track of time elapsed.
int main(void)
{
char szFileName[20];
char szCalibrationFile[40];
int hFile;
#if GUI_SUPPORT_TOUCH

Mar. 28, 2023 Page 9of 23 Rev 1.02
N9H26 emWin
g_enable_Touch = 0;
#endif
// LCD interface & timer
_SYS_Init();
#if GUI_SUPPORT_TOUCH
Init_TouchPanel();
sprintf(szFileName, "C:\\ts_calib");
fsAsciiToUnicode(szFileName, szCalibrationFile, TRUE);
hFile = fsOpenFile(szCalibrationFile, szFileName, O_RDONLY | O_FSEEK);
sysprintf("file = %d\n", hFile);
if (hFile < 0)
{
// file does not exist, so do calibration
hFile = fsOpenFile(szCalibrationFile, szFileName, O_CREATE|O_RDWR | O_FSEEK);
if ( hFile < 0 )
{
sysprintf("CANNOT create the calibration file\n");
return -1;
}
GUI_Init();
ts_calibrate(LCD_XSIZE, LCD_YSIZE);
ts_writefile(hFile);
}
else
{
ts_readfile(hFile);
}
fsCloseFile(hFile);
#ifndef STORAGE_SD
GNAND_UnMountNandDisk(&ptNDisk);
sicClose();
#endif
g_enable_Touch = 1;
#endif
MainTask();

Mar. 28, 2023 Page 10 of 23 Rev 1.02
N9H26 emWin
return 0;
}
3.4 emWin Initialization
To initialize emWin GUI, the application needs to call GUI_Init() and CreatFramewin() function.
GUI_Init() is called in main() and CreatFramewin() is called in MainTask() in main.c.
void MainTask(void)
{
GUI_Init();
CreateFramewin();
while (1)
{
GUI_Delay(500);
}
}
3.5 Build emWin Project
To build the emWin project in Keil MDK, click the Rebuild icon shown as Figure 3-5 or press
F7 function key.
Figure 3-5 Shortcut Icon to Rebuild emWin Sample on Keil MDK
3.6 Download and Run
Users could download the newly built image or pre-built image under
BSP/SampleCode/emWin/SimpleDemo/Bin directory to DDR by TurboWriter, or download the
newly built image by ICE. Nuvoton provides TurboWriter tool for downloading firmware to DDR,
SPI Flash, NAND Flash, or SD card. To download images by TurboWriter, connect the N9H26
NuDesign board with PC via an USB cable and the execute TurboWriter. Further information
can be found in the TurboWriter Tool User Guide under N9H26_emWin_NonOS-
master/Tools/PC_Tools directory.
Table of contents
Popular Network Hardware manuals by other brands

Matrix Switch Corporation
Matrix Switch Corporation MSC-HD161DEL product manual

B&B Electronics
B&B Electronics ZXT9-IO-222R2 product manual

Yudor
Yudor YDS-16 user manual

D-Link
D-Link ShareCenter DNS-320L datasheet

Samsung
Samsung ES1642dc Hardware user manual

Honeywell Home
Honeywell Home LTEM-PV Installation and setup guide











