Basic parameter description (Modbus configuration control tutorial 1)

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

Basic parameter description (Modbus configuration control tutorial 1)

Application of Modbus Protocol. This section mainly explains the following parts:

  1. Enabling the Protocol,
  2. Configuring the Master and Slave,
  3. Creating Variables,
  4. Relationship between Variable Address and Value,

1.1 Enabling the Protocol. The Modbus protocol configuration interface is located in the menu bar of the VisualTFT host computer, under "Tools" → "Protocol and Variable Settings…". Click on the file path on the left, and in the protocol settings column on the right, set the protocol type. If you select Modbus Master, enable the protocol as shown below

The configuration interface for the Modbus protocol can be found on the menu bar of the VisualTFT host computer under "Tools" → "Protocol and Variable Settings…". Click on the file path on the left, and in the protocol settings section on the right, set the protocol type. If you choose Modbus master, enable the protocol as shown below

. After enabling the Modbus protocol, the control can display "Associated Variables" on the configuration interface.

Basic parameter description (Modbus configuration control tutorial 1)Figure

1.2 Configuring the Master and Slave.

Master Mode.

Configuration of the Modbus Master, with parameters shown below

Basic parameter description (Modbus configuration control tutorial 1)Figure1
  1. . Enabling the Protocol: The Modbus protocol is only supported when the protocol is enabled
  2. Protocol Type: Select Modbus Master
  3. Polling Cycle: Invalid parameter, do not set
  4. Polling Delay: When the screen acts as the master, the time to wait for sending the next request command after sending a request command and receiving a response from the screen
  5. Response Timeout: When the screen acts as the master, the maximum delay allowed for slaves, default is 100 milliseconds
  6. Continuous Reading: Set the maximum number of continuous address variables to read
  7. Optimized Reading: After enabling optimized reading, only variables related to the current screen are read
  8. Storage Settings: After enabling storage, Flash addresses 0~2048, approximately 2K, are used to store all Modbus variables. Other storage should avoid this address!!! Do Not Store: Do not store, variables will return to default values after power-off and restart. Store All: Not recommended, as frequent storage can lead to an increase in bad blocks in FLASH. Store Specified Variables: Recommended for use, generally used to store system configuration parameters that rarely change
  9. Storage Marker: Identify the data version marker stored in the screen. When the storage data format changes, it is generally necessary to manually modify this storage marker value
Basic parameter description (Modbus configuration control tutorial 1)Figure2

Slave Mode

  1. Enable Protocol: The protocol needs to be enabled to support the Modbus protocol
  2. Protocol Type: Select Modbus Slave
  3. Slave Address: Default is 1
  4. Storage Settings: After enabling storage, Flash addresses 0~2048, approximately 2K, are reserved for Modbus variable storage. Other storage should avoid these addresses! Do Not Store: Do not store. After power-off and restart, variables will return to their default values. Store All: Not recommended, as frequent storage can lead to an increase in FLASH bad blocks. Store Specified Variables: Recommended for use, generally used to store system configuration parameters that rarely change.
  5. Storage Mark: Identify the data version mark stored on the screen. When the storage data format changes, the storage mark value generally needs to be manually modified.
Basic parameter description (Modbus configuration control tutorial 1)Figure3

1.3 Create Variable

Click "Variable Definition", then click "Add" to add a variable, as shown below.

Basic parameter description (Modbus configuration control tutorial 1)Figure4

Variable Definition

Detailed variable analysis is as follows:

Basic parameter description (Modbus configuration control tutorial 1)Figure5
  1. Name: The default variable names are "Variable1, Variable2, Variable3...", which can be defined with meaningful names such as: unit status; if the variable needs to be bit-wise interpreted, the default names are "Field1, Field2, Field3...", which can be defined with meaningful names such as: on/off, run/stop.
  2. Format: Supports short integer, long integer, single-precision floating-point number, and string.
  3. Sign: Can be set to unsigned or signed.
  4. Read-Write Settings: Set the read-write permissions for the variable, supporting read-write, read-only, and write-only.
  5. Default Value: The default display value.
  6. Numerical Conversion: Convert the variable, for example: actual value = original value * scaling + translation
  7. Display format: Set the number of digits for integers and decimals
  8. Array type: Enable array type, starting from the address of this variable, operate on consecutive N registers
  9. Storage: Enable storage settings when configuring Modbus master/slave protocol. If storage is selected here, data can be saved during power loss

Parameters

Detailed parameter setting analysis is shown below

Basic parameter description (Modbus configuration control tutorial 1)Figure6
  1. Variable type: Coil, discrete input, hold register, input register, memory variable, system variable
  2. Slave address: Only required when the screen acts as a master
  3. Variable address: The address of the variable (or register), entered in hexadecimal
  4. Initialize slave: When the screen acts as a master, after power-on, write the value of the variable to the slave device
  5. Reset to zero on read failure: When the screen acts as a master, if the variable fails to be read, the value of the variable is reset to zero

1.4 Relationship between variable address and value

Coil/discrete data

Create a coil or discrete input register with a variable format of short integer type, which contains 16 coils (from top to bottom, bit0...bit15). Assuming the variable address is 0x0000, the variable includes addresses ranging from 0x0000 to 0x000F. Each bit corresponds to one coil, as shown below.

Basic parameter description (Modbus configuration control tutorial 1)Figure7

String type

Create a save register with a variable format of string type (default 32 characters). Assuming the variable address is 0x0000, this string corresponds to variables within the address range of 0x0000 to 0x000F, with one address corresponding to two characters.

Basic parameter description (Modbus configuration control tutorial 1)Figure8

Assuming the save register at address 0x0000 has a value of 'abcdefghij', as shown below.

Basic parameter description (Modbus configuration control tutorial 1)Figure9

Array

Create an input register of array type (default array size is 10, with subscripts starting from 0). Assuming the variable address is 0x0000, this variable represents 10 consecutive variables starting from 0x0000, with each array subscript corresponding to one variable.

Basic parameter description (Modbus configuration control tutorial 1)Figure10

Assuming a variable is created as an input register of type Voltage, with an array type and size of 10, the correspondence is as follows

Basic parameter description (Modbus configuration control tutorial 1)Figure11
Related Tags
Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.