Dynamic loading method and system for liquid crystal menu of telecontrol equipment capable of saving RAM (Random Access Memory) space
By storing the remote transmission point table information in the Flash constant read-only variable area in the remote control device and performing targeted erasure and rewriting through the communication interface, the problem of insufficient RAM in the LCD module is solved, dynamic loading of the LCD menu is realized, hardware costs are reduced, and the system's flexibility and maintainability are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-14
AI Technical Summary
The existing remote control equipment's LCD modules suffer from insufficient RAM due to displaying large amounts of remotely transmitted data, leading to increased hardware costs and maintenance difficulties, and making it unable to adapt to the point table expansion caused by the main station upgrade.
The configuration information of the remote dot table is stored in the const read-only variable area of the internal Flash, and the dot table data is received through the communication interface for targeted erasure and write updates. This dynamically constructs and persistently stores the LCD menu structure, avoiding reliance on a large amount of RAM.
Dynamic loading of LCD menus was achieved without increasing RAM resource consumption, reducing hardware costs and improving system flexibility and maintainability.
Smart Images

Figure CN121858007A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system automation control technology, and more specifically, to a method for dynamically loading menus in a remote control equipment LCD display system based on an STM32F103 microcontroller, which saves RAM space. Background Technology
[0002] In power automation systems, remote control equipment (such as measurement and control devices, communication management units, etc.) that support LCD display functions typically adopt a hardware architecture with separate main control MCU and LCD MCU. The main control MCU is responsible for handling business logic, data acquisition, and remote communication with the master station; the LCD MCU is dedicated to handling the display function of the human-machine interface (HMI). The two communicate with each other through a serial communication interface (such as UART, CAN, etc.).
[0003] For remote control equipment with remote transmission capabilities, the remote transmission function for communication with the master station is implemented by the main control MCU. Remote transmission data, such as telemetry, remote signaling, remote control, and remote adjustment, are determined by the remote transmission point table, whose configuration information is typically stored in the main control MCU. Because the configuration requirements vary across different application sites, and the remote transmission point tables differ, the equipment display needs to adapt to these site changes. Furthermore, with upgrades and modifications to the master station system, the equipment's LCD display function often requires corresponding adaptive adjustments and functional expansions.
[0004] In existing technologies, the LCD MCU obtains complete remote transmission dot table information from the main control MCU during startup, parses it, and stores it in RAM as global variables. Subsequent menu loading and data display rely on accessing these RAM variables. However, due to cost constraints, LCD MCUs typically use microcontrollers with limited RAM resources (such as the STM32F103 series). The amount of dot table information is positively correlated with the remote transmission type, attributes, and number of dots. When the field configuration is complex or the dot table size is large, RAM resources are easily exhausted. In this case, to meet functional requirements, it is necessary to replace the MCU with one with one having higher RAM capacity, which not only increases hardware costs but also leads to software fragmentation, placing an additional burden on production management and field maintenance. Furthermore, for existing deployed equipment, once the main station upgrade triggers dot table expansion, the original LCD modules are incompatible with the new configuration due to insufficient RAM, often requiring the entire unit to be returned to the factory or hardware replacement, significantly increasing maintenance costs.
[0005] Therefore, there is an urgent need for a solution that can dynamically load remote menus without increasing RAM resource consumption, so as to break through the bottlenecks of existing architecture in terms of resource utilization efficiency and system maintainability. Summary of the Invention
[0006] The purpose of this invention is to solve the RAM shortage problem caused by the display of large amounts of remotely transmitted data in the LCD module of remote control equipment. It proposes a method and system for dynamically loading LCD menus in remote control equipment that saves RAM space. By storing the configuration information of the remote transmission point table in a const read-only variable area in the internal Flash memory, and receiving the point table data from the main control MCU through the communication interface during the equipment initialization phase, the const read-only variable in the Flash memory is updated by targeted erasure and write operations. This achieves dynamic construction and persistent storage of the menu structure without relying on a large amount of RAM.
[0007] The technical solution of this invention is: This invention provides a method for dynamically loading LCD menus in a remote control device that saves RAM space. The remote control device includes a main control MCU and an LCD MCU, wherein the LCD MCU has internal Flash memory and RAM. The method includes: S1. A specific area is pre-allocated in the internal Flash memory to store the remote transmission point table display information, and multiple const read-only variables are defined and fixedly stored in the specific area to describe the remote transmission point table display information; S2. After the device is powered on, the LCD MCU and the main control MCU communicate in frames to receive messages; S3. Parse each frame of the message to obtain the remote point table display information required by the LCD display, temporarily store it in the RAM local variable and compare it with the corresponding part of the const read-only variable; S4. If the comparison is different, the contents of the RAM local variable are written to the internal Flash memory address corresponding to the const read-only variable through Flash erase and write operations, thereby dynamically modifying the value of the const read-only variable. S5. Repeat steps S3-S4 until all messages are processed. Directly access the const read-only variable to obtain the updated remote transmission point table display information, and use this information to dynamically load the LCD menu.
[0008] Furthermore, S1 includes: S11. Divide the internal Flash memory into code storage space and const read-only variable storage space; S12. Define the remote transmission point table display information through a structure, i.e., a const read-only variable, including the remote transmission data type, attributes, and point table sequence number; S13. Store multiple const read-only variables at a predetermined address in the const read-only variable storage space.
[0009] Furthermore, the definition of remote transmission point table display information in S12 includes: defining a structure data that supports a maximum number of points, covering various types of remote transmission data including telemetry, remote signaling, remote control, and remote adjustment; and setting fields in the structure that correspond to the type identifier, data attribute, and point table sequence number of the remote transmission data.
[0010] Furthermore, S2 specifically involves the LCD MCU establishing a connection with the main control MCU via serial port or CAN communication, receiving message frames multiple times until the complete remote transmission point table display information is obtained; each received message frame immediately triggers subsequent parsing processing.
[0011] Furthermore, S3 includes: S31. Parse each frame of the message to obtain the single-frame remote transmission dot table display information required by the LCD display, and temporarily store it in the predefined RAM local variable; S32. Compare field by field the single-frame remote transmission point table display information of RAM local variables with the remote transmission point table display information corresponding to the const read-only variables in the internal Flash memory. The comparison content includes remote transmission data type, attribute and point table number. If the information displayed in the single-frame remote transmission point table is the same as the corresponding part of the information displayed in the corresponding remote transmission point table, then no modification is needed; otherwise, modification is required.
[0012] Furthermore, S4 includes: S41. Obtain the Flash address offset corresponding to the RAM local variable in the const read-only variable; S42. Perform an erase operation on the Flash page containing the target address, and perform a segmented write operation to write the contents of the RAM local variables to the calculated Flash address; S43. After the write operation is completed, the const read-only variable is converted to the updated remote transmission point table display information at the same address.
[0013] Further, S41 calculates the Flash address offset corresponding to the RAM local variable based on the predefined structure layout and the address of a specific region divided in the internal Flash memory.
[0014] Furthermore, S5 includes: S51. Confirm that all message frames have been received and processed accordingly; S52. During the LCD menu loading process, the remote dot table display information in the const read-only variable is directly referenced; the corresponding menu structure is generated according to the remote data type, attribute and dot table number stored in the const read-only variable; LCD display and user operation interaction based on menu structure are supported.
[0015] A RAM-saving remote control device LCD menu dynamic loading system, the system being configured to perform the method described.
[0016] A computer-readable storage medium having a computer program stored thereon that, when executed, implements the method.
[0017] The beneficial effects of this invention are: This invention discloses a method and system for dynamically loading LCD menus in remote control devices (RTDs) that saves RAM space. The remote dot table information is defined as multiple `const` structure read-only variables stored in a specific area of the internal Flash memory. After power-on initialization, the dot table messages are received via frame-by-frame communication with the main microcontroller. The display information corresponding to the current frame is temporarily stored only in local variables in RAM. By comparing each field, it is determined whether an update is needed. If they differ, the Flash address offset is calculated, and erase and write operations are performed on the corresponding page. This dynamically modifies the contents of the `const` read-only variables in Flash without consuming additional RAM. After all frame updates are completed, the program directly accesses these updated `const` read-only variables to obtain the latest dot table display information, thereby efficiently generating the LCD RTD menu structure and supporting interactive display. This method significantly reduces RAM usage, ensures the dynamic and real-time nature of the menu, and improves the reliability and flexibility of resource-constrained RTDs.
[0018] This invention uses Flash memory instead of RAM, reducing RAM requirements. When the telemetry table information changes, the LCD menu can dynamically load and update accordingly. This reduces hardware costs and enhances product maintainability.
[0019] Other features and advantages of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0020] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the invention.
[0021] Figure 1 A flowchart illustrating a method for dynamically loading a liquid crystal menu in a telemetry device that saves RAM space, according to an embodiment of the present invention, is shown. Detailed Implementation
[0022] Preferred embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0023] This invention provides a method and system for dynamically loading LCD menus in remote control devices that saves RAM space. The core of this method is to store the remote transmission dot table display information as a const read-only variable in a specific area of the internal Flash memory of the LCD MCU. Through frame communication, local comparison and on-demand update mechanism, the dynamic construction and real-time interaction of the LCD menu structure can be completed without relying on the global RAM to reside a complete dot table.
[0024] Figure 1 A flowchart illustrating a method for dynamically loading a liquid crystal menu in a telemetry device that saves RAM space, according to an embodiment of the present invention, is shown.
[0025] like Figure 1 As shown, the present invention provides a method for dynamically loading LCD menus in a remote control device that saves RAM space. The remote control device includes a main control MCU and an LCD MCU, which establish a data connection through a serial communication interface. The LCD MCU has internal Flash memory and RAM. The method includes: S1. A specific area is pre-allocated in the internal Flash memory to store the remote transmission point table display information, and multiple const read-only variables are defined and fixedly stored in the specific area to describe the remote transmission point table display information; Specifically, the process includes: S11, dividing the internal Flash memory into a code storage space and a const read-only variable storage space; S12, defining remote transmission point table display information through a structure, i.e., a const read-only variable, including remote transmission data type, attributes, and point table serial number; and S13, storing multiple const read-only variables at predetermined addresses in the const read-only variable storage space.
[0026] The definition of the remote transmission point table display information includes: defining a structure data that supports a maximum number of points, covering various remote transmission data including telemetry, remote signaling, remote control, and remote adjustment; and setting fields in the structure that correspond to the type identifier, data attribute, and point table sequence number of the remote transmission data.
[0027] In this embodiment, multiple const variables are defined, and each const variable is stored in a specified Flash address using `__attribute__((at(flash_addr))`. The structure includes a type identifier field to distinguish whether the current point is telemetry, remote signaling, remote control, or remote adjustment; an attribute description field to record metadata such as the data unit, measurement range, and whether it is editable; and a point table sequence number field to uniquely identify the logical position of the point in the overall point table. Furthermore, the structure reserves a maximum point capacity, for example, defining an array containing 256 elements, each element being an instance of the aforementioned structure, ensuring compatibility with different field configuration requirements. This structure array is placed in the aforementioned allocated const read-only variable storage space, and its starting physical address is determined at compile time.
[0028] S2. After the device is powered on, the LCD MCU establishes a connection with the main control MCU through serial port or CAN communication, and receives message frames in multiple times until the complete remote point table display information is obtained; each received message frame immediately triggers subsequent parsing processing.
[0029] In this embodiment, after the device is powered on, the LCD MCU first completes hardware initialization, including the configuration of the serial communication interface, Flash controller, and LCD driver module. It then establishes a communication connection with the main control MCU. The communication interface can use a Universal Asynchronous Receiver / Transmitter (UART) or a Controller Area Network (CAN) bus. The communication process is performed in frames, with each frame carrying a portion of the remote dot table display information. The main control MCU, based on the actual dot table size, splits the complete dot table information into several frames and sends them sequentially to the LCD MCU.
[0030] S3. Parse each frame of the message to obtain the remote point table display information required by the LCD display, temporarily store it in the RAM local variable and compare it with the corresponding part of the const read-only variable; Specifically, the process includes: S31, parsing each frame of the message to obtain the single-frame remote transmission dot table display information required for the LCD display, and temporarily storing it in a predefined RAM local variable; S32, comparing the single-frame remote transmission dot table display information in the RAM local variable with the remote transmission dot table display information corresponding to the const read-only variable in the internal Flash memory, and comparing the remote transmission data type, attribute, and dot table sequence number; if the content of the single-frame remote transmission dot table display information is the same as the corresponding part of the remote transmission dot table display information, it is determined that no modification is needed; otherwise, it is determined that modification is needed.
[0031] In this embodiment, after receiving any frame message, the LCD MCU parses it, extracts the single-frame remote dot table display information required for LCD display from the current frame, and fills it into a pre-allocated RAM local variable. This process is limited to the current frame and does not occupy global RAM resources. The content of this local variable is then compared field by field with the corresponding const read-only variable in the internal Flash memory to confirm whether it has been modified.
[0032] The specific implementation of the comparison operation is as follows: First, based on the point table index carried by the current frame, obtain the index position of the point in the const structure array; second, using this index and the offset of the structure members, combined with the base address of the const variable in Flash, use pointer arithmetic to obtain the target Flash address. For example, if the const variable is named g_point_table, its starting address is 0x08040000, the structure size is 64 bytes, and the current point index is n, then the target address is 0x08040000 + n × 64. Subsequently, read the original data from this Flash address and compare it with each field in the local variable, including the type identifier, attribute descriptor, and point table index. If all fields are completely consistent, it is determined that no update is needed, the local variable is released directly, and the process waits for the next frame; if any field differs, the Flash update process is initiated.
[0033] S4. If the comparison is different, the contents of the RAM local variable are written to the internal Flash memory address corresponding to the const read-only variable through Flash erase and write operations, thereby dynamically modifying the value of the const read-only variable. Specifically, the process includes: S41, obtaining the Flash address offset corresponding to the RAM local variable in the const read-only variable; S42, performing an erase operation on the Flash page containing the target address, and performing a segmented write operation to write the contents of the RAM local variable to the calculated Flash address; S43, after the write is completed, the const read-only variable is converted to the updated remote transmission point table display information at the same address.
[0034] In this embodiment, the Flash update process first determines the Flash page boundary to which the target address belongs, and then performs an erase operation on that page. After erasure, the data content of local variables is written to the target address range of the erased page in segments according to the Flash programming granularity. After writing is completed, the content of the original const read-only variable in that address range is replaced with the latest version of the remote transmission point table display information.
[0035] S5. Repeat steps S3-S4 until all messages are processed. Directly access the const read-only variable to obtain the updated remote transmission point table display information, and use this information to dynamically load the LCD menu.
[0036] Specifically, it includes S51, confirming that all message frames have been received and processed accordingly; S52, directly referencing the remote transmission dot table display information in the const read-only variable during the LCD menu loading process; generating the corresponding menu structure according to the remote transmission data type, attributes and dot table sequence number stored in the const read-only variable; and supporting LCD display and user operation interaction based on the menu structure.
[0037] In this embodiment, the menu loading phase traverses all elements in the Flash memory, sequentially reading the type identifier, attribute information, and sequence number of each point. Based on the type identifier, the points are categorized into four primary menu items: telemetry, remote signaling, remote control, and remote adjustment. For each primary menu item, secondary or multi-level sub-menu nodes are further generated based on the point table sequence number or user-defined grouping rules. Each menu node is associated with a corresponding data display format; for example, telemetry points are displayed as floating-point numbers with units, remote signaling points are represented by "on / off" status icons, remote control points provide an "execute" button, and remote adjustment points support numerical input boxes. The interaction logic is also dynamically bound based on the attribute description; for example, non-editable points are prohibited from being modified by the user.
[0038] Once the menu structure is built, it is mapped to the graphics buffer of the LCD screen. Users can switch between menu levels using navigation keys or the touchscreen. When a point is selected, the system directly reads its latest display information from Flash and renders it to the screen. Since all dot table data is stored in Flash, no additional RAM cache is needed. Therefore, even if the dot table size expands, the RAM usage of the LCD MCU remains constant, consuming only a small amount of stack space for displaying the current menu item and processing user input.
[0039] A RAM-saving remote control device LCD menu dynamic loading system, the system being configured to perform the method described.
[0040] A computer-readable storage medium having a computer program stored thereon that, when executed, implements the method.
[0041] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. A method for dynamically loading a liquid crystal menu in a remote control device that saves RAM space, the remote control device comprising a main control MCU and a liquid crystal MCU, the liquid crystal MCU having internal Flash memory and RAM, characterized in that, The method includes: S1. A specific area is pre-allocated in the internal Flash memory to store the remote transmission point table display information, and multiple const read-only variables are defined and fixedly stored in the specific area to describe the remote transmission point table display information; S2. After the device is powered on, the LCD MCU and the main control MCU communicate in frames to receive messages; S3. Parse each frame of the message to obtain the remote point table display information required by the LCD display, temporarily store it in the RAM local variable and compare it with the corresponding part of the const read-only variable; S4. If the comparison is different, the contents of the RAM local variable are written to the internal Flash memory address corresponding to the const read-only variable through Flash erase and write operations, thereby dynamically modifying the value of the const read-only variable. S5. Repeat steps S3-S4 until all messages are processed. Directly access the const read-only variable to obtain the updated remote transmission point table display information, and use this information to dynamically load the LCD menu.
2. The method as described in claim 1, characterized in that... S1 includes: S11. Divide the internal Flash memory into code storage space and const read-only variable storage space; S12. Define the remote transmission point table display information through a structure, i.e., a const read-only variable, including the remote transmission data type, attributes, and point table sequence number; S13. Store multiple const read-only variables at a predetermined address in the const read-only variable storage space.
3. The method as described in claim 2, characterized in that... The information displayed in the remote transmission point table defined in S12 includes: Define a structured data that supports a maximum number of points, covering various types of remote transmission data including telemetry, remote signaling, remote control, and remote adjustment; In the structure, set fields corresponding to the type identifier, data attribute, and point table sequence number of the remote transmission data.
4. The method as described in claim 1, characterized in that... S2 specifically refers to: the LCD MCU establishing a connection with the main control MCU via serial port or CAN communication, receiving message frames multiple times until the complete remote point table display information is obtained; each received message frame immediately triggers subsequent parsing processing.
5. The method as described in claim 1, characterized in that S3 include: S31. Parse each frame of the message to obtain the single-frame remote transmission dot table display information required by the LCD display, and temporarily store it in the predefined RAM local variable; S32. Compare field by field the single-frame remote transmission point table display information of RAM local variables with the remote transmission point table display information corresponding to the const read-only variables in the internal Flash memory. The comparison content includes remote transmission data type, attribute and point table number. If the information displayed in the single-frame remote transmission point table is the same as the corresponding part of the information displayed in the corresponding remote transmission point table, then no modification is needed; otherwise, modification is required.
6. The method as described in claim 1, characterized in that S4 include: S41. Obtain the Flash address offset corresponding to the RAM local variable in the const read-only variable; S42. Perform an erase operation on the Flash page containing the target address, and perform a segmented write operation to write the contents of the RAM local variables to the calculated Flash address; S43. After the write operation is completed, the const read-only variable is converted to the updated remote transmission point table display information at the same address.
7. The method as described in claim 6, characterized in that... S41 is: Calculate the Flash address offset corresponding to the RAM local variable based on the predefined structure layout and the address of a specific region divided in the internal Flash memory.
8. The method as described in claim 1, characterized in that S5 include: S51. Confirm that all message frames have been received and processed accordingly; S52. During the LCD menu loading process, directly reference the remote dot table display information in the const read-only variable; generate the corresponding menu structure according to the remote data type, attribute and dot table number stored in the const read-only variable; It supports menu-based LCD displays and user interaction.
9. A RAM-saving dynamic loading system for a remote-controlled device's LCD menu, characterized in that: The system is configured to perform the method as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that... When the program is executed, it implements the method as described in any one of claims 1-8.