Search
Filters
Close

FIRST Components Academy | New UART Protocol for Winstar Smart Display

Wednesday, November 13, 2024

From Winstar News of November '24

Smart Display UART Protocol Introduction

The SmartDisplay UART protocol is a proprietary communication protocol developed by WINSTAR, designed to allow customers to easily control their HMI (Human-Machine Interface) screens through the UART interface. This innovative protocol integrates Winstar's user-friendly GUI Builder, providing customers with a powerful tool to quickly and intuitively create widgets that meet their specific needs. Using the GUI Builder, customers can easily design a wide range of HMI objects for interactive purposes, from simple buttons and text to complex gauges and keypads, adapting to various application scenarios. This approach not only saves customers time and cost but also enhances UI design flexibility and customization. With WINSTAR's custom UART protocol commands, interaction and control with the Smart Display are seamless. We are committed to providing an exceptional customer experience and continuously improving our GUI Builder to ensure it meets our customers’ evolving needs. Whether you are a professional designer or a beginner, we believe that the SmartDisplay UART protocol is an ideal choice for creating excellent HMI interfaces. Let’s explore this innovative technology together, bringing more vitality and inspiration to your products.


Smart Display GUI Builder – UART Project Setting Instructions

The SmartDisplay GUI Builder offers an intuitive and user-friendly interface, allowing you to easily create HMI projects. Simply drag and drop various widgets onto the page using the GUI Builder, and effortlessly display and interact with them on your SmartDisplay device. With straightforward operation and versatile functionality, it adapts to a range of needs, making your work more efficient.

The following guide will walk you through creating a UART project with the Smart Display GUI Builder and explain how to control objects through UART.

  • Create UART Protocol Project
    To create a UART project, enter the project name, select your SmartDisplay device type, and choose the SmartDisplay protocol (UART) under the protocol option based on your requirements.

 

  • Add Gauge and Horizontal Slider Widgets to the Main Page
    Each added widget has a unique Index ID, along with Page Index and Object ID settings. By knowing these two settings, the Host side can control this object via UART commands.

 

  • Simulate UART-Widget Interaction
    Click on the "Simulator With GUI" icon to launch the simulator.

 

In the simulator, drag the slider labeled GAUGE_0 to simulate the Host sending data to GAUGE_0, observing changes in the Gauge display and viewing UART command logs in the Message Log on the right. You can also interact with the Horizontal Slider on the simulator to simulate data sent from the Device side.

 

  • Update SmartDisplay Device Settings
    After verifying functionality through the simulator, if all is correct, connect to the device and upload the project settings to the SmartDisplay device.

 

Wait for the upload and update process to complete.

 

  • Verify Device-Widget Interaction
    Once the project is uploaded, further validate functionality on the Smart Display device. Connect to the device with the GUI Builder, click "Test Device," and test interactions between the Host and Device.

 

  • Test Device Window
    This testing interface allows you to simulate Host modifications to object values. For example, drag the slider labeled GAUGE_0 to simulate the Host setting Object 0’s value, observing changes on the device’s Gauge. You can view variations in Send and Response commands in the Message Log at the bottom. Additionally, interact with the Device’s Horizontal Slider to verify Event command responses from the Device.

 

The Test Device Window described above enables you to simulate Host UART commands controlling the SmartDisplay. Observe the SmartDisplay result screen and confirm Event command receptions on the Host side via the SmartDisplay Touch Panel.

SmartDisplay GUI Builder – Custom Widget

When default SmartDisplay widgets don’t meet design requirements, you can design custom widget icons. Updating the images allows for customized interfaces. For simpler widgets like buttons, changing the On/Off images achieves customization, while for complex widgets, additional parameter settings may be required for accurate display.

  • Custom Gauge Explanation and Example
    Achieve a custom widget by sequentially changing images and Gauge parameters.

 

  • Multi-Language Text
    The SmartDisplay Text Widget supports Unicode, enabling multi-language text display. Set up multi-language text as follows:

