MODBUS Slave Protocol
Smart LCD MODBUS Salve Product can be accessed by MODBUS Master devices for real-time control and access.
Basic
MODBUS Communication
The MODBUS is a standard protocol (with RTU or ASCII mode) which is used to communicate between a host and one or multiple slave devices. Over the MODBUS the host is able to communicate with up to 254 slaves. It can read or write data areas on these devices.
The SMART LCD Slave Product works as a slave device in RTU mode. Therefore, we only describe the RTU mode within this document.
General MODBUS Frame consists: - 1byte of Device Address, to indicate which slave device shall response - 1byte of Function Code, to tell the addressed slave which function is going to do - Data content for PAGE, Addresses and data values - 2-Byte CRC for Error Checking
| < - - - - - - - - - - - - - - - - - - - - - - - - - ADU - - - - - - - - - - - - - - - - - - - - - - - - - > | |||
|---|---|---|---|
Device Address (1byte) |
Function Code (1byte) |
Data (252bytes(max.)) |
Error Check (2bytes) |
| < - - - - - - - - - - PDU - - - - - - - - - - > | |||
When the host receives the previous frame reply from the slave device, the host needs an interval of 5ms before it can continue to send the next frame command. Since the SMART LCD is a Modbus slave device, a Device Address must be assigned to it. Device address can be assigned in the TOPWAY’s SGTools.
MODBUS Function Codes
| MODBUS Function Code | Function Definition | Address Range | Object Type |
| 0x03 | Read Multiple Holding Registers | 0x0000 ~ 0xFFFF | 2 Bytes |
| 0x06 | Write Single Holding Register | 0x0000 ~ 0xFFFF | 2 Bytes |
| 0x10 | Write Multiple Holding Registers | 0x0000 ~ 0xFFFF | 2 Bytes |
| 0x11 | Report Slave ID | ||
| 0x14 | Read File Record | 1 File with 2048 Records of 128 Byte | |
MODUBS Address and Mapping with Smart LCD
To access memory locations in the SMART LCD the host has to issue a Read or Write function, which includes a specific address. Each Read or Write function accesses a 2-Byte location within an area of up to 64k words. Since the multiple data areas (N16, N32, N64, etc.) are together larger than 64k Words, the different memory areas are separated into pages. To select a specific page the Modbus Page Map Register must be written with the page number. The Page Map Register is located within the set of Special Function Registers. The Special Function Registers (SFR) are accessible on all pages at the same location. They are placed within the final 4k words of all pages.
In SGTools, MENU --> View --> Show Modbus Holding Register Address can show up the VPs corresponding MODBUS ADDRESS for the display UI.
Relationship between MODBUS PAGE:addresses and the SMART LCD VPs
| VP type | SMART LCD VP Address | MODBUS PAGE: Address | note |
| VP_STR | 0x000000, 0x000080 - 0x01DF80 | 0:0x0000, 0:0x0040 - 0:0xEFC0 | |
| VP_N32 | 0x020000, 0x020004 - 0x02FFDC | 1:0x0000, 1:0x0002 - 1:0x7FEE | |
| TIMER COUNTER | 0x02FFE0, 0x02FFE4 - 0x02FFFC | 1:0x7FF0, 1:0x7FF2 - 1:0x7FFE | Timer 0, Timer 1 - Timer 7 |
| VP_N64 | 0x030000, 0x030008 - 0x03FFF8 | 6:0x0000, 6:0x0004 - 6:0x7FFC | |
| VP_N16 | 0x080000, 0x080002 - 0x08FFFE | 4:0x0000 - 4:0x7FFF | |
| VP_BMP | 0x040000 - 0x05DFFE | 2:0x0000 - 2:0xEFFF | |
| VP_G16 | 0x060000 - 0x06EFFF | 3:0x0000 - 3:0xEFFF | |
| VP_Flash | 120kB Flash memory | 5:0x0000 - 5:0xEFFF | remain unchanged even after power down |
| VP_REG | 0xFFF000 - 0xFFFFFF | -- | VP_Reg can not be accessed directly via MODBUS |
| SFR | -- | n:0xF000 - n:0xFFFF | SFR for Smart LCD MODBUS PAGE and some of the VP_REG functions |
MODBUS Function Codes Details
The SMART LCD supports five MODBUS Functions Codes: 0x03, 0x06, 0x10, 0x11, 0x14
Function Code 0x03 - “Read Multiple Holding Registers”
This function code read up to 250 Bytes from the SMART LCD.
Host to Smart LCD MODBUS Frame
| Byte Seq | Content | No. of Byte | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x03 | |
| 2 | Start Address to be read | 2 | 0x0000 … 0xFFFF | Address location that MODBUS PAGE assigned via SFR |
| 4 | Quantity of data | 2 | 0x0001 … 0x007D | no. of 16 Bit data values to be read |
| 6 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x03 | |
| 4 | Byte Count N | 1 | 0x02 … 0xFA | must be an even number, must be double of the requested "Quantity of data" in16 Bit values |
| 6 | N Bytes of data | N | 0x00 … 0xFF | |
| 6 + N | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host (in case of error found)
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Error Code | 1 | 0x83 | |
| 2 | Exception Code | 1 | 0x01 ... 0x04 | 01=Illegal Functrion; 02=IllegalDataAddress; 03=IllegalDataValue; 04=SlaveDeviceFailure |
| 3 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
Example Frame (Read a VP_N32 value form Smart LCD (device address = 01))
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F0 01 00 01 2A CA | Set the Smart LCD MODBUS PAGE =1; omit this frame for continue access the same PAGE |
| 2 | RX | 01 06 F0 01 00 01 2A CA | |
| 3 | TX | 01 03 00 00 00 02 C4 0B | Read multiple data form address 00 00, and get 00 02 16bit values |
| 4 | RX | 01 03 04 33 44 11 22 39 2B | no. of byte =04; Data value = 0x11223344 |
Function Code 0x06 - “Write Single Holding Register”
This function code write 2 Bytes to the SMART LCD.
Host send to Smart LCD MODBUS frame
| Byte Seq | Content | No. of Byte | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | 0x00 is a broadcast message to all devices |
| 1 | Function Code | 1 | 0x06 | |
| 2 | Address to be writen | 2 | 0x0000 … 0xFFFF | Address location that MODBUS PAGE assigned via SFR |
| 4 | Data value | 2 | 0x0001 … 0x007D | 16 Bit data values to be written |
| 6 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x06 | |
| 2 | Address wrote | 1 | 0x02 … 0xFA | must be an even number, must be double of the requested "Quantity of data" in16 Bit values |
| 4 | Data value | 2 | 0x0001 … 0x007D | 16 Bit data value wrote |
| 6 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host (in case of error found)
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Error Code | 1 | 0x86 | |
| 2 | Exception Code | 1 | 0x01 ... 0x04 | 01=Illegal Functrion; 02=IllegalDataAddress; 03=IllegalDataValue; 04=SlaveDeviceFailure |
| 3 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
Example Frame (Write a VP_N16 value to Smart LCD (device address = 01))
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F0 01 00 04 EA C9 | Set the Smart LCD MODBUS PAGE =4; omit this frame for continue access the same PAGE |
| 2 | RX | 01 06 F0 01 00 04 EA C9 | |
| 3 | TX | 01 06 00 00 12 34 84 BD | Write a data 12 34 to address 00 00 |
| 4 | RX | 01 06 00 00 12 34 84 BD |
TX=host to Smart LCD; RX=Smart LCD reply to host
Function Code 0x10 - “Write Multiple Holding Registers”
This function code write up to 246 Bytes to the SMART LCD.
Host send to Smart LCD MODBUS frame
| Byte Seq | Content | No. of Byte | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | 0x00 is a broadcast message to all devices |
| 1 | Function Code | 1 | 0x10 | |
| 2 | Start Address to be write | 2 | 0x0000 … 0xFFFF | Address location that MODBUS PAGE assigned via SFR |
| 4 | Quantity of data (Q) | 2 | 0x0001 … 0x007B | no. of 16 Bit data values to be written |
| 6 | Byte Count | 1 | 0x02 … 0xF6 | must be an even number and exactly the double of Q |
| 7 | Data to be written | 2 x Q | 0x0000 ... 0xFFFF | |
| 7 + Q | CRC | 2 | 0x0000 ... 0xFFFF | for error checking |
SMART LCD reply to host
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x10 | |
| 2 | Start Address wrote | 2 | 0x0000 … 0xFFFF | Address location that MODBUS PAGE assigned via SFR |
| 4 | Quantity of data worte | 2 | 0x0001 … 0x007B | no. of 16 Bit data values wrote |
| 6 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host (in case of error found)
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Error Code | 1 | 0x90 | |
| 2 | Exception Code | 1 | 0x01 ... 0x04 | 01=Illegal Functrion; 02=IllegalDataAddress; 03=IllegalDataValue; 04=SlaveDeviceFailure |
| 3 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
Example Frame (Write two VP_N16 value to Smart LCD (device address = 01))
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F0 01 00 04 EA C9 | Set the Smart LCD MODBUS PAGE =4; omit this frame for continue access the same PAGE |
| 2 | RX | 01 06 F0 01 00 04 EA C9 | |
| 3 | TX | 01 10 00 00 00 02 04 56 78 12 34 06 68 | Write two 16bit data 12 34 and 56 78 to address 00 00 |
| 4 | RX | 01 10 00 00 00 02 41 C8 |
TX=host to Smart LCD; RX=Smart LCD reply to host
Function Code 0x11 - "Report Slave ID"
This function code allows the host to check some slave device information like device name and revision. Additional there is one byte indicating the current operational status of the slave device, called the Run Indicator Status. The SMART LCD will always set this byte to 0xFF (Powered On)
Host send to Smart LCD MODBUS frame
| Byte Seq | Content | No. of Byte | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x11 | |
| 2 | CRC | 2 | 0x0000 ... 0xFFFF | for error checking |
SMART LCD reply to host
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x11 | |
| 2 | Byte Count | 1 | 0x01 ... 0xF9 | byte count of all the following data except CRC |
| 3 | Slave ID | n | 0x00 ... 0xFF | in ASCII (e.g. SMART LCD V1.03) |
| 3 + n | Run Indicator Status | 1 | 0xFF | 0xFF for Powered On |
| 3 + n + 1 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host (in case of error found)
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Error Code | 1 | 0x91 | |
| 2 | Exception Code | 1 | 0x01, 0x04 | 01=Illegal Functrion; 04=SlaveDeviceFailure |
| 3 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
Example Frame (Ask for Slave ID of Smart LCD (device id = 01))
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 11 C0 2C | |
| 2 | RX | 01 11 11 48 4D 54 30 37 30 43 4E 2D 43 20 56 31 2E 30 33 FF 29 30 | Slave ID is “SMART LCD V1.03” |
TX=host to Smart LCD; RX=Smart LCD reply to host
Function Code 0x14 - "Read File Record"
This function code allows the host to read up to 128 Byte of a special file (USR.BIN) at once. The file USR.BIN may be placed together with the TML project data into the file system of the SMART LCD and it may contain any additional data used by the host. The file size of USR.BIN may be up to 256k Byte. It is organized into 2048 records. Each record consists of 128 Bytes.
Host send to Smart LCD MODBUS frame
| Byte Seq | Content | No. of Byte | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x14 | |
| 2 | Byte Count | 1 | 0x07 | byte count of all the following data except CRC |
| 3 | Reference Type | 1 | 0x06 | |
| 4 | File Number | 2 | 0x0001 | |
| 6 | Record Number | 2 | 0x0000 ... 0x07FF | Record Number of a one of the 2048 possible records within USR.BIN |
| 8 | Record Number | 2 | 0x0001 ... 0x003F | Record Number of a one of the 2048 possible records within USR.BIN |
| 10 | CRC | 2 | 0x0000 ... 0xFFFF | for error checking |
SMART LCD reply to host
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Function Code | 1 | 0x14 | |
| 2 | Reply Byte Count | 1 | 0x04 ... 0x82 | byte count of all the following data except CRC |
| 3 | Record Byte Count | n | 0x03 ... 0x81 | byte count of all the following data except CRC |
| 4 | Reference Type | 1 | 0x06 | 0xFF for Powered On |
| 5 | Data | 2 x n | 0x00 ... 0xFF | read from record with N 16 Bit words ranging from 1 to 64. |
| 5 + (2xN) | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
SMART LCD reply to host (in case of error found)
| Byte Seq | Content | Byte Count | Valid Range | note |
| 0 | MODBUS Device Address | 1 | 0x01 … 0xF7 | |
| 1 | Error Code | 1 | 0x94 | |
| 2 | Exception Code | 1 | 0x01 ... 0x04 | 01=Illegal Functrion; 02=IllegalDataAddress; 03=IllegalDataValue; 04=SlaveDeviceFailure |
| 3 | CRC | 2 | 0x0000 … 0xFFFF | for error checking |
Example Frame (Read File Record (device id = 01))
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 14 07 06 00 01 00 00 00 01 05 24 | read record file 00 01, record 00 00 and one 16bit value |
| 2 | RX | 01 14 04 03 06 02 01 D9 F1 | two bytes read back are 0x01, 0x02. |
TX=host to Smart LCD; RX=Smart LCD reply to host
Since the Modbus protocol organizes data in 16 Bit words the file size of USR.BIN should be even. In case the file size is uneven the SMART LCD would pad the last data word with an additional 0x00.
Modbus Error Codes Details
In case the SMART LCD receives a command with invalid data, invalid data count or an unsupported function code it will return an error code to the host (Returning the same function code with an additional Bit7 set). Additional it will transfer one of four possible exemption codes to indicate to the host what kind of error occurred
| Code | Exemption Name | Descriptions |
| 0x01 | ILLEGAL FUNCTION | The function code is not supported by the SMART LCD |
| 0x02 | ILLEGAL DATA ADDRESS | The data address by the SMART LCD falls into a undefined area. |
| 0x03 | ILLEGAL DATA VALUE | A data value received by the SMART LCD is not valid. It does not fit to the specific range requirements for the particular address. |
| 0x04 | SLAVE DEVICE FAILURE | An unrecoverable error occurred while the SMART LCD was attempting to perform the requested action. |
Color and Data Value Configuration
To access data the host should do following steps using the Modbus protocol:
- Use “Write Single Holding Register” with function code (0x06) to address 0xF001 and the data value of the desired memory page (0x01 … 0x05)
- Write to or read from the desired address within the selected page with: “Read Multiple Holding Registers” with function code (0x03) “Write Single Holding Register” with function code (0x06) "Write Multiple Holding Registers” with function code (0x10)
Each Modbus address holds 16 Bit of data. Therefore, it might be necessary to read multiple address locations:
- STR, up to 64 consecutive accesses might be necessary to read an entire string, One single access will manipulate two characters.
- N16, just one access is necessary to access one N16 variable. Multiple N16 variables might be accessed with a single Modbus command.
- N32, two accesses are necessary to access one N32 variable. Multiple N32 variables might be accessed with a single Modbus command.
- N64, four accesses are necessary to access one N64 variable. Multiple N64 variables might be accessed with a single Modbus command.
- Bitmap, one access can manipulate 16 pixels of a bitmap variable. Multiple pixels might be accessed with a single Modbus command.
- Graph, one access can manipulate one data point of a graph. Multiple data points might be accessed with a single Modbus command.
“Read Multiple Holding Registers” with function code (0x03) allows accessing of up to 125 consecutive address locations at once, with each location holding two Bytes of data.
“Write Multiple Holding Registers” with function code (0x10) allows accessing of up to 123 consecutive address locations at once, with each location holding two Bytes of data.
Access to the Special Function Registers, which are mapped to all pages, should not exceed the required Byte count assigned to each SFR. In such a case the SMART LCD would reply the host with an error message.
Note: Since the Modbus protocol uses a “Big-Endian” representation of data, the first Byte of each 16 Bit word represents the upper 8 Bit of the data word. In contrary the memory organization of the SMART LCD is “Little-Endian” requiring the host to swap upper and lower Byte of each transaction.
| R4 | R3 | R2 | R1 | R0 | G5 | G4 | G3 | G2 | G1 | G0 | B4 | B3 | B2 | B1 | B0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| High byte (MSB) | Low byte (LSB) | ||||||||||||||
| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
| D63...D56 | D55...D48 | D47...D40 | D39...D32 | D31...D24 | D23...D16 | D15...D8 | D7...D0 |
|---|---|---|---|---|---|---|---|
| Byte7 (MSB) | Byte0 (LSB) | ||||||
| D7...D0 | D7...D0 | D7...D0 | D7...D0 | D7...D0 | D7...D0 | D7...D0 | D7...D0 |
| D31...D24 | D23...D16 | D15...D8 | D7...D0 |
|---|---|---|---|
| Byte3 (MSB) | Byte0 (LSB) | ||
| D7...D0 | D7...D0 | D7...D0 | D7...D0 |
| D15...D8 | D7...D0 |
|---|---|
| High Byte (MSB) | Low Byte (LSB) |
| D7...D0 | D7...D0 |
| D7...D0 | D7...D0 |
|---|---|
| Strings are stored Byte by Byte starting from the lower address.
The terminator (0x00) is placed at the highest address. The start address of a string is always even and aligned to a 128 Byte boundary. | |
Special Function Registers (SFR)
SFR Types
The SMART LCD provides a set of SFR, which allow the host to:
- Select a Memory Page to be able to access different kinds of VPs
- Issue graphical drawing commands (Draw Pixels, Lines, Rectangles)
- Show text or specific icons on the GUI
- Read or change current page shown on the GUI
- Set the Type
- Control Buzzer, Backlight and Screensaver
- Read and Set the Real Time Clock (RTC)
- Select a GUI project (if multiple GUI projects are present)
- Restart a GUI project
- Unlock the File System for access via USB
- Format the File System
- Change the RS485 communication Baud Rate
- Start a System Self-Test or the Touch Panel Calibration Routine
| SFR Type | Descriptions |
| Command SFR | When written with a command code, it may trigger a special command using the values stored in one or multiple other SFRs |
| MODBUS PAGE SFR | When written it will select the specific page. For any subsequent memory access within the Modbus address range of 0x0000 … 0xEFFF. |
| Graphics SFR | For graphical commands issued to the Command Register. |
| Project Control SFR | For GUI project control commands issued to the Command Register |
| Peripheral Control SFR | For commands issued to the Command Register, which control peripheral components of the SMART LCD, such as the Buzzer, the Backlight and the RTC. |
| Timer Control SFR | For commands issued to the Command Register, which control the 8 Timers of the SMART LCD |
SFR List
| SFR Type | SFR Address | R/W | Size | SFR Name | Default Value |
| Command SFR (*1) | 0xF000 | R/W | 2Bytes | Command | 0x0000 (*2) |
| MODBUS PAGE SFR | 0xF001 | R/W | 2Bytes | Modbus VP Page | 0x0004 |
| Project Control SFRs | 0xF00A | R/W | 2 Bytes | Project ID | 0x0000 |
| 0xF200 | W | 128Bytes | USB Password Buffer | 0x0000 | |
| 0xF300 | R | 4Bytes | TP_XY_Position | 0x0000 | |
| Peripheral Control SFRs | 0xF400 | R/W | 2Bytes | Page ID | Project Value |
| 0xF401 | R | 2Bytes | Modbus Slave Address | Project Value | |
| 0xF402 | R/W | 2Bytes | Baud rate | Project Value | |
| 0xF403 | R/W | 2Bytes | Backlight Level | Project Value | |
| 0xF404 | R/W | 2Bytes | Screen Saver Backlight Level | Project Value | |
| 0xF405 | R/W | 2Bytes | Screen Saver Time | Project Value | |
| 0xF406 | R/W | 2Bytes | Buzzer Key Click Time | Project Value | |
| 0xF407 | R/W | 2Bytes | cursor type | Project Value | |
| 0xF408 | R/W | 6Bytes | RTC_NOW in format (YY-MM-DD HH:mm:ss) | 0x000101000000 (2000-01-01 00:00:00) | |
| 0xF40B | R/W | 2Bytes | Buzzer Sound Time | click time | |
| 0xF40C | R/W | 2Bytes | Enable Self-Test | 0x0000 | |
| 0xF40D | R/W | 2Bytes | Enable Format | 0x0000 | |
| 0xF40E | R/W | 2Bytes | Enable Touch Panel Calibration | 0x0000 | |
| System Control SFRs | 0xF410 | R/W | 2Bytes | Timer_ctrl 0 | 0x0000 |
| 0xF411 | R/W | 2Bytes | Timer_ctrl 1 | 0x0000 | |
| 0xF412 | R/W | 2Bytes | Timer_ctrl 2 | 0x0000 | |
| 0xF413 | R/W | 2Bytes | Timer_ctrl 3 | 0x0000 | |
| 0xF414 | R/W | 2Bytes | Timer_ctrl 4 | 0x0000 | |
| 0xF415 | R/W | 2Bytes | Timer_ctrl 5 | 0x0000 | |
| 0xF416 | R/W | 2Bytes | Timer_ctrl 6 | 0x0000 | |
| 0xF417 | R/W | 2Bytes | Timer_ctrl 7 | 0x0000 | |
| 0xF420 | R/W | 2Bytes | Screen Saver Time1 | Project Value | |
| 0xF421 | R/W | 2Bytes | Screen Saver Page ID | Project Value | |
| 0xF422 | R/W | 2Bytes | Codepage | Project Value | |
| 0xF423 | R/W | 2Bytes | Country code | Project Value | |
| 0xF424 | R/W | 2Bytes | PinYin EN/CN Switch | 0:CN 1: EN | |
| 0xF425 | R | 2Bytes | PIP State | (1: PIP MODE) | |
| 0xF426 | R | 2Bytes | Touch Panel State | (1: Press Down; 0: Release) | |
| 0xF427 | R | 2Bytes | Touch Key ID | 0xFFFF | |
| 0xF428 | R | 2Bytes | Current Backlight Level | Project Value |
note:
*1. The Host may issue a command to Command SFR (address 0xF000). The SMART LCD will interpret the command and execute it.
*2. When 0x0000 read from the Command SFR (address 0xF000) it means that the previous command was executed and the SMART LCD is ready for a next command.
SFR Details
Timers Control SFR
The SMART LCD provide eight 32-Bit timers, which can be used by GUI and host. The timers located within the VP_N32 area. Each Timer has got a Timer Count Register and a corresponding SFR, Timer Control Register for starting, stopping and setting the counting direction of the timers.
All Timers are counting in 1s steps.
| n | Timer n Control SFR Address | Descriptions | Timer n MODBUS Address | Note |
| 0 | 0xF410 |
|
1:0x7FF0 | Timer n are located in MODBUS PAGE=1
it could be access via UI in VP_N32 area |
| 1 | 0xF411 | 1:0x7FF2 | ||
| 2 | 0xF412 | 1:0x7FF4 | ||
| 3 | 0xF413 | 1:0x7FF6 | ||
| 4 | 0xF414 | 1:0x7FF8 | ||
| 5 | 0xF415 | 1:0x7FFA | ||
| 6 | 0xF416 | 1:0x7FFC | ||
| 7 | 0xF417 | 1:0x7FFE |
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 10 00 03 FA 3E | Set the Timer 0 Control SFR of Timer 0 as count up mode |
| 2 | RX | 01 06 F4 10 00 03 FA 3E | |
| 3 | TX | 01 06 F0 01 00 01 2A CA | Select MODBUS PAGE1 |
| 4 | RX | 01 06 F0 01 00 01 2A CA | |
| 5 | TX | 01 03 7F F0 00 02 DD EC | Read the Timer 0 |
| 6 | RX | 01 03 04 00 63 00 00 0A 2D | Report the Timer register value back to the host |
Touch Panel XY Position & State SFRs
The SMART LCD allows the host to read its current touch panel pen position. For this purpose, the host may poll via Modbus the 4 Byte TP_XY_Position Register, which is located in the Special Function Register Area.
| SFR | SFR Address | Descriptions |
| TP position X | 0xF300 |
|
| TP position Y | 0xF301 |
|
| TP State | 0xF426 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 03 F3 00 00 02 F7 4F | Read TP position SFR (X&Y) |
| 2 | RX | 01 03 04 01 7E 01 54 9B B8 | Report back to host X=017E; Y=0154 |
Screen Saver Time1 SFR
The SMART LCD allows the host to modify the screen saver delay time. The register value can be changed under delay 2 in project settings
| SFR | SFR Address | Descriptions |
| Screen Saver Time1 | 0xF420 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 20 00 05 7A 33 | Set the Screen Saver Time to 0005 seconds |
| 2 | RX | RX: 01 06 F4 20 00 05 7A 33 |
Screen Saver Page Page Jump ID SFR
The SMART LCD allows the host to change the page ID of the screen saver in run time which normally assigned in the page jump option in project settings.
| SFR | SFR Address | Descriptions |
| Screen Saver Page JUMP ID | 0xF421 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 21 00 01 2A 30 | change the screen saver page jump ID to 0001 |
| 2 | RX | 01 06 F4 21 00 01 2A 30 |
Code page SFR
The SMART LCD allows the host to modify the project code page. It alters the code page preset in project settings.
| SFR | SFR Address | Descriptions |
| Code Page SFR | 0xF422 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 22 00 01 DA 30 | change the Code page to 0001 (437(OEM United States)) |
| 2 | RX | 01 06 F4 22 00 01 DA 30 |
Country Code SFR
The SMART LCD allows the host to modify the country code. It alters the country code preset in project settings
| SFR | SFR Address | Descriptions |
| Country Code SFR | 0xF423 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 22 00 01 DA 30 | change the Country Code to 0001 (USA) |
| 2 | RX | 01 06 F4 22 00 01 DA 30 |
PinYin SFR
The SMART LCD allows host to modify the PIP PinYin keyboard input method
| SFR | SFR Address | Descriptions |
| PinYin SFR | 0xF424 |
|
Example Frame (device id = 01)
| Seq | dir | MODBUS Communication Frame | Descriptions |
| 1 | TX | 01 06 F4 24 00 00 FB F1 | set the PinYin Keyboard as Chines input method |
| 2 | RX | 01 06 F4 24 00 00 FB F1 |
Command SFR Commands
Command List
| Command Code | Command Name | Descriptions |
| 0x0070 | disp_page | Display a pre-stored TML file (page) |
| 0x005F | backlight_ctrl | Set backlight brightness (64 levels) |
| 0x00A0 | screen_saver_on | Enable Screen Saver |
| 0x00A1 | screen_saver_off | Disable Screen Saver |
| 0x0079 | buzzer_ctrl | Set Buzzer Key Click Parameters |
| 0x0080 | buzzer_on | Sound Buzzer once |
| 0x009C | RTC_set | Set the RTC |
| 0x00E0 | set_baudrate | Set RS485 Baud Rate |
| 0x00E1 | sel_project | Set active project folder |
| 0x00E2 | u_drv_format | Format File System |
| 0x00E3 | u_drv_unlock | Unlock File System for USB Access with pre-stored password |
| 0x0088 | self_test | Starts Self-Test |
| 0x0000 | NOP | No Operation / No Command to execute |

