EastRising ER-TFT028A2-4-5465 Installation and operating instructions

ER-TFT028A2-4-5465
Applicaton Note
buydisplay.com
EastRising
CONTENT
1. Overview ............................................................................................................... 5
2. Serial Command................................................................................................. 7
2.1 Command Lists....................................................................................................................... 7
2.2 Host and Serial Uart Panel Protocol .............................................................................. 8
2.3 RS-232(UART) Communication Protocol...................................................................14
2.4 A Program Example of Host Sends Command .......................................................16
3. UI Editor (UI_Editor.exe).................................................................................19
3.1 UI_Editor Introduction .......................................................................................................19
3.1.1 UI_Editor Design Flow .....................................................................................................................24
3.1.2 Panel Initialize and Background Setting...................................................................................25
3.1.3 Display Setting...................................................................................................................................27
3.1.4 Interface Edit and Debug...............................................................................................................31
3.1.5 Compile and Generate Bin File ....................................................................................................34
3.2 Picture Display Setting ......................................................................................................36
3.2.1 Single/Multi Picture Setting (80h) ..............................................................................................36
3.2.2 Scroll Picture(in Loop) Setting (D8h, D9h)...............................................................................37
3.2.3 Overlap Picture Display in Loop(81h)........................................................................................39
3.2.4 GIF Animation Setting(88h)...........................................................................................................40
3.2.5 Display Text in the form of Picture (80h)..................................................................................41
3.2.6 Create Number Object(90h)..........................................................................................................42
3.2.7 Create Image Number(91h) ..........................................................................................................43
3.2.8 Display Text by Font(C0h~C3h) ...................................................................................................44
3.2.9 Button Picture Setting (A0h).........................................................................................................45
3.2.10 Boot Picture Setting(9Ah) ..............................................................................................................47
3.2.11 Progress Bar Picture Setting(B0h) ...............................................................................................50
3.2.12 Create a Circular Progress Bar(DCh)...........................................................................................51
3.2.13 Line Drawing (E0h) ...........................................................................................................................51
3.2.14 Basic Geometric Drawing...............................................................................................................52
3.2.15 Table Drawing (F6h) .........................................................................................................................55
3.3 Other Functions....................................................................................................................56
3.3.1 Backlight Control Command (BAh) ............................................................................................56
3.3.2 Resistive Panel Control Command (8Bh)..................................................................................57

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 3 of 187
buydisplay.com
EastRising
3.3.3 TFT Panel Verify Command (BEh)................................................................................................58
3.3.4 Description of Font File...................................................................................................................59
3.3.5 Audio Control (B8h) .........................................................................................................................60
3.3.6 RTC Digital Clock Command (92h) .............................................................................................61
3.3.7 Register Operation Instructions (CA).........................................................................................62
3.4 BIN File Generation and Command Send .................................................................63
3.4.1 SPI Flash Structure............................................................................................................................68
3.4.2 Userinfo.bin (128K) Update...........................................................................................................68
3.5 Download a UI_Editor Demo ..........................................................................................69
4. Graphic Integration Compiler(UartTFT_Tool.exe)..................................71
4.1 Edit Command Setting File..............................................................................................73
4.1.1 Information Setting [INFO]............................................................................................................73
4.1.2 Command Parameter Setting [USERCMD] ..............................................................................74
4.2 Command Parameter Setting.........................................................................................76
4.2.1 Fixed Picture Setting and Display Command .........................................................................76
4.2.2 Dynamic Picture Setting and Display Command...................................................................78
4.2.3 Button Picture Setting and Display Command ......................................................................81
4.2.4 Picture-Number Display Command...........................................................................................85
4.2.5 Font Text Setting and Display Command.................................................................................88
4.2.6 Point Drawing Command...............................................................................................................89
4.2.7 Circle/Ellipse Drawing Command................................................................................................90
4.2.8 Line Drawing.......................................................................................................................................93
4.2.9 Rectangle/Rounded-Rectangle Drawing Command............................................................94
4.2.10 Triangle Drawing Command .........................................................................................................97
4.2.11 Cylinder/Table Drawing Command ............................................................................................99
4.2.12 Boot Setting Command............................................................................................................... 101
4.2.13 Combination Command.............................................................................................................. 102
4.2.14 Scroll Picture Setting and Display Command...................................................................... 103
4.2.15 Ring Drawing Setting and Display Command..................................................................... 105
4.2.16 Progress Bar Setting and Display Command....................................................................... 106
4.2.17 Resistive Panel Control Command........................................................................................... 108
4.2.18 Backlight Control Command ..................................................................................................... 109
4.2.19 TFT Panel Verify Command ........................................................................................................ 110
4.2.20 QR-Code Setting and Display Command ............................................................................. 112
4.2.21 Audio Control Command............................................................................................................ 112
4.2.22 RTC Command ................................................................................................................................ 114
4.2.23 Digital Clock Display Command............................................................................................... 115

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 4 of 187
buydisplay.com
EastRising
4.2.24 Register Setting Instructions...................................................................................................... 117
4.2.25 Command Table ............................................................................................................................. 119
4.3 UartTFT_Tool Design Flow ............................................................................................ 123
4.4 Graphic Integration Compiler User Manual .......................................................... 125
4.4.1 TFT Serial Command Compile................................................................................................... 126
4.4.2 Make Picture Bin File .................................................................................................................... 133
4.4.3Make GIF Bin File............................................................................................................................ 138
4.4.4 Make Font Bin File ......................................................................................................................... 143
4.4.4.1 Full Font Make ................................................................................................................ 143
4.4.4.2 User-Define Font Make ............................................................................................... 146
4.4.5 Make Wav Bin File.......................................................................................................................... 149
4.4.5.1 Audio File Convert to WAV........................................................................................ 149
4.4.5.2 Make WAV Bin File........................................................................................................ 154
4.4.5.3 Typical PWM Audio Drive Circuit ............................................................................. 157
4.4.6 Bin File Combination .................................................................................................................... 158
5. Serial Communication Software (UartDebug.exe)..............................161
5.1 UartDebug Precaution....................................................................................................162
5.2 UartDebug Introduction ................................................................................................ 163
5.3 Load Simulation Command.......................................................................................... 164
5.4 Send Simulation Command ......................................................................................... 167
5.5 Send Simulation Command in Loop......................................................................... 169
5.6 Modify and Save Command List ................................................................................ 172
5.7 Clear Command Box and Receiving Data............................................................... 175
5.8 Load and Update UserInfo.bin.................................................................................... 177
6. MCU Code and Flash Update.....................................................................180
6.1 ER-TFT028A2-4-5465 Program Update................................................................... 180
6.2 ER-TFT028A2-4-5465 External Flash Update ........................................................ 184
6.3 Use SD Card Update SPI Flash .................................................................................... 187

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 5 of 187
buydisplay.com
EastRising
1. Overview
This application note mainly explain the application of ER-TFT028A2-4-5465, the small-size UART TFT
panel. This application note will provide a step-by-step guidance and detailed introduction of the
Graphic Integration Compiler (UartTFT_Tool.exe) and UI Editor (UI_Editor.exe), help the system-side
application customers can complete their display product quickly, avoiding long time development.
Before using the ER-TFT028A2-4-5465, you can use two computer tools "UartTFT_Tool.exe" and the
"UI_Editor.exe" which provided by EastRising. Both tools are used to set up and display the function.
This software will follow the fixed command protocol to integrate user's picture, text, animation and
other messages to produce a "Bin" file. Developers can program the Bin file into SPI Flash via USB port
and using EastRising ISP program or a dedicated Flash programmer. ER-TFT028A2-4-5465 can also
update External SPI Flash with an SD card. Then through the USB to Uart (RS232) control line to
simulate and pre-verification.Please refer to Chapter 6 for more flash update detail.
Figure 1-1: Develop Diagram using PC Software
The host computer software will generate the command format according to the order and manner in
which the pictures appear. The above-mentioned simulation is to replace the Host through the USB to
Uart control line to send commands, so that the developer can perform pre-verification on the PC
software. The commands sent by the host computer software can be displayed on the TFT panel and
achieve the desired effect of the developer.
The UI_Editor has a fixed command for each display action of serial TFT display, for example, 80h is the
command to display pictures. UI_Editor will number the used pictures, and create Bin file for all
pictures, texts, animation after compilation. After developers Programming the Bin file into SPI Flash,
when PC send 80h, 00h, then will display the first picture on display panel ; when PC send 80h, 01h, the
second picture will be displayed. Once commands sent by UI_Editor can be displayed and achieve

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 6 of 187
buydisplay.com
EastRising
desired effect, now we can connect Host with serial TFT panel as photo 1-5 shown. When Host MCU
send out command 80h, 00h, 1Bh(CRC1), 98h(CRC2), Serial Uart TFT Panel will display the first picture
and send back 80h, 00h(command executed), 1Bh(CRC1), 98h(CRC2) to Host to confirm the protocol is
completed. Shown as below:
Figure 1-6: Command Protocol Example 1
When Host MCU send out command 80h, 01h, 0Bh(CRC1), B9h(CRC2), Serial Uart TFT Panel will display
the second picture and send back 80h, 00h (command executed), 1Bh(CRC1) 98h(CRC2) to Host to
confirm protocol is completed. As below figure shows:
Figure 1-6: Command Protocol Example 2
In order to ensure the correct data transmission between the Host and the Uart TFT Panel, the
command sent by the Host MCU program must be added with 1 byte initial code( fixed as 0xAA),2 Byte
CRC codes, 4 Byte End code (fixed as 0xE4, 0x1B, 0x11, 0xEE). After the TFT panel receive the
information or execute the command, it will return the information to the host MCU. For the command
protocol between the Host and TFT panel, please refer to Section 2.2. The generation method of the
2-byte CRC, please refer to Section 2.3.

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 7 of 187
buydisplay.com
EastRising
2. Serial Command
In order to allow the host to easily display pictures or information on the TFT Panel through the serial
port such as UART and SPI, a serial command set is planned on the ER-TFT028A2-4-5465. Through the
defined command code and parameter changing, user can change the picture on TFT Panel. EastRising
provides two kinds of serial Panel development tools: UartTFT_Tool and UI_Editor. Users can choose
either of the tools to develop of the TFT serial Panel. And these two tools can simulate the display effect
of the TFT Panel in real time, and do the preliminary verification.
2.1 Command Lists
The commands supported by the ER-TFT028A2-4-5465 includes static picture display, dynamic picture
display, text display, geometry, etc., as shown in the following table.
Table 2-1: ER-TFT028A2-4-5465 Command List
Main
Function Detail Function Code
(1Byte)
Picture
Display
Single/Multi Picture 80h, 8Ah,
8Fh
Play In Loop 81h, 84h
GIF Animation 88h, 89h
Transparent
Picture D8h
Pop-Up Picture D9h, DBh
Numberal Picture 90h, 91h
Display
Button
Picture
Display Single
Button Picture A0h
Cancel Single
Button Picture A1h
Virtual Touch Area A2h
Cancel Virtual
Touch Area A3h
Indicator
Font
Display
Progress Bar
Indicator B0h
Ring Indicator DCh
QR-Code 98h
Font
Display Font-1~4 C0h ~ C3h
Backlight
Brightness
Brightness Setting BAh
On/Off BCh
RTC Set Clock 8Ch
Read Clock 8Dh
Display
Clock Display Digital Clock 92h
Boot
Boot Command 9Ah/00
Combine Combine
Command 9Ah
Play Wav
Music
Play B8h
Stop B9h
Main
Function Detail Function Code
(1Byte)
Geometric
Point DFh
Line E0h
Hollow Circle E1h
Solid Circle E2h
Solid Circle With
Frame E3h
Hollow Ellipse E4h
Solid Ellipse E5h
Solid Ellipse With
Frame E6h
Hollow Rectangle E7h
Solid Rectangle E8h
Rectangle With Frame
E9h
Hollow
Rounded-Rectangle EAh
Solid
Rounded-Rectangle EBh
Rounded-Rectangle
With Frame ECh
Hollow Triangle EDh
Solid Triangle EEh
Triangle With Frame EFh
Cylinder F4h
Table F6h
Register Regster Control CAh ~ CFh
Resistive
Panel
Verification
Verification
Command 8Bh
Panel
Check
Online Check BEh
Version Check BFh

