Programmable logic controller and communication method for programmable logic controller
Patent Information
- Application Number
- CN202510038102.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-01-09
AI Technical Summary
[0004]本发明所要解决的技术问题是:传统的PLC不具备直接上云的能力,且对工作人员专业度有较高的要求,安装和维护的难度大、成本高
[0016] The programmable logic controller (PLC) and its communication method provided by this invention have a built-in TCP/IP communication thread in the PLC's memory. Combined with communication components, this enables the PLC to be wirelessly deployed and has internet access capabilities, i.e., the ability to directly access the cloud. This allows enterprise employees to perform remote maintenance and troubleshooting, reducing the need for on-site operations and significantly reducing the difficulty and cost of installation and maintenance.
Smart Images

Figure CN119892873B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial control technology, and in particular to a programmable logic controller (PLC) and a communication method for the PLC. Background Technology
[0002] A Programmable Logic Controller (PLC) is a digital electronic device specifically designed for industrial automation control. It plays a crucial role in the field of industrial automation.
[0003] With the rise of Industry 4.0 and smart manufacturing, the communication and networking functions of PLCs have become increasingly important. However, traditional PLCs do not have the ability to directly access the cloud, and equipment operation requires on-site operation by employees, which is time-consuming and prone to errors. Furthermore, the PLC and the main control room rely on a wired connection, and the installation and maintenance of wired cabling are cumbersome, requiring a high level of expertise from the staff, which increases the difficulty and cost of installation and maintenance. Summary of the Invention
[0004] The technical problem to be solved by this invention is that traditional PLCs do not have the ability to directly access the cloud, and require a high level of professionalism from the staff, making installation and maintenance difficult and costly.
[0005] To address the aforementioned shortcomings of existing technologies, the following solutions are provided:
[0006] In a first aspect, the present invention provides a programmable logic controller (PLC), comprising a central processing unit (CPU) and a network interface. The CPU is used to acquire data from at least one external device. It runs a user program and processes the data from the at least one external device to obtain processed data and data to be transmitted over the network. It then transmits the processed data to the at least one external device. Additionally, it encapsulates the data to be transmitted over the network into a Message Queuing Telemetry Transmission (MQTT) message and sends the MQTT message to the network interface. The data to be transmitted over the network is obtained based on data from the at least one external device. The network interface is used to connect to a fifth-generation mobile communication network (5G network) communication module and send MQTT messages to the communication module, enabling the communication module to remotely transmit the MQTT messages over the network. It is also used to connect to each of the at least one external device and to transmit data with each of the at least one external device.
[0007] Optionally, the programmable logic controller also includes a memory. The memory is connected to the central processing unit (CPU) and is used to store system programs and system data. The memory also stores the TCP / IP communication thread, which carries the MQTT protocol. The CPU is also used to run the TCP / IP communication thread, encapsulating data to be transmitted over the network into MQTT messages and sending the MQTT messages to the network interface.
[0008] Optionally, the network interface includes a wide area network (WAN) interface and a local area network (LAN) interface. The WAN interface is used to connect to the communication module and send MQTT messages to the communication module, enabling the communication module to remotely transmit MQTT messages over the network. The LAN interface is used to connect to each of at least one external device and to transmit data with each of the at least one external device.
[0009] Optionally, the LAN interface is used to transmit data with each of the at least one external device via the Modbus-RTU serial communication protocol.
[0010] Optionally, the programmable logic controller further includes an input module. The input module is configured to connect to the central processing unit and each of the at least one external device, receive data from each of the at least one external device, temporarily store data from each of the at least one external device, and send data from each of the at least one external device to the central processing unit.
[0011] Optionally, the input module includes an input interface and an input image register. The input interface is used to connect to each of the at least one external device, receive data from each of the at least one external device, and send data from each of the at least one external device to the input image register. The input image register is used to receive data from the input interface and temporarily store the data from the input interface so that the central processing unit can read the data from the input interface from the input image register.
[0012] Optionally, the programmable logic controller further includes an output module. The output module is used to connect to the central processing unit and each of the at least one external device, respectively, and to send processed data to each of the at least one external device.
[0013] Optionally, the output module includes an output image register and an output interface. The output image register is used to receive processed data from the central processing unit, temporarily store the processed data, and send the processed data temporarily stored in the output image register to the output interface. The output interface is used to connect to each of at least one external device, to receive the processed data from the output image register, and to send the processed data to each of the at least one external device.
[0014] Optionally, the programmable logic controller also includes a power supply module. The power supply module is used to connect to an external power source to power the central processing unit, input modules, and output modules.
[0015] Secondly, embodiments of the present invention provide a communication method for a programmable logic controller (PLC), applied to a PLC including a central processing unit (CPU) and a network interface. The method includes: the CPU acquiring data from at least one external device; the CPU running a user program and processing the data from the at least one external device to obtain processed data and data to be transmitted over the network; the CPU transmitting the processed data to the at least one external device; the CPU encapsulating the data to be transmitted over the network into an MQTT message and sending the MQTT message to the network interface; and the network interface sending the MQTT message to a communication module, enabling the communication module to remotely transmit the MQTT message over the network and perform data transmission with each of the at least one external device. The data to be transmitted over the network is obtained based on data from the at least one external device.
[0016] The programmable logic controller (PLC) and its communication method provided by this invention have a built-in TCP / IP communication thread in the PLC's memory. Combined with communication components, this enables the PLC to be wirelessly deployed and has internet access capabilities, i.e., the ability to directly access the cloud. This allows enterprise employees to perform remote maintenance and troubleshooting, reducing the need for on-site operations and significantly reducing the difficulty and cost of installation and maintenance. Attached Figure Description
[0017] Figure 1 This is a structural diagram of a programmable logic controller according to an embodiment of the present invention;
[0018] Figure 2 This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0019] Figure 3 This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0020] Figure 4This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0021] Figure 5 This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0022] Figure 6 This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0023] Figure 7 This is a structural diagram of another programmable logic controller in an embodiment of the present invention;
[0024] Figure 8 This is a schematic diagram illustrating the workflow of a programmable logic controller I / O module, as shown in an embodiment of the present invention.
[0025] Figure 9 This is a schematic diagram illustrating the structure of a programmable logic controller connected to a communication module, as shown in an embodiment of the present invention.
[0026] Figure 10 This is a schematic diagram illustrating the workflow of a programmable logic controller connected to a communication module, as shown in an embodiment of the present invention.
[0027] Figure 11 This is a flowchart illustrating a communication method for a programmable logic controller according to an embodiment of the present invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0029] It is understood that the specific embodiments and accompanying drawings described herein are merely for explaining the invention and are not intended to limit the invention.
[0030] It is understood that, without conflict, the various embodiments and features in the embodiments of the present invention can be combined with each other.
[0031] It is understood that, for ease of description, only the parts related to the present invention are shown in the accompanying drawings, while the parts unrelated to the present invention are not shown in the drawings.
[0032] It is understood that each unit or module involved in the embodiments of the present invention may correspond to only one entity structure, or may be composed of multiple entity structures, or multiple units or modules may be integrated into one entity structure.
[0033] It is understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of this invention may occur in a different order than that marked in the accompanying drawings.
[0034] It is understood that the flowcharts and block diagrams of this invention illustrate the possible architecture, functions, and operations of systems, apparatuses, devices, and methods according to various embodiments of this invention. Each block in the flowchart or block diagram may represent a unit, module, program segment, or code, containing executable instructions for implementing the specified function. Furthermore, each block or combination of blocks in the block diagram and flowchart can be implemented using a hardware-based system to achieve the specified function, or using a combination of hardware and computer instructions.
[0035] It is understood that the units and modules involved in the embodiments of the present invention can be implemented by software or by hardware. For example, the units and modules can be located in a processor.
[0036] Embodiments of the present invention provide a programmable logic controller, such as... Figures 1 to 7 As shown, the programmable logic controller 00 includes a central processing unit (CPU) 1 and a network interface 2. The CPU 1 is used to acquire data from at least one external device 5. It runs a user program and processes the data from the at least one external device 5 to obtain processed data and data to be transmitted over the network. It then transmits the processed data to the at least one external device 5. Additionally, it encapsulates the data to be transmitted over the network into an MQTT message and sends the MQTT message to the network interface 2. The data to be transmitted over the network is obtained based on the data from the at least one external device 5. The network interface 2 is used to connect to a communication module 6 and send MQTT messages to the communication module 6, enabling the communication module to remotely transmit the MQTT messages over the network. It is also used to connect to each of the at least one external device 5 and to perform data transmission with each of the at least one external device 5.
[0037] Understandably, in addition to enabling data transmission between a traditional PLC and external devices, in embodiments of the present invention, the central processing unit 1 can encapsulate the data to be transmitted over the network into a message queue telemetry transmission (MQTT) message. In other words, the programmable logic controller 00 has a built-in MQTT protocol, enabling the programmable logic controller 00 to communicate directly with the MQTTBroker without the support of external network devices or gateways. This allows data to be easily sent to the cloud or other devices, enabling remote monitoring and interoperability. This design can reduce the overall system complexity and additional hardware investment, and can support the Internet-based publish / subscribe model.
[0038] Understandably, the data to be transmitted over the network refers to all or part of the data from at least one external device (e.g., a portion of the data selected from at least one external device), and needs to be sent to the cloud or other devices via the network. For example, the data to be transmitted over the network may be operational data of some of the external devices in at least one external device 5 (e.g., temperature data from a temperature sensor), so that the cloud or other devices can store the operational data of some of the external devices in at least one external device 5, allowing users to view the operational data of some of the external devices in at least one external device 5 through the cloud or other devices.
[0039] Understandably, the processed data can represent an instruction. For example, the central processing unit 1 can acquire data from the temperature sensor, run the user program and process the data from the temperature sensor to obtain the processed data, and send the processed data (e.g., instruction A) to the corresponding device (e.g., air conditioner motor) so that the corresponding device can perform an action according to instruction A (e.g., start running or stop running).
[0040] Understandably, network interface 2 can use the MQTT IoT transmission protocol, meaning it can independently interconnect with internet application platforms.
[0041] For example, data from at least one external device 5 can be data from a single external device 5, or data from each of multiple external devices 5. Each of the at least one external device 5 can be a sensor, a button, or other such device. For example, the communication module 6 can be a 5G communication module, such as the Yanfei communication module. After connecting the programmable logic controller 00 to the Yanfei communication module, the functions of both a PLC and a gateway can be realized, supporting direct access to the cloud via multiple methods such as 4G / 5G / WIFI / Ethernet.
[0042] In some embodiments, such as Figure 2 As shown, the programmable logic controller 00 also includes a memory 7. The memory 7 is connected to the central processing unit 1 and is used to store system programs and system data. The memory 7 also stores a TCP / IP communication thread, which is used to carry the MQTT protocol. The central processing unit 1 is also used to run the TCP / IP communication thread, encapsulate the data to be transmitted over the network into MQTT messages, and send the MQTT messages to the network interface 2.
[0043] Understandably, a PLC's memory generally includes system memory and user memory. The system memory stores the PLC's system program and system data to ensure the PLC operates normally, while the user memory stores user-written programs and user data to implement specific control functions.
[0044] In an embodiment of the present invention, the memory 7 also stores a TCP / IP communication thread. That is, the embodiment of the present invention adds a TCP / IP communication thread to the operating system inside the programmable logic controller 00, so that the programmable logic controller 00 itself has IP communication capability, which is a native capability of the programmable logic controller 00, reducing the complexity of product hardware, system and development.
[0045] For example, while adding a TCP / IP communication thread to the operating system inside the programmable logic controller 00, an Internet communication driver needs to be added to the runtime. Therefore, it needs to have runtime capability and real-time operating system capability to ultimately achieve external high-speed IO scanning and medium-to-low-speed data collaborative transmission.
[0046] Understandably, compared to related technologies that place protocol conversion outside the PLC and add gateway devices to achieve PLC cloud access, the programmable logic controller 00 provided in the embodiments of this invention has a high degree of integration, simple component and system structure, low overall system complexity, and direct communication between devices, reducing potential failure points and resulting in a lower failure rate. Furthermore, the programmable logic controller 00 directly processes data internally, using localized resources, reducing latency and error probability during data transmission, making fault diagnosis and troubleshooting relatively direct when problems occur. At the same time, due to its high structural consistency, maintenance and support are relatively simple, reducing the risk of failures caused by improper maintenance.
[0047] In some embodiments, such as Figure 3 As shown, network interface 2 includes a wide area network (WAN) interface 21 and a local area network (LAN) interface 22. The WAN interface 21 is used to connect to the communication module 6 and send MQTT messages to the communication module 6, enabling the communication module 6 to remotely transmit MQTT messages over the network. The LAN interface 22 is used to connect to each of the at least one external device 5 and to transmit data with each of the at least one external device.
[0048] For example, both the WAN interface 21 and the LAN interface 22 can be standard 8-bit modular interfaces, i.e., RJ45 interfaces. The WAN interface 21 and the communication module 6 enable the programmable logic controller 00 to connect to external devices or external networks.
[0049] In some embodiments, the local area network interface 22 is used to transmit data with each of the at least one external device 5 via the Modbus-RTU protocol.
[0050] Understandably, WAN interface 21 corresponds to the MQTT communication mode of WAN, and LAN interface 22 corresponds to the Modbus TCP communication mode of LAN.
[0051] In some embodiments, such as Figure 4 As shown, the programmable logic controller 00 also includes an input module 3. The input module 3 is used to connect to the central processing unit 1 and each of the at least one external device 5, receive data from each of the at least one external device 5, temporarily store the data from each of the at least one external device 5, and send the data from each of the at least one external device 5 to the central processing unit 1.
[0052] Understandably, the input module 3 can receive data from one of the at least one external devices 5 at a time, or it can receive data from multiple external devices 5 separately.
[0053] In some embodiments, such as Figure 5 As shown, the input module 3 includes an input interface 31 and an input image register 32. The input interface 31 is used to connect to each of the at least one external device 5, receive data from each of the at least one external device 5, and send data from each of the at least one external device 5 to the input image register 32. The input image register 32 is used to receive data from the input interface 31 and temporarily store the data from the input interface 31, so that the central processing unit 1 can read the data from the input interface 31 from the input image register 32.
[0054] Understandably, each external device 5 (such as sensors, buttons, etc.) needs to be connected to the input interface 31 via a wire. The input interface 31 processes these signals into signals that the central processing unit 1 can receive; that is, the input interface 31 can acquire signals and convert them into digital signals, storing them in the input image register 32. The central processing unit can read the data temporarily stored in the input image register 32, perform logical operations, sequential control, and other processing according to the user program, and store the results in the output image register 41.
[0055] In some embodiments, such as Figure 6 As shown, the programmable logic controller 00 also includes an output module 4. The output module 4 is used to connect to the central processing unit 1 and each of the at least one external device 5, and to send processed data to each of the at least one external device 5.
[0056] Understandably, the output module 4 can send processed data to one of the at least one external devices 5 at a time, or it can send processed data to multiple external devices 5 separately.
[0057] In some embodiments, such as Figure 7 As shown, the output module 4 includes an output image register 41 and an output interface 42. The output image register 41 receives processed data from the central processing unit 1, temporarily stores the processed data, and sends the temporarily stored processed data to the output interface 42. The output interface 42 is connected to at least one external device 5, receives the processed data from the output image register 41, and sends the processed data to each of the at least one external device 5.
[0058] In some embodiments, the programmable logic controller 00 further includes a power supply module (not shown). The power supply module is used to connect to an external power source to supply power to the central processing unit 1, the input module 3, and the output module 4.
[0059] For example, the power module 8 can be connected to a 220V power supply to provide power support for the various structures inside the programmable logic controller 00.
[0060] The following example illustrates a programmable logic controller provided by an embodiment of the present invention.
[0061] In this example, the structure of the programmable logic controller (hereinafter referred to as PLC) and the function of each component are as follows:
[0062] 1.1 Power switch (i.e. power module): Connects the PLC to a 220V power supply to provide power support for its internal units.
[0063] 1.2 Connection of External Devices to PLC Input Interface: First, external devices (such as sensors, buttons, etc.) need to be connected to the PLC's input interface via wiring. The input interface processes these signals into signals that the Central Processing Unit (CPU) can receive.
[0064] 1.3 Input / Output Interface: Next, the input interface acquires signals and converts them into digital signals, storing them in the input image register. For example... Figure 8As shown, the input / output interface may have multiple I / O modules (e.g., I / O point 1, I / O point 2, ..., I / O point 5). Each I / O point can be configured for a specific signal type (e.g., digital input / output, analog input / output) and is assigned a unique address or identifier (e.g., unique address A1, unique address A2, unique address B). In the PLC program, each I / O point has a unique address used to reference its value within the program. Through the address allocation table, the PLC can determine which addresses correspond to which external devices (e.g., device A, device B, device C) or signals.
[0065] 1.4 CPU Processing: The CPU then reads data from the input image register, performs logical operations and sequential control according to the user program, and stores the results in the output image register.
[0066] 1.5 Memory: The system memory stores the PLC's system program and system data to ensure the PLC operates normally; the user memory stores user-written programs and user data to implement specific control functions.
[0067] 1.6 MQTT / TCP Interface: Finally, the data to be transmitted is encapsulated into MQTT messages, including topics, payloads, etc., and the encapsulated data is sent to the specified destination via a network cable (RJ45 interface) using the MQTT protocol to realize remote data transmission.
[0068] 1.7 Indicator light function: Through different on / off states, it can intuitively display the current status of external devices or systems, provide operational feedback, and issue alarm signals when a fault occurs.
[0069] In use, the programmable logic controller in this example can be connected to a 5G communication module, such as... Figure 9 As shown, the connection method is as follows:
[0070] 2.1 Physical Connection: First, use a network cable with an RJ45 interface. Plug one end into the MQTT or TCP network interface of the PLC, and the other end into the RJ45 interface of the 5G communication module. This step ensures the physical connection between the PLC and the 5G communication module.
[0071] 2.2 Network Configuration: After connection, network configuration is required for the PLC and 5G communication module, including setting network parameters such as IP address, subnet mask, and gateway to ensure they can communicate with each other within the same network. This configuration is typically done through the PLC's programming software or the 5G communication module's configuration interface.
[0072] Connect the programmable logic controller in this example to the 5G communication module, such as... Figure 9 As shown, the data transmission process is as follows:
[0073] 3.1 SIM Card Slot: First, insert the IoT card. The IoT card provides network connectivity, ensuring that data can be transmitted and exchanged on the 5G network.
[0074] 3.2 RJ45: Next, data reception is performed. Once the PLC and 5G communication module are successfully connected and the network parameters are configured, the PLC can send data to the 5G communication module via the RJ45 interface. The 5G communication module receives this data through its built-in RJ45 interface.
[0075] 3.3 Baseband Processor: During this process, the data is first processed by the baseband chip to complete tasks such as signal encoding and modulation, converting the digital signal into a baseband signal suitable for transmission.
[0076] 3.4 RF front-end processing: The baseband signal enters the RF front-end and is filtered to remove noise and interference, ensuring signal purity.
[0077] 3.5 Filters: Next, filters are used to select signals within a specific frequency range and suppress unwanted interference and noise. In the receiver, filters suppress image frequency interference, ensure signal purity, reduce additional losses, and optimize overall performance.
[0078] 3.6 Power Amplifier: Next, the received weak signal is amplified by a power amplifier, while minimizing the noise it introduces, in order to improve the receiver's sensitivity.
[0079] 3.7 Antenna Transmission: The amplified signal is transmitted through the antenna and propagates in space in the form of radio waves.
[0080] 3.8 Wireless Transmission: Finally, the processed data is wirelessly transmitted via the wireless module of the 5G communication module. The 5G communication module uses the 5G network to transmit data to a remote server or other external devices. During transmission, the data undergoes encoding and modulation processes to adapt to the characteristics of the wireless channel.
[0081] 3.9 Remote Reception: Finally, the data is transmitted via the 5G network to a designated remote server or other receiving device. After receiving the data, the receiving device will perform decryption, decoding, and other processing to restore the original data.
[0082] like Figure 10 As shown, the overall workflow for connecting the programmable logic controller (PLC) in this example with the 5G communication module is described below:
[0083] 1. Device Sensing:
[0084] • Identify and verify the field process equipment, including the type, quantity, and communication protocols of the field process equipment.
[0085] 2. Scheme Analysis and Design:
[0086] • Design a suitable communication scheme based on the type of external device and the communication protocol, and select the Modbus-RTU protocol as the communication standard between the PLC and the external device.
[0087] 3. (Modbus-RTU protocol):
[0088] • Determine whether to use the Modbus-RTU protocol, and plan the settings for the master and slave stations, as well as the data transmission format and rate.
[0089] 4. Connect to the PLC and assign I / O points:
[0090] Connect the PLC to the external devices in the field and assign corresponding I / O points to ensure that each external device has a corresponding input / output point.
[0091] 5. Configure the PLC hardware system:
[0092] Configure the PLC hardware system, including communication modules, power supply modules, etc., according to requirements and design schemes.
[0093] 6. (MQTT--RJ45):
[0094] • The PLC and the host computer communicate using the MQTT protocol and are physically connected via an RJ45 interface.
[0095] 7.5G communication module:
[0096] • Integrates a 5G communication module to achieve high-speed and stable communication between the PLC and the remote application platform.
[0097] 8. Communication signal processing:
[0098] • Process communication signals to ensure data integrity and accuracy, while also performing functions such as signal amplification and filtering.
[0099] 9. (5G wireless network):
[0100] • Utilize 5G wireless network technology to achieve wireless connection and data transmission between PLC and remote application platform.
[0101] 10. Application Platform:
[0102] • Build an application platform to receive data uploaded by PLC, process, analyze and store it, and realize remote monitoring and control functions.
[0103] 11. Generate reports and issue commands:
[0104] • Generate corresponding reports based on the processed data for users to view and analyze; simultaneously, users can...
[0105] Understandably, the PLC in this example supports wired communication expansion such as RS485 and RS232; and wireless communication expansion such as Zigbee-Modbus, LoRa, and StarScan. Furthermore, the PLC in this example has 14 digital inputs, 10 digital outputs, and 1 Modbus-RTU, and can be expanded with up to 7 modules, reaching a maximum of 64 digital outputs and 112 digital / analog inputs, enabling plug-and-play functionality.
[0106] The communication method provided in the embodiments of the present invention is applied to the above-mentioned programmable logic controller 00, which includes a central processing unit 1 and a network interface 2. Figure 11 As shown, the communication method of the programmable logic controller includes steps 1101 to 1105.
[0107] Step 1101: The central processing unit acquires data from at least one external device.
[0108] Step 1102: The central processing unit runs the user program and performs calculations on the data from at least one external device to obtain the processed data and the data to be transmitted over the network.
[0109] In step 1102, the data to be transmitted over the network is obtained based on data from at least one external device.
[0110] Step 1103: The central processing unit transmits the processed data to at least one external device.
[0111] Step 1104: The central processing unit encapsulates the data to be transmitted over the network into an MQTT message and sends the MQTT message to the network interface.
[0112] In some embodiments, such as Figure 2 As shown, the programmable logic controller 00 also includes a memory 7, which is connected to the central processing unit 1 and is used to store system programs and system data. The memory 7 stores a TCP / IP communication thread, which is used to carry the MQTT protocol. The implementation method of step 1104 includes: the central processing unit running the TCP / IP communication thread, encapsulating the data to be transmitted over the network into an MQTT message, and sending the MQTT message to the network interface.
[0113] Step 1105: The network interface sends an MQTT message to the communication module, so that the communication module can remotely transmit the MQTT message through the network and transmit data with each of the at least one external device.
[0114] In some embodiments, such as Figure 3 As shown, network interface 2 includes a wide area network (WAN) interface 21 and a local area network (LAN) interface 22. WAN interface 21 is connected to communication module 6, and LAN interface 22 is connected to each of the at least one external device 5. The implementation method of step 1105 includes: WAN interface 21 sending an MQTT message to communication module 6, enabling communication module 6 to remotely transmit the MQTT message via the network; and LAN interface 22 transmitting data with each of the at least one external device.
[0115] In some embodiments, the local area network interface 22 transmits data with each of the at least one external device via the Modbus-RTU protocol.
[0116] In some embodiments, such as Figure 4 As shown, the programmable logic controller 00 further includes an input module 3. The input module 3 is connected to the central processing unit 1 and each of the at least one external device 5. The method further includes: the input module 3 receiving data from each of the at least one external device 5, temporarily storing the data from each of the at least one external device 5, and sending the data from each of the at least one external device 5 to the central processing unit 1.
[0117] In some embodiments, such as Figure 5 As shown, the input module 3 includes an input interface 31 and an input image register 32. The input interface 31 is connected to each of the at least one external device 5. The specific implementation of the input module 3 receiving data from each of the at least one external device 5, temporarily storing the data from each of the at least one external device 5, and sending the data from each of the at least one external device 5 to the central processing unit 1 includes: the input interface 31 receiving data from each of the at least one external device 5 and sending the data from each of the at least one external device 5 to the input image register 32. The input image register 32 receives data from the input interface 31 and temporarily stores the data from the input interface 31, so that the central processing unit 1 can read the data from the input interface 31 from the input image register 32.
[0118] In some embodiments, such as Figure 6As shown, the programmable logic controller 00 also includes an output module 4. The output module 4 is connected to the central processing unit 1 and each of the at least one external device 5. The method further includes: the output module 4 sending processed data to each of the at least one external device 5.
[0119] In some embodiments, such as Figure 7 As shown, the output module 4 includes an output image register 41 and an output interface 42. The output interface 42 is connected to each of the at least one external device 5. The method for the output module 4 to send processed data to each of the at least one external device 5 includes: the output image register 41 receiving processed data from the central processing unit 1, temporarily storing the processed data, and sending the processed data temporarily stored in the output image register 41 to the output interface 42. The output interface 42 receiving the processed data from the output image register 41 and sending the processed data to each of the at least one external device 5.
[0120] The specific scheme and beneficial effects of the communication method of a programmable logic controller provided by the embodiments of the present invention can be found in the relevant description of a programmable logic controller 00 provided by the embodiments of the present invention, and will not be repeated here.
[0121] It is understood that the above embodiments are merely exemplary implementations used to illustrate the principles of the present invention, and the present invention is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A programmable logic controller, characterized in that, include: A central processing unit (CPU) is used to acquire data from at least one external device; run a user program and perform calculations on the data from the at least one external device to obtain processed data and data to be transmitted over the network. Transmit processed data to at least one external device; and encapsulate the data to be transmitted over the network into a Message Queued Telemetry Transmission (MQTT) message and send the MQTT message to a network interface; wherein the data to be transmitted over the network is obtained based on the data from the at least one external device; A memory, connected to the central processing unit (CPU), is used to store system programs and system data. The memory also stores a TCP / IP communication thread, which carries the MQTT protocol. The CPU is also used to run the TCP / IP communication thread and add an internet communication driver to the runtime to enable high-speed external I / O scanning and coordinated transmission of medium- and low-speed data. The CPU encapsulates the data to be transmitted over the network into an MQTT message and sends the MQTT message to the network interface. The network interface is used to connect to the communication module and send the MQTT message to the communication module so that the communication module can remotely transmit the MQTT message through the network; and is used to connect to each of the at least one external device and transmit data with each of the at least one external device respectively. The network interface includes: A wide area network (WAN) interface is used to connect to the communication module and send the MQTT message to the communication module, enabling the communication module to remotely transmit the MQTT message over the network; and A local area network interface is provided for connecting to each of the at least one external device and for transmitting data with each of the at least one external device. Both the WAN interface and the LAN interface are standard 8-bit modular interfaces.
2. The programmable logic controller according to claim 1, characterized in that, The local area network interface is used to transmit data with each of the at least one external device via the Modbus-RTU serial communication protocol.
3. The programmable logic controller according to claim 1, characterized in that, Also includes: An input module is configured to connect to the central processing unit and each of the at least one external device, receive data from each of the at least one external device, temporarily store the data from each of the at least one external device, and send the data from each of the at least one external device to the central processing unit.
4. The programmable logic controller according to claim 3, characterized in that, The input module includes: An input interface is configured to connect to each of the at least one external device, receive data from each of the at least one external device, and send the data from each of the at least one external device to an input image register; and The input image register is used to receive data from the input interface and temporarily store the data from the input interface so that the central processing unit can read the data from the input interface from the input image register.
5. The programmable logic controller according to claim 3, characterized in that, Also includes: An output module is configured to connect to the central processing unit and each of the at least one external device, respectively, and to send the processed data to each of the at least one external device.
6. The programmable logic controller according to claim 5, characterized in that, The output module includes: An output image register is used to receive the processed data from the central processing unit, temporarily store the processed data, and send the processed data temporarily stored in the output image register to the output interface; and The output interface is configured to connect to each of the at least one external device, receive the processed data from the output image register, and send the processed data to each of the at least one external device.
7. The programmable logic controller according to claim 5, characterized in that, Also includes: A power supply module is used to connect to an external power source and to supply power to the central processing unit, the input module, and the output module.
8. A communication method for a programmable logic controller, characterized in that, Applied to a programmable logic controller, the programmable logic controller including a central processing unit, a memory and a network interface; The memory stores a TCP / IP communication thread, which is used to carry the MQTT protocol; the method includes: The central processing unit acquires data from at least one external device; The central processing unit runs a user program and processes the data from at least one external device to obtain processed data and data to be transmitted over the network; the data to be transmitted over the network is obtained based on the data from at least one external device. The central processing unit transmits processed data to at least one external device; The central processing unit (CPU) encapsulates the data to be transmitted over the network into an MQTT message and sends the MQTT message to the network interface; specifically, the CPU runs a TCP / IP communication thread to achieve external high-speed I / O scanning and medium-to-low-speed data collaborative transmission, encapsulates the data to be transmitted over the network into an MQTT message, and sends the MQTT message to the network interface; and The network interface sends the MQTT message to the communication module, enabling the communication module to remotely transmit the MQTT message via the network and perform data transmission with each of the at least one external device; wherein, the network interface includes a wide area network (WAN) interface and a local area network (LAN) interface; both the WAN interface and the LAN interface are standard 8-bit modular interfaces; the method further includes: the WAN interface sending the MQTT message to the communication module, enabling the communication module to remotely transmit the MQTT message via the network; and the LAN interface performing data transmission with each of the at least one external device.
Citation Information
Patent Citations
System monitoring method based on industrial internet cloud platform, electronic equipment and medium
CN115550464A
Control architecture including a programmable logic controller and a cloud computing system
US20170108844A1