PLC module dual-mode dynamic switching system and switching method thereof
By utilizing the dual-mode dynamic switching system of PLC modules and the partitioning design of hardware pins and non-volatile memory, the PLC module can flexibly switch between master node and child node modes. This solves the problems of cumbersome mode changes and easy failures in existing technologies, and improves the adaptability and convenience of the system.
Patent Information
- Application Number
- CN202511348934.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-01-23
AI Technical Summary
Existing PLC modules are bound to a single working mode. Changing the mode requires technicians to recompile the firmware, configure the parameters, and burn the firmware. This operation is cumbersome and prone to failure, increasing maintenance costs and production risks.
Design a PLC module dual-mode dynamic switching system, including a master node module, a child node module, hardware pins, a mode switching module, and a non-volatile memory. Mode switching is achieved by receiving external signals through hardware pins. Combined with the partition design of the non-volatile memory, configuration parameters are ensured to be accessed independently and reliably.
It enables flexible switching between master node and child node working modes of PLC modules without the need for recompilation and programming, simplifying the mode change process and improving system adaptability and ease of use.
Smart Images

Figure CN121386586A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of PLC module control, and particularly to a PLC module dual-mode dynamic switching system and a switching method thereof. BACKGROUND
[0002] With the development of semiconductor technology, PLC combines the flexible versatility of computers and the simple and economical advantages of relay control systems, and occupies a core position in industrial automation control. Its application level has become an important symbol for measuring the modernization of a country's industry. In a distributed industrial control system, PLC modules are mainly divided into two working modes: master node (CCO) and slave node (STA). The CCO mode serves as the master node responsible for network management, data forwarding and topology maintenance. The STA mode serves as the slave node responsible for connection establishment, data transmission and state reporting functions.
[0003] However, existing PLC modules are usually bound to a single working mode, and changing the mode requires technical personnel to recompile the firmware, configure the parameters and burn them. This operation process is tedious, and the PLC module needs to be interrupted during burning, which leads to production stagnation. It is also prone to human error, which significantly increases the operation and maintenance cost and production risk. SUMMARY
[0004] To solve the above problems, the present application provides a PLC module dual-mode dynamic switching system and a switching method thereof.
[0005] The technical solution adopted by the present application to solve its technical problems is: A PLC module dual-mode dynamic switching system, comprising: a master node module for providing a master node working mode to realize network channel management, data forwarding and topology maintenance functions; a slave node module for providing a slave node working mode to realize network connection establishment, data transmission and state reporting functions; a hardware pin connected to a master control chip GPIO port of the PLC module for receiving external input signals and providing high-level signals or low-level signals; a mode switching module connected to the hardware pin, the master node module and the slave node module for acquiring the level signal of the hardware pin in real time, and controlling the system to switch to the master node module working according to the high-level signal, or controlling the system to switch to the slave node module working according to the low-level signal; a non-volatile memory divided into a master node configuration parameter storage area and a slave node configuration parameter storage area for storing configuration parameters of the corresponding working mode respectively.
[0006] Further specifically, the hardware pin provides the level state through a pull-up or pull-down resistor.
[0007] Further specifically, the mode switching module comprises, a state saving unit, configured to save the current working state before mode switching; a function initialization unit, configured to load the corresponding configuration parameters and initialize the corresponding functions according to the target working mode; a connection recovery unit, configured to recover the network communication connection after the mode switching is completed.
[0008] Further specifically, it further comprises a state indication module, configured to report the current working mode state to external devices through LED indicator lights or communication interfaces.
[0009] Further specifically, the external input signal comprises a manual operation signal provided by a physical switch, a digital control signal provided by a master control device, and an automatic trigger signal monitored by the environment.
[0010] Further specifically, in the working of the mode switching module, when the master node working mode is switched to the sub-node working mode, the data forwarding function is stopped first, and then the sub-node function is initialized; when the sub-node working mode is switched to the master node working mode, the current connection is disconnected first, and then the master node function is initialized.
[0011] Further specifically, it further comprises a state monitoring module, which monitors the level state change of the hardware pin using a polling mechanism or an interrupt mechanism.
[0012] A switching method based on the above-mentioned PLC module dual-mode dynamic switching system, the steps of the switching method are, S1, the level state of the hardware pin connected to the PLC module is acquired in real time; S2, the target working mode is determined according to the level state, wherein the high level corresponds to the master node working mode, and the low level corresponds to the sub-node working mode; S3, the configuration parameters corresponding to the target working mode are read from the non-volatile memory, and the master node configuration parameters and the sub-node configuration parameters are stored in different address regions; S4, the corresponding working mode functions are initialized according to the configuration parameters, and the switching from the current working mode to the target working mode is completed; Wherein, the step S4 does not interrupt the normal operation of the PLC module in the execution process, and maintains the original network communication connection after the switching is completed.
[0013] Further specifically, in the step S3, When the target working mode is the master node working mode, load the channel management parameters and the data forwarding parameters from the master node configuration parameter storage area of the non-volatile memory; When the target working mode is the sub-node working mode, load the connection establishment parameters and the data transceiving parameters from the sub-node configuration parameter storage area of the non-volatile memory.
[0014] The application has the beneficial effects that: the application provides two types of core working mode functions by the master node module and the sub-node module respectively, receives external signals and outputs level trigger instructions relying on hardware pins, and the mode switching module completes dynamic switching of the dual mode in real time according to the level signals, and the independent and reliable calling of the corresponding mode configuration parameters is guaranteed by the partition storage design of the non-volatile memory, so that the flexible switching of the PLC module between the master node working mode and the sub-node working mode is effectively realized, the mode changing process is significantly simplified without relying on the traditional recompilation and programming operation, the demand of dynamic adjustment of the role of the PLC module in the industrial scene is met, and the adaptability and use convenience of the system are improved. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 is a structural block diagram of a first embodiment of the PLC module dual-mode dynamic switching system of the application; Figure 2 is a structural block diagram of a second embodiment of the PLC module dual-mode dynamic switching system of the application; Figure 3 is a flowchart of the PLC module dual-mode dynamic switching method of the application. DETAILED DESCRIPTION
[0016] The technical solutions of the application will be described clearly and completely in combination with the drawings. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor belong to the protection scope of the application.
[0017] In the description of the application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, therefore it cannot be understood as a limitation on the application. The direction of movement is also a relative direction of movement, and does not limit the absolute direction of movement. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.
[0018] In the description of the present application, it should be noted that unless otherwise explicitly specified and limited, the terms "mounting", "connection", "linking" should be understood broadly, for example, it can be fixed connection, or detachable connection, or integrally connected; it can be mechanical connection, or electrical connection; it can be directly connected, or indirectly connected through intermediate medium, or internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances. In addition, the technical features involved in the different embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0019] As Figure 1 The present application provides a PLC module dual-mode dynamic switching system, which comprises a master node (CCO) module, a slave node (STA) module, a hardware pin, a mode switching module and a non-volatile memory. The flexible switching between CCO and STA working modes is realized through the cooperation between these modules.
[0020] The CCO module is used to provide CCO working mode, and serves as the control core of network topology to realize comprehensive network management function: specifically including network channel management, efficient scheduling of multi-node communication channel is realized through channel scanning, collision detection and dynamic allocation algorithm to avoid signal interference; data forwarding function, data interaction between different STAs is completed based on preset routing rules or dynamic routing protocol, and the accuracy and real-time of data transmission are guaranteed through data packet verification and priority sorting mechanism; topology maintenance function, dynamic identification of node access / exit in the network is realized through periodic node detection and state monitoring, the topology structure table is automatically updated and the link reconstruction of fault node is triggered to ensure the overall stability of the network.
[0021] The STA module is used to provide STA working mode, and serves as the terminal execution unit to realize the interaction function with CCO and other devices: specifically including network connection establishment, identity authentication and parameter negotiation are completed with CCO through preset handshake protocol to quickly access the target network; data transceiving function, terminal device data (such as sensor signal, actuator state) is collected and uploaded according to CCO instruction or local trigger condition, at the same time, control instruction issued by CCO is received and parsed for execution, and data buffering mechanism is provided to cope with temporary network fluctuation; state reporting function, self-running parameters (such as working voltage, communication quality) and abnormal information (such as fault code, alarm signal) are fed back to CCO periodically, and CCO supports remote monitoring and management of it.
[0022] The hardware pins are configured to be directly electrically connected to the GPIO port of the main control chip of the PLC module, serving as the physical trigger interface for mode switching. They maintain a stable level reference state through external circuitry and can receive various types of external input signals. When an external input signal is applied, the hardware pins output a high-level signal or a low-level signal in real time, providing a clear physical trigger basis for mode switching.
[0023] The mode switching module, as the core control unit of the system, establishes signal connections with the hardware pins, the CCO module, and the STA module respectively, and undertakes the overall management function of dynamic mode switching. By obtaining the level status of the hardware pins, if a high-level signal is detected, the CCO mode switching logic is triggered, the current function of the STA module is turned off and the CCO module is activated; if a low-level signal is detected, the STA mode switching logic is started, the operation of the CCO module is paused and the operation of the STA module is switched.
[0024] Non-volatile memory serves as a dedicated storage medium for dual-mode configuration parameters. It is divided into clearly separated CCO and STA configuration parameter storage areas through hardware partitioning or logical addressing. The CCO configuration parameter storage area specifically stores core parameters required for the CCO operating mode, such as channel frequency, routing policy, topology update cycle, and maximum number of access nodes. The STA configuration parameter storage area stores key parameters for the STA operating mode, such as CCO address, communication baud rate, data acquisition cycle, and status reporting threshold. This ensures that the configuration parameters for the two modes are independent and do not interfere with each other, avoiding functional abnormalities caused by parameter confusion and enabling rapid location and retrieval of target parameters during mode switching, thus improving switching efficiency.
[0025] The hardware pins are equipped with integrated pull-up or pull-down resistors to establish a stable level reference state. One end of the pull-up resistor is electrically connected to the power supply terminal of the PLC module, and the other end is directly connected to the hardware pin. When there is no external input signal, the potential of the hardware pin can be stably pulled up to a high level consistent with the power supply terminal. The pull-down resistor is connected to the system ground terminal at one end and to the hardware pin at the other end. When there is no external input signal, the potential of the hardware pin can be stably pulled down to a low level consistent with the ground terminal.
[0026] The resistor value is selected as 10kΩ, which ensures a stable level state through appropriate current drive while avoiding excessive power consumption. Simultaneously, the resistor effectively suppresses the influence of electromagnetic interference in the industrial environment on the pin level, preventing false level transitions caused by noise interference when there is no external input. Through the hardware design of pull-up or pull-down resistors, the hardware pin maintains a defined initial level state when no external input signal is received, providing a stable and reliable reference signal for the mode switching module and ensuring the accuracy of mode determination.
[0027] Furthermore, the mode switching module includes a state saving unit, a function initialization unit, and a connection restoration unit.
[0028] The state saving unit is used to save the current working state before the mode switch is triggered, specifically including key data such as core operating parameters, network session information, and local device status under the current working mode. A high-speed data caching mechanism temporarily stores this information in a dedicated storage area, and the saved data is verified to ensure that data is not lost or corrupted during the switch, providing a reliable basis for mode rollback or subsequent state recovery.
[0029] The function initialization unit is used to load the corresponding configuration parameters according to the target working mode and complete the initialization of the function modules. First, it reads the pre-stored parameters from the target mode dedicated storage area of the non-volatile memory. After the parameter validity is verified, the function modules corresponding to the target mode are activated in sequence according to the preset priority.
[0030] The connection restoration unit is used to quickly rebuild the network communication connection after the mode switch is completed. Based on the historical session information stored in the state saving unit, it reduces the time spent re-establishing the connection through the link layer fast reconnection mechanism. For data that was in the transmission state before the switch, it prioritizes the restoration of unfinished transmission tasks by comparing the data packet sequence number. At the same time, it sends mode switch notifications to relevant nodes in the network to ensure the adaptability of the entire network to mode changes, and finally achieves seamless connection of communication links, reducing the impact of the switchover process on industrial control processes.
[0031] like Figure 2 The system also includes a status indicator module, which reports the current working mode status to external devices and on-site personnel via LED indicators or a communication interface. When the system is in CCO working mode, the indicator light is solid green; when it is in STA working mode, the indicator light is solid yellow; during mode switching, the indicator light flashes green and yellow alternately to indicate the transition status; if a mode switching abnormality or functional failure occurs, the indicator light will switch to a flashing red state to trigger an alarm.
[0032] This module can transmit the current working mode information to external devices for reporting through the communication interface of the PLC module. The reported content not only includes a clear mode identifier, but can also include auxiliary information such as mode running time and switching records.
[0033] The external input signals include manual operation signals provided by physical switches, digital control signals provided by the main control device, and automatic trigger signals provided by environmental monitoring.
[0034] The manual operation signal provided by the physical switch originates from the mechanical operating component directly connected to the hardware pin. On-site maintenance personnel can change the on / off state of the switch by manually pressing, tossing, or performing other physical operations, thereby changing the level signal of the hardware pin.
[0035] The digital control signals provided by the main control equipment originate from the upper-level management equipment in the industrial control system. The main control equipment sends preset digital commands through the communication interface, which directly act on the hardware pins to change their level states. It can automatically trigger mode switching according to production plans, network topology adjustment commands, and other requirements to achieve collaborative control between multiple devices.
[0036] The automatic trigger signal from environmental monitoring comes from various sensors. The sensors collect environmental parameters in real time. When the parameters reach the preset threshold, the corresponding level signal is output to the hardware pin through the signal conditioning circuit. This realizes the adaptive triggering of mode switching. The equipment role can be dynamically adjusted according to the on-site working conditions without manual intervention, thereby improving the intelligence and reliability of the system.
[0037] like Figure 2 The system also includes a status monitoring module, which monitors the changes in the voltage level of hardware pins through a polling mechanism or an interrupt mechanism. By flexibly adapting the polling mechanism and the interrupt mechanism, the status monitoring module can meet the response requirements of different industrial scenarios, ensure that the changes in the voltage level of hardware pins are quickly obtained, and improve the timeliness and reliability of mode switching.
[0038] like Figure 3 The present invention provides a switching method for a PLC module-based dual-mode dynamic switching system, the steps of which are as follows: S1. Real-time acquisition of hardware pin level status.
[0039] The system's status monitoring module uses either a polling or interrupt mechanism to acquire the hardware pin level status of the GPIO port connected to the PLC module's main control chip in real time. The polling mechanism actively reads the pin level value at a preset period and compares it with historical level values. The interrupt mechanism presets rising edge, falling edge, or double-edge trigger conditions; when the level meets the trigger condition, it quickly responds and acquires the current status, ensuring both accuracy and speed in acquiring level changes.
[0040] S2. Determine the target working mode.
[0041] After the status monitoring module synchronizes the acquired level status to the mode switching module, the mode switching module determines the target operating mode based on the level signal. If a high level signal is detected, the target mode is determined to be the CCO operating mode; if a low level signal is detected, the target mode is determined to be the STA operating mode.
[0042] S3, Read the configuration parameters corresponding to the target working mode The mode switching module reads the corresponding configuration parameters from the non-volatile memory based on the target operating mode. Since the memory has been divided into independent CCO configuration parameter storage areas and STA configuration parameter storage areas, the two types of parameters are stored in different address areas, which can achieve fast location and reading.
[0043] S4. Initialize the function and complete the mode switch.
[0044] The mode switching module initializes the corresponding working mode function according to the read configuration parameters, completing the switch from the current mode to the target mode; the entire process does not interrupt the normal operation of the PLC module, and the original network communication connection is maintained after the switch is completed. The specific switching method is as follows: When switching from CCO working mode to STA working mode, the receiving of new data packets is first paused, the unforwarded data in the buffer is processed, and a pause notification is broadcast to the access node. Then, the CCO routing calculation, channel allocation and other processes are shut down and resources are released. Based on the loaded STA configuration parameters, the connection establishment module, data transmission and reception buffer and status reporting timer are initialized, and the STA full-link function is activated.
[0045] When switching from STA working mode to CCO working mode, a termination request is first sent to the original CCO, an acknowledgment signal is waited for, session information is cleared, and the STA data acquisition and reporting process is shut down. Then, based on the loaded CCO configuration parameters, the channel scanning and collision detection functions are initialized, the topology maintenance table and data forwarding queue are built, and the CCO full-link function is activated.
[0046] The PLC module dual-mode dynamic switching system and method of this invention realizes dynamic switching between CCO and STA modes through hardware pin triggering and real-time sensing by the status monitoring module. This eliminates the need for traditional recompilation and programming operations, significantly simplifying the mode change process. During the switching process, the mode switching module ensures data integrity and resource stability by first stopping the current function and then initializing the target function, combined with the partitioned parameter storage design of the non-volatile memory. At the same time, the module operation is not interrupted throughout the process, and the network connection is maintained continuously. With the local and remote status feedback from the status indication module, the flexibility, operation and maintenance efficiency, and operational reliability of the industrial control system are effectively improved, meeting the needs of dynamic adjustment of equipment roles in distributed industrial scenarios.
[0047] It should be emphasized that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any way. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention shall still fall within the scope of the technical solution of the present invention.
Claims
1. A PLC module dual-mode dynamic switching system, characterized in that, include: The master node module is used to provide the master node working mode and implement network channel management, data forwarding and topology maintenance functions; The sub-node module is used to provide sub-node working modes and realize network connection establishment, data transmission and reception, and status reporting functions; The hardware pins are configured to connect to the GPIO ports of the main control chip of the PLC module, and are used to receive external input signals and provide high-level or low-level signals. A mode switching module, connected to the hardware pin, the master node module, and the child node module, is used to acquire the level signal of the hardware pin in real time, and control the system to switch to the master node module based on the high level signal, or control the system to switch to the child node module based on the low level signal. The non-volatile memory is divided into a master node configuration parameter storage area and a child node configuration parameter storage area, which are used to store the configuration parameters of the corresponding working modes.
2. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, The hardware pins provide a voltage level via pull-up or pull-down resistors.
3. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, The mode switching module includes, A state saving unit is used to save the current working state before mode switching; The function initialization unit is used to load the corresponding configuration parameters and initialize the corresponding functions according to the target working mode. The connection recovery unit is used to restore network communication connection after mode switching is completed.
4. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, It also includes a status indicator module, which is used to report the current working mode status to external devices via LED indicators or communication interfaces.
5. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, The external input signals include manual operation signals provided by physical switches, digital control signals provided by the main control device, and automatic trigger signals provided by environmental monitoring.
6. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, In the operation of the mode switching module, When the master node switches to the child node working mode, the data forwarding function is stopped first, and then the child node function is initialized. When the child node switches to the master node working mode, the current connection is disconnected first, and then the master node functions are initialized.
7. The PLC module dual-mode dynamic switching system according to claim 1, characterized in that, It also includes a status monitoring module, which uses a polling mechanism or an interrupt mechanism to monitor the level changes of the hardware pins.
8. A switching method for a dual-mode dynamic switching system for a PLC module based on any one of claims 1-7, characterized in that, The switching method comprises the following steps: S1. Real-time acquisition of the level status of hardware pins connected to the PLC module; S2. Determine the target working mode based on the level state, wherein a high level corresponds to the master node working mode and a low level corresponds to the child node working mode. S3. Read the configuration parameters corresponding to the target working mode from the non-volatile memory. The master node configuration parameters and the child node configuration parameters are stored in different address areas. S4. Initialize the corresponding working mode function according to the configuration parameters to complete the switch from the current working mode to the target working mode; In step S4, the normal operation of the PLC module is not interrupted during the execution process, and the original network communication connection is maintained after the switch is completed.
9. The switching method according to claim 8, characterized in that, In step S3 When the target operating mode is the master node operating mode, the channel management parameters and data forwarding parameters are loaded from the master node configuration parameter storage area of the non-volatile memory; When the target operating mode is child node operating mode, the connection establishment parameters and data transmission and reception parameters are loaded from the child node configuration parameter storage area of non-volatile memory.