ER-TFT028A2-4-5465
Applicaton Note
buydisplay.com
EastRising
2.2 Host and Serial Uart Panel Protocol
Table 2-2: Command Protocol for Host and TFT Panel
Main
Function
Detail
Function
Host Send
(Panel Receive)
Host Receive
(Panel Send)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comman
d Param.
CRC
Code
(2Bytes)
End
Code
(4Bytes)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comm.
Param.
(1Byte)
CRC
Code
(2Bytes)
End
Code
(4Bytes)
Display
Picture
Single/Mul
ti Picture Start 80h nn CRC End Start 80h nn info code CRC End
Single/Mul
ti Picture Start 8Ah nn CRC End Start 8Ah nn info code CRC End
Single
Picture Start 8Fh nn
X, Y, PNG,
Pnn CRC End Start 8Fh nn info code CRC End
Play In
Loop Start 81h nn CRC End Start 81h nn info code CRC End
Cancel
Play
In Loop Start 84h nn CRC End Start 84h nn info code CRC End
Play GIF
Animation Start 88h nn CRC End Start 88h nn info code CRC End
Cancel GIF
Animation Start 89h nn CRC End Start 89h nn info code CRC End
Pop Up
Picture Start D8h nn CRC End Start D8h nn info code CRC End
Scroll
Picture In
Loop
Start D9h nn CRC End Start D9h nn info code CRC End
Cancel
Scroll
Picture
Start DBh nn CRC End Start DBh nn info code CRC End
Numberal
Picture #1 Start 90h nn ddd.d CRC End Start 90h nn info code CRC End
Numberal
Picture #2 Start 91h nn ddd.d CRC End Start 91h nn info code CRC End
Display
Button
Picture
Display
Single
Button
Picture
Start A0h nn CRC End Start A0h nn info code CRC End
When press the Button picture Start A0h nn 31h CRC End
When release the Button picture Start A0h nn 30h CRC End
Cancel
Button
Picture
Start A1h nn CRC End Start A1h nn info code CRC End
Virtual
Touch Area
Start A2h nn CRC End Start A2h nn info code CRC End
When press the touch area Start A2h nn 31h CRC End
When release the touch area Start A2h nn 30h CRC End
Cancel
Virtual
Area
Start A3h nn CRC End Start A3h nn info code CRC End
Indicator
Display
String
Progress
Bar
Indicator
Start B0h nn Vaule
(2 Bytes) CRC End Start B0h nn info code CRC End

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 10 of 187
buydisplay.com
EastRising
Table 2-2: Protocol Table between Host and Uart TFT Panel (continue)
Main
Function
Detail
Function
Host Send
(Panel Receive)
Host Receive
(Panel Send)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comman
d Param.
CRC
Code
(2Bytes)
End
Code
(4Bytes)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comm.
Param.
(1Byte)
CRC Code
(2Bytes)
End
Code
(4Bytes)
Display
String
Font-1 Start C0h nn String CRC End Start C0h nn info
code CRC End
Font-2 Start C1h nn String CRC End Start C1h nn info
code CRC End
Font-3 Start C2h nn String CRC End Start C2h nn info
code CRC End
Font-4 Start C3h nn String CRC End Start C3h nn info
code CRC End
Backlight
Brightnes
s
Set
Brightness
Start BAh BL
(00~0Fh) CRC End Start BAh BL (00~0Fh)
info
code CRC End
On/Off Start BCh 00 or01 CRC End Start BCh 00 or 01 info
code CRC End
Play Wav
Music
Play Start B8h
REP(Bit7) +
WAV No# CRC End Start B8h REP(Bit7) +
WAV No#
info
code CRC End
Stop Start B9h CRC End Start B9h 00 info
code CRC End
Boot Boot Start 9Ah 00 CRC End Start 9Ah 00 info
code CRC End
Combine
Command
Combine Start 9Ah nn CRC End Start 9Ah nn info
code CRC End
RTC
Setup
Clock Start 8Ch
Y, M, D, H,
M, S, W (8
Bytes)
CRC End Start 8Ch 00 info
code CRC End
Read Clock
Start 8Dh CRC End Start 8Dh Y, M, D, H,
M, S, W (8 )
info
code CRC End
Display
Clock
Display
Digital
Clock
Start 92h nn CRC End Start 92h nn info
code CRC End
Resistive
Panel
Verify
Resistive
Panel
Verify
Start 8Bh CRC End Start 8Bh 00 info
code CRC End
TFT Panel
Verify
Online
Verify Start BEh CRC End Start BEh 00 5Ah, or
55h CRC End
Version
Verify Start BFh CRC End Start BFh
MCU
Code(5Byte
s) + Module
Info. (42)
info
code CRC End
Register
Execute 9A
CMD Start CAh Reg CRC End Start CAh nn info code
CRC End
Setup REG
Start CBh Reg CRC End Start CBh nn info code
CRC End
Write Data
Start CCh Data CRC End Start CCh nn info code
CRC End
Read Data
Start CDh 00 CRC End Start CDh Data info code
CRC End
REG Value
+1Start CEh Reg CRC End Start CEh nn info code
CRC End

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 12 of 187
buydisplay.com
EastRising
Table 2-2: Protocol Table between Host and Uart TFT Panel (continue)
Main
Function
Detail
Function
Host Send
(Panel Receive)
Host Receive
(Panel Send)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comman
d Param.
CRC
Code
(2Bytes)
End
Code
(4Bytes)
Initial
Code
(1Byte)
Comm.
Code
(1Byte)
No.
(1Byte)
Comm.
Param.
(1Byte)
CRC Code
(2Bytes)
End
Code
(4Bytes)
Geometri
c
Dot Start DFh nn CRC End Start DFh nn info
code CRC End
Line Start E0h nn CRC End Start E0h nn info
code CRC End
Hollow
Circle Start E1h nn CRC End Start E1h nn info
code CRC End
Solid
Circle Start E2h nn CRC End Start E2h nn info
code CRC End
Solid
Circle With
Frame
Start E3h nn CRC End Start E3h nn info
code CRC End
Hollow
Ellipse Start E4h nn CRC End Start E4h nn info
code CRC End
Solid
Ellipse Start E5h nn CRC End Start E5h nn info
code CRC End
Solid
Ellipse
With
Frame
Start E6h nn CRC End Start E6h nn info
code CRC End
Hollow
Rectangle Start E7h nn CRC End Start E7h nn info
code CRC End
Solid
Rectangle Start E8h nn CRC End Start E8h nn info
code CRC End
Rectangle
With
Frame
Start E9h nn CRC End Start E9h nn info
code CRC End
Hollow
Rounded
Rectangle
Start EAh nn CRC End Start EAh nn info
code CRC End
Solid
Rounded
Rectangle
Start EBh nn CRC End Start EBh nn info
code CRC End
Rounded
Rectangle
With
Frame
Start ECh nn CRC End Start ECh nn info
code CRC End
Hollow
Triangle Start EDh nn CRC End Start EDh nn info
code CRC End
Solid
Triangle Start EEh nn CRC End Start EEh nn info
code CRC End
Triangle
With
Frame
Start EFh nn CRC End Start EFh nn info
code CRC End
Cylinder Start F4h nn CRC End Start F4h nn info
code CRC End

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 14 of 187
buydisplay.com
EastRising
2.3 RS-232(UART) Communication Protocol
When the main system transmits a display command to the ER-TFT028A2-4-5465 TFT panel
through the UART serial port, it includes Command Code, Code Number, and Command
Parameters, 1 Byte Start Code (fixed to 0xAA) and 2 Bytes, CRC Code, 4 Byte End Code (fixed to
0xE4, 0x1B, 0x11, 0xEE), the command information is as below:
Table 2-3: TFT Panel Receive Command Info
Initial
Code
Comman
d Code
Serial
Code No.
Paramete
rCRC Code End Code
0xAA
(1 Byte)
1 Byte 1 Byte n Bytes 2 Bytes 0xE4, 0x1B, 0x11, 0xEE
(4 Bytes)
CRC protocol as below:
chkSum = Rx_CRC_CCITT(txBuf,txLen);
txBuf[txLen++] = (chkSum>>8)&0xFF;
txBuf[txLen++] = chkSum&0xFF;
unsigned int Rx_CRC_CCITT(unsigned char *puchMsg, unsigned int usDataLen)
{
unsigned char i = 0;
unsigned short wCRCin = 0x0000;
unsigned short wCPoly = 0x1021;
unsigned char wChar = 0;
while (usDataLen--)
{
wChar = *(puchMsg++);
wCRCin ^= (wChar << 8);
for(i = 0; i < 8; i++)
{
if (wCRCin & 0x8000)
wCRCin = (wCRCin << 1) ^ wCPoly;
else
wCRCin = wCRCin << 1;
}
}
return (wCRCin);
}

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 15 of 187
buydisplay.com
EastRising
After receiving the host command, the TFT panel will normally respond to 10 bytes of information,
including initial code, command code, information code, CRC code, and end code. The first Byte is the
initial code, then the received command, the third is the serial number. Then the fourth is information
code that returns the executed result. The fifth and sixth are the CRC code, and the last is the end
code of 4 Bytes:
Table 2-4: Feedback Information of TFT Panel
Initial
Code
Command
Code
Serial
Number Information Code CRC Code End Code
0xAA
(1 Byte)
1 Byte
Normal
Command
(1 Byte)
BFh
Command
(47 Bytes)
1Byte
0x00: Command executed
0x01: Command parameter
error
0x02: Non-exist command
0x03: Command’s
configuration
Overflow
0x04: CRC correction error
0x05: Flash Data Exception
BEh Command:
0x5A: Ready
0x55: Not Ready
A0h Command:
0x31: Press Button
0x30: Release Button
2 Bytes
0xE4, 0x1B, 0x11,
0XEE
(4 Bytes)
In the information structure of Serial Uart TFT Panel feedback, serial numbers also represent different
meanings in some instructions. For example, the brightness command - BAh its serial number
represents the backlight brightness. The Version Check command - BFh has 47 Bytes representing
Serial Uart TFT Panel information.

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 16 of 187
buydisplay.com
EastRising
2.4 A Program Example of Host Sends Command
The following is an example of a program in which the host passes a display command to the
ER-TFT028A2-4-5465 serial TFT panel through the UART port. This program takes the transmission
of the first picture (80h, 00h) as an example. The program will automatically add 0xAA start code, 2
Byte CRC codes and 4 Byte end codes.
int main (void)
{
char c[] = "80 00"; //Send 80h command and 00 serial number
Send(c);
while(1);
}
unsigned short Rx_CRC_CCITT(unsigned char *puchMsg, unsigned int usDataLen) // generate CRC
{
unsigned char i = 0;
unsigned short wCRCin = 0x0000;
unsigned short wCPoly = 0x1021;
unsigned char wChar = 0;
while (usDataLen--)
{
wChar = *(puchMsg++);
wCRCin ^= (wChar << 8);
for(i = 0; i < 8; i++)
{
if (wCRCin & 0x8000)
wCRCin = (wCRCin << 1) ^ wCPoly;
else
wCRCin = wCRCin << 1;
}
}
return (wCRCin);
}
void Send(char *c) //Send command function
{
unsigned char Sendbuff[100]={0};
unsigned short Send_CRC = 0;
unsigned char C_flag = 0;
int i = 0, j = 0;
if(((c[0]>=0x30 && c[0]<=0x39) || (c[0]>=0x41 && c[0]<=0x5A)) || ((c[1]>=0x30 &&
c[1]<=0x39) || (c[1]>=0x41 && c[1]<=0x5A))) {
while(c[i] != '\0')
{
if(c[i] != ' ')
{
if(c[i] == '"') ,
{
C_flag++;

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 17 of 187
buydisplay.com
EastRising
i++;
}
if(C_flag == 1)
{
if(c[i] != '"')
{
Sendbuff[j] = c[i]; //ASCII direct output
i++;
j++;
}
}
else if(C_flag == 2)
{
C_flag = 0;
i++;
}
if(C_flag == 0)
{
if(c[i] == '/') break;
if(c[i]>=0x30 && c[i]<=0x39) //0~9
{
Sendbuff[j] = ((c[i] - 0x30)<< 4 );
i++;
if(c[i]>=0x30 && c[i]<=0x39)
{
Sendbuff[j] += (c[i] - 0x30);
i++;
j++;
}
else if(c[i]>=0x41 && c[i]<=0x5A)
{
Sendbuff[j] += (c[i] - 0x37);
i++;
j++;
}
}
else if(c[i]>=0x41 && c[i]<=0x5A) //A~Z
{
Sendbuff[j] = ((c[i] - 0x37)<< 4 );
i++;
if(c[i]>=0x30 && c[i]<=0x39)
{
Sendbuff[j] += (c[i] - 0x30);
i++;
j++;
}
else if(c[i]>=0x41 && c[i]<=0x5A)
{
Sendbuff[j] += (c[i] - 0x37);
i++;
j++;

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 18 of 187
buydisplay.com
EastRising
}
}
}
}
else i++;
}
Sendbuff[j] = '\0';
// printf("%s\r\n",Sendbuff);
/************************ CRC, header and end ***********************/
Send_CRC = Rx_CRC_CCITT(Sendbuff,j);
Sendbuff[j] = Send_CRC>>8 & 0xff;
Sendbuff[j+1] = Send_CRC & 0xff;
for(i = 0;i<j+2;i++)
Sendbuff[j+2-i]=Sendbuff[j+1-i];
Sendbuff[0] = 0xAA;
Sendbuff[j+3] = 0xE4;
Sendbuff[j+4] = 0x1B;
Sendbuff[j+5] = 0x11;
Sendbuff[j+6] = 0xEE;
j+=7;
for(i = 0; i < j; i++)
{
USART_DATA(USART0) = (uint8_t) Sendbuff[i];
while(usart_flag_get(USART0, USART_FLAG_TBE)==0){};
}
}
}

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 19 of 187
buydisplay.com
EastRising
3. UI Editor (UI_Editor.exe)
3.1 UI_Editor Introduction
“UI_Editor.exe” is a graphic UI compiler for panels provided by EastRising. Its function is to package
the picture, text, configuration data and other information used by the TFT panel according to the
customer's needs and generate a BIN file. Customers can use UI_Editor to create a UI interface
simply and quickly, and then Programming the generated BIN file into SPI Flash.
Remark: The compile environment of UI_Editor is “Microsoft .NET Framework V4.6.2”, so the
computer must install “Microsoft .NET Framework 4.6.2”.
UI_Editor's interface consists of various buttons and screen box, shown as below
Figure 3-1: UI_Editor Interface

ER-TFT028A2-4-5465 Applicaton Note
URL: www.buydisplay.com Document Name: ER-TFT028A2-4-5465 Application Note Page: 20 of 187
buydisplay.com
EastRising
All UI designs are done in the screen box, and users can choose different functions to achieve the
design according to their needs. The details of various function keys as follows:
1. add picture button
2. add Button button
3. add GIF button
4. add number button(graphic)
5. add number button(graphic)
6. add text button (font)
7. add table
8. add ring (any angle)
9. add progress bar button
10. draw rectangle, rounded rectangle, circle, ellipse
11. Draw line, triangle, cylinder
12. Retraction operation and recovery operation button
(button not available when there is no operation )
Table of contents