QR code control and RTC control (Modbus configuration control tutorial 8)

freeFree Technical Resource

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

QR code control and RTC control (Modbus configuration control tutorial 8)

1.8 QR Code Control and RTC Control

This section mainly introduces the common applications of QR code controls and RTC controls in the Modbus protocol. The QR code control only supports binding variables in [Tools - Protocols and Variables - Logic Processing]

This section uses the screen as the master station and creates one save register for the application of QR Code Control, as shown below

QR code control and RTC control (Modbus configuration control tutorial 8)Figure

Routine download link:"Modbus Tutorial 8 - QR Code Control and RTC Control V1.0"

For protocol activation and variable-related instructions, refer to the link: "Modbus Basic Parameter Description"

1.8.1 QR Code Control

The [QR Code] screen primarily provides an example of how to use the QR code control. The QR code control can display a set string in the form of a QR code, which can be recognized by some scanning devices.

Note: The basic series of serial port screens require special firmware support to use the QR Code Control

Screen/Logic Configuration

Add a QR Code Control (Control ID: 1) to the screen, and configure the control properties as follows:

QR code control and RTC control (Modbus configuration control tutorial 8)Figure1

Add a variable in the "Protocol and Variable Settings" section, with the variable type set to "String" and a string length of 32, as shown below

QR code control and RTC control (Modbus configuration control tutorial 8)Figure

Add a logic processing in the "Protocol and Variable Settings" with the purpose of "Control Binding" and the screen set to "1"; the control is "1"; the variable is "QR Code", as shown below

QR code control and RTC control (Modbus configuration control tutorial 8)Figure2

Run Preview

At this point, compile the project and run the virtual serial port screen. The QR code control displays the string "VisualTFT" in the form of a QR code. When connected to the Modbus Slave software, the QR code control displays the corresponding string.

QR code control and RTC control (Modbus configuration control tutorial 8)Figure3

1.8.2 RTC Control

The "RTC Control" screen mainly provides an example of how to use the RTC control. When the screen acts as the master, it modifies the RTC time of the slave; the slave creates a fixed address holding register to store time variables, with seven consecutive holding registers for year, month, week, day, hour, minute, and second. The screen periodically writes the latest time to the slave register through the 0x10 command

Screen/Logic Configuration

Add an RTC control (control ID: 1) to the screen as shown below:

QR code control and RTC control (Modbus configuration control tutorial 8)Figure4

Add a logic processing in the "Protocol and Variable Settings" with the purpose of "Write Time"; the slave address is "1"; the register is "50" (decimal); the cycle is "10" (unit: seconds), as shown below:

QR code control and RTC control (Modbus configuration control tutorial 8)Figure5

Run Preview

At this point, compile the project and run the virtual serial port screen. When connected to the Modbus Slave software, the master sends the RTC time to the slave every 10 seconds.

QR code control and RTC control (Modbus configuration control tutorial 8)Figure6
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 *.