Mode switching method, device and serial port screen

By using Lua programming technology to obtain control parameters and encapsulate status variables on the serial port screen, the problem of cumbersome operation during the switch of the serial port screen is solved, and a more efficient mode switching and operation experience is achieved.

CN118796733BActive Publication Date: 2025-03-21GUANGZHOU DCOLOUR OPTOELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410796629.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2025-03-21
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

The existing serial port screen needs to repeatedly enter or select parameter values ​​during mode switching, resulting in cumbersome operation.

Method used

Lua programming technology is used to obtain control parameters, judge the mode to be cut corresponding to the control parameters, and use the Convert function to encapsulate the control parameters in the corresponding state variable of the Select control. The state variable is used to update the Select control, and finally store the state variable in the corresponding Flash address, switch the mode and display the visual parameters in the updated Flash address.

Benefits of technology

By obtaining control parameters and completing the encapsulation and update of state variables at one time, the mode switching process is simplified, the operation efficiency is improved, and the possibility of user operation errors is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796733B_ABST
    Figure CN118796733B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a mode switching method, device and serial port screen, the method comprising: obtaining control parameters based on Lua programming technology; judging the to-be-cut mode corresponding to the control parameters; according to the to-be-cut mode, using the Convert function to encapsulate the control parameters in the corresponding state variables of the Select control, the state variables are used to update the Select control, the Select control includes two or more state address groups with different priority levels, each state address group includes two or more state address blocks with different priority levels, the state variables are stored in the state address blocks, and the mode selection corresponds to the state address blocks one by one; storing the state variables in the corresponding Flash address; switching the mode according to the to-be-cut mode and the state variables and displaying the visual parameters in the updated Flash address. It can be used to solve the problem that the current serial port screen needs to repeatedly input or select parameter values ​​when switching modes, resulting in cumbersome operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent industrial control technology, and in particular to a mode switching method and a serial port screen. Background Art

[0002] In the field of modern industrial control, serial port screens, as a common human-computer interaction device, are widely used in various types of automation equipment and instruments.

[0003] However, traditional serial port displays present several issues with control state management and mode switching, such as cumbersome operation and inconvenient state switching, resulting in low user efficiency and a high risk of operational errors. Specifically, user operation is cumbersome, requiring multiple taps on the screen to switch between modes or adjust control states, leading to low efficiency. Furthermore, control state management and storage are inflexible, requiring users to repeatedly set parameters, increasing operational complexity and the risk of error. Therefore, existing serial port display solutions have at least the following disadvantages: Traditional serial port displays have weak logic, require enumeration, require large Flash memory, and are costly; Android / Linux displays have high costs; and users may need to repeatedly enter or select parameter values ​​when setting parameters in existing serial port display technologies, which is cumbersome. This tedious parameter setting process can increase the user's operational burden and the potential for error. Given the cumbersome operation of current serial port displays, which require repeated input or selection of parameter values ​​when switching between modes, further research on mode switching methods is necessary. Summary of the Invention

[0004] The embodiments of the present invention provide a mode switching method, device and serial port screen to solve the problem that the serial port screen needs to repeatedly input or select parameter values ​​when switching modes, resulting in cumbersome operations.

[0005] In one aspect, the present invention provides a mode switching method, which is applied to a serial port screen, comprising:

[0006] Get control parameters based on Lua programming technology;

[0007] Determine the waiting mode corresponding to the control parameters;

[0008] According to the mode to be switched, the Convert function is used to encapsulate the control parameters into the corresponding state variables of the Select control. The state variables are used to update the Select control. The Select control includes two or more state address groups with different priority levels. Each state address group includes two or more state address blocks with different priority levels. The state variables are stored in the state address blocks. The mode selection corresponds to the state address block one by one.

[0009] Store the state variables in the corresponding Flash address;

[0010] The mode is switched according to the mode to be switched and the state variables, and the visualization parameters in the updated Flash address are displayed.

[0011] Furthermore, after the step of storing the state variable in the corresponding Flash address, the method further includes:

[0012] The assignment displays the result of storing the state variable in the corresponding Flash address.

[0013] Furthermore, the control parameters include Parameter1, Parameter2 and Parameter3.

[0014] Furthermore, the mode to be switched corresponds to the data in the Schedule table in the Select control, and the step of determining the mode to be switched corresponding to the control parameter includes:

