EN

Intelligent TFT LCD Module and User MCU (Document Operation Methods Related)

Three Kinds of Document Operation Methods Related to Intelligent TFT LCD Module and User MCU

 

In order to optimize the system, to reduce the number of external USB flash disk interface of the user system, or to deal with the application occasions where user MCU does not have the USB flash disk interface, there might be the application requirements for the user MCU to access (read and write) the external USB flash disk of the Intelligent TFT LCD Module, or to write the files of the user MCU external USB flash disk into the Intelligent TFT LCD Module.

 

. User MCU reads the files in the external USB Flash Disk of Intelligent TFT LCD Module

 

Typical application: The user MCU is required to update the system program or configuration data of the MCU by connecting the external USB flash disk with Intelligent TFT LCD Module. The user data reading function provided by the Intelligent TFT LCD Module can perfectly implement the application above, as shown in the following figure.

 

 

3.5 User data files

User data files must be named as "*. bin" with the file name number from 0 to 255 (file names can not be use 22 and 23 because of the system occupancy).

 

3.5.1 Inputting user data files through USB flash disk

The user data file "*. bin" must be manually copied to the folder "VT_SET". When project files are downloaded through USB flash disk, user data files are automatically inputted into the HMI.

 

3.5.2 Reading user data files through the serial port.

Through the register 0x40 -- 0x49, the specified location data in user data files can be read out and loaded into the variable memory, as shown in Table 3-5. If the user MCU is needed, it can be read from the variable memory by the command 0x83.

 

Table 3-5 User Data Files Loaded into Variable Space Registers

Register Address

Definition

R/W

Byte Length

Descriptions

0x40-0x49

En_Lib_OP

R/W

1

0x5A indicates the application of loading user data file into the variable space and it is cleared after Intelligent TFT LCD Module operation. The reading operation is implemented once per Intelligent TFT LCD Module cycle.

Lib_OP_Mode

W

1

Fixed as 0xA0

Lib_ID

W

1

The designated user data file name number being 0x00 to 0xff

Lib_Address

W

3

The first (byte) address of the designated data operation0x00:00:00-0x01:FF:FF

VP

W

2

The first (byte) address of the data operation in designated variable space, 0x0000-0xFFFF

OP_Length

W

2

The data (byte)length of the operation0x0000-0xFFFF

 

 

For example, start to read 4KW (0x1000) data from the address 0x0000 of "80.bin" user data file to the starting position of the variable memory 0x1000 unit, and the command will be sent through the serial port as follow:

 

A5 5A 0C 80 40 5A A050 00 00 00 10 00 10 00

 

It takes about ten milliseconds to read user data files. Pay attention to inserting delay when user MCU sends continuous commands.

 

 

Firstly, the target file is named as “* .BIN”, and stored in the folder “VT _ SET” of the USB flash disk, and then downloaded  into the Intelligent TFT LCD Module;

Use the register 0x40-0x49 to transfer the target file into the variable memory;

Finally, read the variable memory through 83 commands, and read  the target file into MCU.

Note: because of  the limitation of length of the command 83 (256 bytes) and the length of variable memory (128K bytes), multiple transfers may be required if the file is too large.

 

Ⅱ. User MCU stores the target data into the USB flash disk outside the Intelligent TFT LCD Module.

 

Typical applications: User MCU will export historical data through the external USB flash disk connected with Intelligent TFT LCD Module. The database reading and writing function provided by the Intelligent TFT LCD Module can complete the application above, as shown in the figure below. The database reading and writing operation  is similar to those described above for user data files.

 

 

 

3.6 Database reading and writing

 

 

The user database file is named as "UserDb. bin" which has the function of storing user data when power is down. The "UserDb.bin" folder, same with the folder "VT_SET", is also stored under the "Intelligent TFT LCD Module_USER" disc character. The size of database files is allowed to be related to user engineering files. The customer can view the remaining space of "Intelligent TFT LCD Module_USER" to determine the size of the available database files.

 

3.6.1 Read and write database through serial port

 

User MCU accesses database with serial port, which needs to be implemented by the variable memory. Through the register 0x56 to 0x5F, the data of the specified location of the variable memory can be written into FLASH, and the data of the designated location in FLASH can be read and loaded into the variable memory, as shown  in Table 3-6.

 