1. Add Custom Font: Select desired font and size, choose the Unicode text range to display (refer to https://unicode-table.com/en/blocks/ for Unicode range), reducing Flash space if needed by setting only required characters.

 

2. Set Font for Text Widget Display: Choose the Text Widget settings to modify.

 

3. Add Text Widget and verify in the simulator that text displays correctly.

 

Custom UART command Introduction

Next, we will explain the command protocol used for UART. Through these instructions, the Host side can easily control the SmartDisplay, including changing pages, adjusting backlight brightness, or making the buzzer sound.

The following are the default UART settings:
Default baud rate: 115200 (Can be modified through GUI Builder)
Parity Bit: None
Data Bit: 8
Stop Bit: 1

The main data format for UART is as follows:

Header Byte(1 Byte)Length(1 Byte)Payload(N Byte)CRC(2 Byte)
Command Header Value: 4 + Payload length
Payload max size: 250
Payload data max size: 250 Modbus CRC16
(Calculate Modbus CRC16
https://www.modbustools.com/modbus_crc16.html)

The UART protocol mainly has three major types of commands: Send command, Response command, and Event Command, with the following formats in order.

(1) Send Command format
The Send command is used for the Host side to send commands to the SmartDisplay side.

Header Byte(1 Byte)Length(1 Byte)Payload(N byte)CRC(2 Byte)
Start with 0x53 (S) Value: 4 + Payload length
Payload max size: 250
Command code: 1 byte
Command parameter: 0 ~ N bytes
Modbus CRC16

(2) Response command format
The Response command is used for the SmartDisplay side to reply to the Host side with the results of the Send command.

Header Byte(1 Byte)Length(1 Byte)Payload(N byte)CRC(2 Byte)
Start with 0x52 (R) Value: 4 + Payload length
Payload max size: 250
Command Code: 1 byte
Error Code: 1 byte
Response Data: 0 ~ N bytes
Modbus CRC16

(3) Event Command
When the SmartDisplay side needs to proactively report data, it will use this command, for example, when a Button is triggered.

Header Byte(1 Byte)Length(1 Byte)Payload(N byte)CRC(2 Byte)
Start with 0x45 (E) Value: 4 + Payload length
Payload max size: 250
Event Command Code: 1 byte
Event Data: 0 ~ N bytes
Modbus CRC16

* For detailed Send Command code and Event Command code, please refer to the SmartDisplay UART User Guide document.

 

■ Explanation and examples of the Send/Response Command protocol

The following sequentially outlines the data format and examples for each command payload.

● Set Object Value: 0x3

Send Command

Command Code 1 Byte 0x3
Parameter data 8 Byte uint16 PageIndex;
uint16 ObjectId;
int32 value;

Response command

Command Code 1 Byte 0x3
Error Code 1 Byte 0: Success
1: Failed

Example: Set Object value

 

● Set Object Buffer Data: 0x5

Send Command

Command Code 1 Byte 0x5
Parameter data N Byte uint16 PageIndex;
uint16 ObjectId;
uint8 [] data (max 100 bytes)
// Unicode String for Text
// Clock setting for Digital Clock

Response command

Command Code 1 Byte 0x5
Error Code 1 Byte 0: Success
1: Failed

Example: Set Object Text: test

Example: Set Clock Widget date time: 2024/09/01 04:05:06

 

● Set Brightness: 0x6

Send Command

Command Code 1 Byte 0x6
Brightness 1 Byte Brightness value

Response command

Command Code 1 Byte 0x6
Error Code 1 Byte 0: Success
1: Failed

Example: Set brightness to 90.

 

● Set Buzzer: 0x7

Send Command

Command Code 1 Byte 0x7
Cycle 1 Byte Cycle value
High 1 Byte High value (Unit: 10 ms)
Low 1 Byte Low value (Unit: 10 ms)

Response command

Command Code 1 Byte 0x7
Error Code 1 Byte 0: Success
1: Failed

Example: Emitting buzzer: Cycle:1, High: 200 ms, Low: 0 ms

 

● Set Page Index: 0x8

Send Command

Command Code 1 Byte 0x8
Page Index 1 Byte Page Index value

Response command

Command Code 1 Byte 0x8
Error Code 1 Byte 0: Success
1: Failed

Example: Switching Page Index to 1.
To switch pages, you need to first set the Device State to ConfigMode. Then, send the page change command. After completing the page change command, set the Device State Mode to Display Mode to finish the page change operation. The sequence of related commands is as follows:

 

● Set Device State: 0x20

Send Command

Command Code 1 Byte 0x20
Device State 1 Byte 0: ConfigMode
1: DisplayMode
 

Response command

Command Code 1 Byte 0x20
Error Code 1 Byte 0: Success
1: Failed

Example: Refer to the example of switching pages

 

■ Explanation and examples of the Event Command protocol

● Page change event: 0x1

Event Command

Event Code 1 Byte 0x01
Parameter data 2 Byte Uint16 PageIndex

Example: SmartDisplay switches to Page 1.

 

● Object Text change event: 0x2

Event Command

Event Code 1 Byte 0x02
Parameter data N +2 Byte Uint16 ObjectId
N byte Unicode Text
 

Example: Keypad widget sends the text "1234"

 

● Object Value change event: 0x3

Event Command

Event Code 1 Byte 0x03
Parameter data 6 Byte Uint16 ObjectId
int32 value

Example: Object value change event.

Customers can design UI by dragging and dropping widgets using the GUI Builder, achieving a WYSIWYG (What You See Is What You Get) effect, making UI design intuitive and efficient. Additionally, previewing the design results through the simulator allows customers to instantly view the UI presentation, providing an early understanding of the final effect, saving time and effort. Ultimately, through Winstar's custom UART protocol, customers can easily control the device. This end-to-end design process enables seamless integration of design and control for customers, enhancing operational convenience and accuracy. The application of the SmartDisplay UART protocol brings more operational possibilities and convenience to customers, expanding the scope of product development and applications. This comprehensive solution not only enhances customer work efficiency but also boosts product creativity and competitiveness. Excited? Quickly download the SmartDisplay GUI Builder. Before purchasing Smart Display you can try the simulator to confirm if SmartDisplay meets your needs!