[0015] The waiting mode is selected first according to the value of Parameter1;

[0016] When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2;

[0017] When the values ​​of Parameter1 and Parameter2 are both 0, the waiting mode is selected according to the value of Parameter3.

[0018] Furthermore, according to the mode to be switched, the step of using the Convert function to encapsulate the control parameters into the corresponding state variables of the Select control includes:

[0019] When the value of Parameter1 is not 0, encapsulate the control parameter in State1 in the Schedule table;

[0020] When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameters are encapsulated in State2 in the Schedule table;

[0021] When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table.

[0022] In order to solve the problem that the current serial port screen needs to repeatedly input or select parameter values ​​when switching modes, resulting in cumbersome operations, the present invention discloses a mode switching method, which is applied to the serial port screen, including: obtaining control parameters based on Lua programming technology; judging the mode to be switched corresponding to the control parameters; according to the mode to be switched, using the Convert function to encapsulate the control parameters in the corresponding state variables of the Select control, the state variables are used to update the Select control, the Select control includes two or more state address groups with different priority levels, each state address group includes two or more state address blocks with different priority levels, the state variables are stored in the state address blocks, and the mode selection corresponds to the state address block one by one; the state variables are stored in the corresponding Flash address; the mode is switched according to the mode to be switched and the state variables and the visual parameters in the updated Flash address are displayed.

[0023] Compared with the prior art, the present invention has the following advantages:

[0024] Through Lua programming technology, the control parameters are obtained at one time, the corresponding mode to be switched and the state variables are encapsulated and updated in Flash, and finally the mode is switched and the corresponding Flash is displayed. This solves the problem that the current serial port screen needs to repeatedly enter or select parameter values ​​when switching modes, resulting in cumbersome operations.

[0025] In another aspect, the present invention provides a mode switching device, comprising:

[0026] Acquisition module, used to obtain control parameters based on Lua programming technology;

[0027] A judgment module, used to judge the to-be-switched mode corresponding to the control parameters;

[0028] The encapsulation module is used to encapsulate the control parameters into the corresponding state variables of the Select control using the Convert function according to the mode to be switched. The state variables are used to update the Select control. The Select control includes two or more state address groups with different priority levels. Each state address group includes two or more state address blocks with different priority levels. The state variables are stored in the state address blocks. The mode selection corresponds to the state address block one by one.

[0029] A storage module is used to store state variables in corresponding Flash addresses;

[0030] The switching module is used to switch the mode according to the mode to be switched and the state variable and display the visualization parameters in the updated Flash address.

[0031] Furthermore, it also includes:

[0032] The display module is used to assign the display state variable to the result stored in the corresponding Flash address.

[0033] Furthermore, the control parameters include Parameter1, Parameter2 and Parameter3.

[0034] Furthermore, the judgment module is also used to:

[0035] The waiting mode is selected first according to the value of Parameter1;

[0036] When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2;

[0037] When the values ​​of Parameter1 and Parameter2 are both 0, the waiting mode is selected according to the value of Parameter3;

[0038] The package module is also used to:

[0039] When the value of Parameter1 is not 0, encapsulate the control parameter in State1 in the Schedule table;

[0040] When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameters are encapsulated in State2 in the Schedule table;

[0041] When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table.

[0042] On the other hand, the present invention provides a serial port screen, comprising a screen and the above-mentioned mode switching device. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0044] Figure 1 FIG. 4 is a flow chart of a mode switching method according to an embodiment of the present invention.

[0045] Figure 2 FIG. 4 is a schematic diagram of a mode switching device according to another embodiment of the present invention. DETAILED DESCRIPTION

[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0047] See Figure 1 , a mode switching method according to an embodiment of the present invention comprises the following steps:

[0048] Step 11: Obtain control parameters based on Lua programming technology.

[0049] In the embodiment of the present invention, the control parameters include multiple values ​​such as Parameter1, Parameter2 and Parameter3.

[0050] Step 12: Determine the mode to be switched corresponding to the control parameter.

[0051] In this step, the mode to be switched corresponds to the data in the Schedule table in the Select control. Step 12 may specifically include:

[0052] The waiting mode is selected first according to the value of Parameter1;

[0053] When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2;

[0054] When the values ​​of Parameter1 and Parameter2 are both 0, the waiting mode is selected according to the value of Parameter3.