Table 3-6 The Register of Database Reading and Writing

 

Register Address

Definition

R/W

Byte Length

Descriptions

0x56-0x5F

En_DBL_OP

R/W

1

0x5A indicates that the user applies for database operation and clears up after Intelligent TFT LCD Module operation.

The database reading and writing operations are implemented once per Intelligent TFT LCD Module cycle.

OP_Mode

W

1

0x50 represents writing variable memory spatial data into database space

0xA0 represents reading out data from database space and loading it into variable memory space

DBL_Address

W

4

The first (byte) address of database (The database and user’s folder “VT_SET” are all stored under Intelligent TFT LCD Module_USER disk character)

VP

W

2

The first (byte) address of the variable space, 0x0000-0xFFFF

OP_Length

W

2

The length(byte) of the data operation, 0x0000-0xFFFF

 

For example, write the data of variable memory address 0000-0100 into the database address 0000 0000-0000 0100. The length of data is 256W (0x01 00), and the command sent by serial port is: A5 5A 0C 80 56 5A A0 00 00 00 00 00 00 01 00

 

 

 

Read out the data of database address 0000 000-0000 0100 and store it  into variable memory address 0000-0100. The length of data is 256W (0x01 00). The command sent by serial port is: A5 5A 0C 80 56 5A A0 00 00 00 00 00 00 01 00

 

If the user MCU needs to use the data in the database, firstly read out the database and load it into the variable memory, and then read out the data from the variable memory by the command 0x83, and vice versa.

 

3.6.2 Export database through USB flash disk

 

Inserting the USB flash disk (in the format of Fat32) into the Intelligent TFT LCD Module when it works, the Intelligent TFT LCD Module will automatically copy the database file "UserDb. bin" under the USB flash disk root directory. Under the default state of factory, there is no database file "UserDb.bin" in the HMI. Then the database file "UserDb.bin" will be generated in the HMI only after the database writing operation  is performed through the register 0x56-0x5F.

 

The database is stored in FLASH memory, so it has the power-down preservation function. Intelligent TFT LCD Module uses NAND FLASH memory, which has the advantages of large

 

capacity, but also has two disadvantages: one is that the number of writes is less with 100,000 times of the theoretical writes; the other is that only block writes are supported which is quite complex. Therefore, it is not recommended to use the database as a storage medium for important data, nor to write frequent modifications to the database. In this kind of application, it is suggested that a 24-series SPI EEPROM memory or 25-series SPI NOR FLASH memory can be extended to the user's MCU.

 

In addition, it takes about 10 milliseconds to read and write the database. Pay attention to inserting delay when user MCU sends continuous commands.

 

 

. User MCU writes target file into Intelligent TFT LCD Module through the serial port

 

Typical application: Update the start-up logo or other files of the Intelligent TFT LCD Module through the external TF card / USB flash disk on the main board of the user MCU. The above application can be implemented through that the serial port provided by the Intelligent TFT LCD Module downloads the designated file command 0x85 01, as shown in the figure below.

 

 

Table 2-13  Download the designated file 0x85 01 through serial port

 

Definition

Header

Length

Command

Data

Descriptions

Length

(byte)

2

1

2

(85 01)

5a a5 + filesize(4bytes) + filename(ASCII)

 

Filesize (byte);

Filename, complete file name with extension, such as file name "1.jpg". The ASCII code sent should be 312e 6a 70 67.

-

-

-

Please

Tx file !

 

After receiving the command 85 01correctly,the HMI will return prompt message (without frame header)

 

-

-

-

file

 

After the MCU receives the  return prompt, start to send the file (without frame header).

 

-

-

-

One file Saved OK !

 

After the HMI receives the file completely and stores it, it will return the prompt message (without frame header).

 

 

To download designated files by the command 0x85 01 5a a5, the customers can download various files to the HMI through the serial port, including pictures, fonts, voice, video and other documents. Updating the display contents remotely can be implemented through the function if the client main board can connect to the network. And the HMI firmware can not be upgraded through this command. When connecting with USB cables, downloading files through serial ports might lead to file errors.