[0055] Step 13. According to the mode to be switched, use the Convert function to encapsulate the control parameters in the corresponding state variables of the Select control. The state variables are used to update the Select control. The Select control includes two or more state address groups with different priority levels. Each state address group includes two or more state address blocks with different priority levels. The state variables are stored in the state address blocks, and the mode selection corresponds one-to-one to the state address block.

[0056] In this embodiment of the present invention, step 13 may specifically include:

[0057] When the value of Parameter1 is not 0, the control parameter is encapsulated in State1 in the Schedule table; that is, Parameter1 corresponds to the state address group with a high priority;

[0058] When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameters are encapsulated in State2 in the Schedule table; Parameter2 corresponds to the state address group with medium priority;

[0059] When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table; Parameter3 corresponds to the state address group with a low priority.

[0060] Step 14: Store the state variable into the corresponding Flash address.

[0061] In the embodiment of the present invention, after step 14, the method further includes:

[0062] The assignment displays the result of storing the state variable in the corresponding Flash address. That is, the data in the Select table will be stored in the corresponding Flash address, and the assignment display will be displayed when the data is read.

[0063] Step 15: Switch the mode according to the mode to be switched and the state variable and display the visualization parameters in the updated Flash address.

[0064] In this step, by switching the corresponding mode, the data stored in the flash can be displayed, or the data can be stored in the corresponding flash.

[0065] The existing serial port screen generally controls the status switching of the serial port screen through the upper computer development software or the single-chip microcomputer MCU. However, after downloading the project through the development software, it is difficult to affect the controls of the serial port screen, and the control status cannot be adjusted in real time. And by sending serial port instructions to set the serial port screen status through the single-chip microcomputer MCU, it is impossible to switch the status of all controls at the same time. The embodiment of the present invention obtains the control parameters at one time through Lua programming technology, completes the corresponding judgment of the mode to be cut and the encapsulation of the state variables and the update in Flash, and finally switches the mode and displays the corresponding Flash, which solves the problem that the current serial port screen needs to repeatedly enter or select parameter values ​​when switching modes, resulting in cumbersome operations.

[0066] The embodiment of the present invention uses a Lua script control operating system, so users can implement complex logical operations, automatically sort according to the rules, reduce the logical operations of the user's mainboard, and improve the operating efficiency and user experience of the serial screen. The control operating system realizes flexible management of the control state and rapid switching of modes through functions such as initialization function, timing callback function and timer timeout callback function, so that users can easily operate and control the serial screen device. The advantage of this technology is that it simplifies the serial screen operation process and enhances user interactivity. The expected effect is to improve system stability, reduce operating errors, and bring a more intelligent and convenient operating experience to the field of industrial control. In the future, the control operating system is expected to be widely used in industrial automation, intelligent instrumentation and other fields, and play an important role in improving industrial production efficiency and quality.

[0067] See Figure 2 A mode switching device 20 according to another embodiment of the present invention can be used to implement the corresponding steps of the above method embodiment, including:

[0068] An acquisition module 21 is used to acquire control parameters based on Lua programming technology;

[0069] A judgment module 22 is used to judge the to-be-switched mode corresponding to the control parameter;

[0070] Encapsulation module 23, used to encapsulate control parameters into corresponding state variables of the Select control using the Convert function according to the mode to be switched. The state variables are used to update the Select control. The Select control includes two or more state address groups with different priority levels. Each state address group includes two or more state address blocks with different priority levels. The state variables are stored in the state address blocks. The mode selection corresponds to the state address block in a one-to-one manner.

[0071] The storage module 24 is used to store the state variables into the corresponding Flash address;

[0072] The switching module 25 is configured to switch modes according to the mode to be switched and the state variables and to display the visualization parameters in the updated Flash address.

[0073] As one implementation manner, the mode switching device 20 further includes:

[0074] The display module is used to assign the display state variable to the result stored in the corresponding Flash address.

[0075] Furthermore, the control parameters include Parameter1, Parameter2 and Parameter3.

[0076] Furthermore, the judgment module 22 is further configured to:

[0077] The waiting mode is selected first according to the value of Parameter1;

[0078] When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2;

[0079] When the values ​​of Parameter1 and Parameter2 are both 0, the waiting mode is selected according to the value of Parameter3;

[0080] The encapsulation module 23 is further used for:

[0081] When the value of Parameter1 is not 0, the control parameter is encapsulated in State1 in the Schedule table;

[0082] When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameters are encapsulated in State2 in the Schedule table;

[0083] When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table.

[0084] On the other hand, the present invention provides a serial port screen, comprising a screen and the above-mentioned mode switching device 20.

[0085] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0086] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A mode switching method, applied to a serial port screen, characterized in that: include: Obtaining control parameters based on Lua programming technology; the control parameters include Parameter1, Parameter2 and Parameter3; Determine the to-be-cut mode corresponding to the control parameter; According to the mode to be switched, the control parameter is encapsulated in the corresponding state variable of the Select control by using the Convert function, the state variable is used to update the Select control, the Select control includes two or more state address groups with different priority levels, each state address group includes two or more state address blocks with different priority levels, the state variable is stored in the state address block, and the mode selection corresponds to the state address block one by one; Storing the state variable in the corresponding Flash address; Switching the mode according to the to-be-switched mode and the state variable and displaying the updated visualization parameters in the Flash address; The mode to be cut corresponds to the data in the Schedule table in the Select control, and the step of determining the mode to be cut corresponding to the control parameter includes: The to-be-cut mode is preferentially selected according to the value of Parameter1; When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2; When the values ​​of Parameter1 and Parameter2 are both 0, the to-be-switched mode is selected according to the value of Parameter3.

2. The mode switching method according to claim 1, characterized in that: After the step of storing the state variable in the corresponding Flash address, the method further includes: The assignment displays the result of storing the state variable in the corresponding Flash address.

3. The mode switching method according to claim 1, characterized in that: The step of encapsulating the control parameter in the corresponding state variable of the Select control by using the Convert function according to the to-be-cut mode includes: When the value of Parameter1 is not 0, the control parameter is encapsulated in State1 in the Schedule table; When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameter is encapsulated in State2 in the Schedule table; When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table.

4. A mode switching device, characterized in that: include: An acquisition module, used for acquiring control parameters based on Lua programming technology, wherein the control parameters include Parameter1, Parameter2 and Parameter3; A judgment module, used for judging the to-be-switched mode corresponding to the control parameter; An encapsulation module, used for encapsulating the control parameters into corresponding state variables of the Select control by using a Convert function according to the mode to be switched, wherein the state variables are used to update the Select control, wherein the Select control includes two or more state address groups with different priority levels, each state address group includes two or more state address blocks with different priority levels, the state variables are stored in the state address blocks, and the mode selection corresponds one-to-one to the state address blocks; A storage module, used for storing the state variable into a corresponding Flash address; A switching module, used for switching modes according to the mode to be switched and the state variable and displaying the updated visualization parameters in the Flash address; When the mode to be cut corresponds to the data in the Schedule table in the Select control, the judgment module is also used to: preferentially select the mode to be cut according to the value of Parameter1; when the value of Parameter1 is 0, select the mode to be cut according to the value of Parameter2; when the values ​​of Parameter1 and Parameter2 are both 0, select the mode to be cut according to the value of Parameter3.

5. The mode switching device according to claim 4, characterized in that: Also includes: The display module is used to assign and display the result of storing the state variable in the corresponding Flash address.

6. The mode switching device according to claim 4, characterized in that: The judging module is also used for: The to-be-cut mode is preferentially selected according to the value of Parameter1; When the value of Parameter1 is 0, the waiting mode is selected according to the value of Parameter2; When the values ​​of Parameter1 and Parameter2 are both 0, the to-be-cut mode is selected according to the value of Parameter3; The packaging module is also used for: When the value of Parameter1 is not 0, the control parameter is encapsulated in State1 in the Schedule table; When the value of Parameter1 is 0 and the value of Parameter2 is not 0, the control parameter is encapsulated in State2 in the Schedule table; When the values ​​of Parameter1 and Parameter2 are both 0, and the value of Parameter3 is not 0, the control parameters are encapsulated in State3 in the Schedule table.

7. A serial port screen, characterized in that: The serial port screen comprises a screen and a mode switching device as described in any one of claims 4 to 6.

Citation Information

Patent Citations

  • Background picture replacing method and device

    CN104239085A

  • Method for realizing synchronous frame display by double-serial-port screen

    CN111240619A