TCP communication method and device based on Omron FINS command protocol

Through the TCP communication method based on Omron FINS command protocol, the problems of low efficiency and poor convenience of communication between traditional superior computers and PLCs are solved, efficient data interaction and compatibility are achieved, and the communication process is simplified and maintenance efficiency is improved.

CN118714200BActive Publication Date: 2025-01-03SHENZHEN HERUNDA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411187205.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2025-01-03
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

The traditional communication method between the host computer and PLC is inefficient and has poor convenience, especially the compatibility problem between multi-brand PLCs is relatively complicated, which makes the installation and configuration time-consuming and labor-intensive and prone to parameter setting errors.

Method used

Adopt the TCP communication method based on Omron FINS command protocol, through communication object creation, communication connection establishment and handshake operation, to achieve efficient data reading and writing interaction between the target programmable controller and the communication object, avoid the use of OPC software, and solve multi-brand PLC compatibility issues.

Benefits of technology

It improves the data reading and writing efficiency and convenience between the PLC and the host computer, simplifies the communication process, reduces maintenance complexity, solves the compatibility problem of OPC software, and improves the maintenance efficiency of application software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714200B_ABST
    Figure CN118714200B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of logistics automation technology, and discloses a TCP communication method and device based on the Omron FINS command protocol, the method comprising: executing corresponding communication object creation operations according to the communication address information and communication port information of the determined target programmable controller to obtain the target communication object; executing corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to the preset communication command handshake protocol; executing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to the preset data read-write protocol format. It can be seen that the implementation of the present invention can improve the data read-write efficiency and convenience of the target programmable controller and the target communication object, thereby improving the efficiency and convenience of TCP communication, and also improving the maintenance efficiency of application software. Further, there is no need to use OPC software to solve the OPC compatibility problem when communicating with other brands and models of PLCs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of logistics automation, and in particular to a TCP communication method and device based on the Omron FINS command protocol. Background Art

[0002] With the continuous development of current computer technology, in the process of automatic control, the host computer and the slave computer need to communicate and transmit a large amount of data, specifically, including the interactive communication between the host computer and Omron PLC. The interactive communication between the host computer and PLC plays an important role in the field of industrial automation.

[0003] The traditional interactive communication method between the host computer and PLC is: when the host computer control software needs to communicate with more than two brands of PLC, it is generally necessary to install the corresponding OPC configuration software to achieve interactive communication. However, the OPC configuration software of each PLC manufacturer has problems such as cumbersome installation and configuration, time-consuming and labor-intensive configuration, strict requirements on the operating system, and difficulty in compatibility between multiple devices. In addition, the communication parameters between the PLC and the host computer are easily set incorrectly or incompatible, which makes the interactive communication efficiency and convenience between the host computer and the PLC low.

[0004] It can be seen that it is particularly important to provide a new interactive communication method between the host computer and PLC to improve the efficiency and convenience of interactive communication. Summary of the invention

[0005] The present invention provides a TCP communication method and device based on the Omron FINS command protocol, which can improve communication efficiency and communication convenience.

[0006] In order to solve the above technical problems, the first aspect of the present invention discloses a TCP communication method based on the Omron FINS command protocol, the method comprising:

[0007] According to the communication address information and communication port information of the determined target programmable controller, a corresponding communication object creation operation is performed to obtain the target communication object;

[0008] According to a preset communication command handshake protocol, corresponding communication connection establishment and handshake operations are performed on the target programmable controller and the target communication object;

[0009] According to the preset data read and write protocol format, corresponding read and write interactive control operations are performed on the target programmable controller and the target communication object.

[0010] The second aspect of the present invention discloses a TCP communication device based on the Omron FINS command protocol, the device comprising:

[0011] The communication object creation module is used to perform corresponding communication object creation operations according to the communication address information and communication port information of the determined target programmable controller to obtain the target communication object;

[0012] A communication connection and handshake module, used to perform corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to a preset communication command handshake protocol;

[0013] The data reading and writing module is used to perform corresponding reading and writing interactive control operations on the target programmable controller and the target communication object according to a preset data reading and writing protocol format.

[0014] As an optional implementation, in the second aspect of the present invention, the device further includes:

[0015] A handshake judgment module is used to determine first protocol format feedback information according to the communication connection establishment and handshake operation after the communication connection and handshake module performs corresponding communication connection establishment and handshake operation on the target programmable controller and the target communication object according to a preset communication command handshake protocol; judge whether the target programmable controller and the target communication object meet a preset handshake success condition according to the first protocol format feedback information; when it is judged that the target programmable controller and the target communication object meet the handshake success condition, the data read and write module executes the steps of performing corresponding read and write interactive control operations on the target programmable controller and the target communication object according to the preset data read and write protocol format.

[0016] As an optional implementation, in the second aspect of the present invention, the handshake judgment module judges whether the target programmable controller and the target communication object meet the preset handshake success condition according to the first protocol format feedback information in a manner specifically including:

[0017] Determine, according to the first protocol format feedback information, a first feedback content for the error code item, and determine a preset first handshake success content for the error code item;

[0018] Determining whether the first feedback content matches the first handshake success content;

[0019] When it is determined that the first feedback content matches the first handshake success content, determining that the target programmable controller and the target communication object meet a preset handshake success condition;

[0020] When it is determined that the first feedback content does not match the first handshake success content, it is determined that the target programmable controller and the target communication object do not meet a preset handshake success condition.

[0021] As an optional implementation, in the second aspect of the present invention, the communication connection and handshake module performs corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to a preset communication command handshake protocol, specifically including:

[0022] According to a preset communication command handshake protocol, controlling the target communication object to send information in a first protocol format to the target programmable controller to establish a communication connection between the target communication object and the target programmable controller;

[0023] According to the communication command handshake protocol, control the target communication object and the target programmable controller to perform a corresponding handshake operation, and according to the handshake operation, control the target programmable controller to send feedback information in a first protocol format to the target communication object;

[0024] The first protocol format feedback information at least includes an error code item and its corresponding feedback content, and the feedback content corresponding to the error code item is used to indicate the handshake status between the target communication object and the target programmable controller.

[0025] As an optional implementation, in the second aspect of the present invention, the data reading and writing module performs corresponding read and write interactive control operations on the target programmable controller and the target communication object according to a preset data reading and writing protocol format, specifically including:

[0026] Determine the network number information of the target programmable controller according to the communication connection establishment and handshake operation;

[0027] Generate a target protocol instruction according to the network number information, a preset data read and write protocol format and the determined read and write related information, wherein the target protocol instruction includes a read protocol instruction and / or a write protocol instruction;

[0028] Controlling the target communication object to send the target protocol instruction to the target programmable controller;

[0029] According to the target protocol instruction, performing corresponding read and / or write operations on the target programmable controller to obtain target protocol format feedback information;

[0030] The target programmable controller is controlled to send the target protocol format feedback information to the target communication object.

[0031] As an optional implementation, in the second aspect of the present invention, the data reading and writing module generates a target protocol instruction according to the network number information, the preset data reading and writing protocol format and the determined reading and writing related information, specifically including:

[0032] When the data communication demand is a demand for reading data, the address information and length information of each target read object are determined according to the determined read-write related information, and the read protocol item requirement information is determined according to the preset data read-write protocol format; the first starting address information is determined according to the address information of each of the target read objects, and the comprehensive read length result is determined according to the length information of each of the target read objects; a read protocol instruction is generated according to the network number information, the preset data read-write protocol format, the first starting address information, the comprehensive read length result and the read protocol item requirement information to determine the target protocol instruction;

[0033] When the data communication requirement is a data write requirement, the address information and data length information of each target write object are determined according to the determined read-write related information, and the write protocol item requirement information is determined according to the preset data read-write protocol format; the second starting address information is determined according to the address information of each of the target write objects, and the comprehensive write length result is determined according to the data length information of each of the target write objects; a write protocol instruction is generated according to the network number information, the preset data read-write protocol format, the second starting address information, the comprehensive write length result and the write protocol item requirement information to determine the target protocol instruction.

[0034] As an optional implementation, in the second aspect of the present invention, the data reading module performs corresponding read and / or write operations on the target programmable controller according to the target protocol instruction, and the method of obtaining the target protocol format feedback information specifically includes:

[0035] Determine one or more read / write objects according to the target protocol instruction and the target programmable controller, and determine the read / write mode type corresponding to the read / write object;

[0036] When the read-write mode type is a one-by-one read-write type, corresponding read and / or write operations are performed on all the read-write objects one by one to obtain target protocol format feedback information;

[0037] When the read-write mode type is a continuous read-write type, corresponding comprehensive read and / or comprehensive write operations are performed on all the read-write objects according to the determined data communication requirements to obtain target protocol format feedback information.

[0038] As an optional implementation, in the second aspect of the present invention, the data reading module performs corresponding comprehensive reading and / or comprehensive writing operations on all the read-write objects according to the determined data communication requirements, and the method of obtaining the target protocol format feedback information specifically includes:

[0039] When the determined data communication demand is a read data demand, a read object is determined from all the read-write objects, and according to the target protocol instruction, first starting address information, a comprehensive read length result and read protocol item demand information are determined; according to the first starting address information, the comprehensive read length result and the read protocol item demand information, corresponding continuous read operations are performed on all the read objects to obtain target protocol format feedback information;

[0040] When the determined data communication requirement is a write data requirement, a write object is determined from all the read-write objects, and according to the target protocol instruction, the second starting address information, the comprehensive write length result and the write protocol item requirement information are determined; according to the second starting address information, the comprehensive write number result and the write protocol item requirement information, corresponding continuous write operations are performed on all the write objects to obtain the target protocol format feedback information.

[0041] As an optional implementation, in the second aspect of the present invention, the device further includes:

[0042] A read-write feedback module, for determining second protocol format feedback information for data reading according to the read-write interactive control operation after the data read-write module performs corresponding read-write interactive control operations on the target programmable controller and the target communication object according to a preset data read-write protocol format; determining whether the target programmable controller and the target communication object meet preset read success conditions according to the second protocol format feedback information; and performing corresponding unsuccessful read processing operations according to the second protocol format feedback information when it is determined that the target programmable controller and the target communication object do not meet the read success conditions;

[0043] When the read-write interactive control operation includes an operation for writing data, third protocol format feedback information for writing the data is determined according to the read-write interactive control operation; based on the third protocol format feedback information, it is judged whether the target programmable controller and the target communication object meet the preset write success conditions; when it is judged that the target programmable controller and the target communication object do not meet the write success conditions, a corresponding unsuccessful writing processing operation is performed according to the third protocol format feedback information.

[0044] The third aspect of the present invention discloses another TCP communication device based on the Omron FINS command protocol, the device comprising:

[0045] A memory storing executable program code;

[0046] a processor coupled to the memory;

[0047] The processor calls the executable program code stored in the memory to execute the TCP communication method based on the Omron FINS command protocol disclosed in the first aspect of the present invention.

[0048] The fourth aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the TCP communication method based on the Omron FINS command protocol disclosed in the first aspect of the present invention.

[0049] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0050] In the embodiment of the present invention, according to the communication address information and communication port information of the determined target programmable controller, the corresponding communication object creation operation is performed to obtain the target communication object; according to the preset communication command handshake protocol, the corresponding communication connection establishment and handshake operation are performed on the target programmable controller and the target communication object; according to the preset data read and write protocol format, the corresponding read and write interactive control operation is performed on the target programmable controller and the target communication object. It can be seen that the present invention can realize TCP communication through the communication object creation operation, the communication connection establishment and handshake operation, and the read and write interactive control operation, which is conducive to improving the comprehensiveness and rationality of the TCP communication mode, and then it is conducive to improving the data reading and writing efficiency and convenience of the target programmable controller and the target communication object, so as to improve the efficiency and convenience of TCP communication, and also help to improve the maintenance efficiency of application software, further, without using OPC software, solve the OPC compatibility problem when communicating with other brands and models of PLCs. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0052] Figure 1 It is a flow chart of a TCP communication method based on the Omron FINS command protocol disclosed in an embodiment of the present invention;

[0053] Figure 2 It is a flow chart of another TCP communication method based on the Omron FINS command protocol disclosed in an embodiment of the present invention;

[0054] Figure 3 It is a structural schematic diagram of a TCP communication device based on the Omron FINS command protocol disclosed in an embodiment of the present invention;

[0055] Figure 4 It is a structural schematic diagram of another TCP communication device based on the Omron FINS command protocol disclosed in an embodiment of the present invention;

[0056] Figure 5 It is a structural schematic diagram of another TCP communication device based on the Omron FINS command protocol disclosed in an embodiment of the present invention;

[0057] Figure 6 It is a flow chart of another TCP communication method based on the Omron FINS command protocol disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.

[0060] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0061] The present invention discloses a TCP communication method based on the Omron FINS command protocol, which can realize TCP communication through communication object creation operation, communication connection establishment and handshake operation, and read-write interactive control operation, which is conducive to improving the comprehensiveness and rationality of the TCP communication mode, and then is conducive to improving the data reading and writing efficiency and convenience of the target programmable controller and the target communication object, thereby helping to improve the efficiency and convenience of TCP communication, and is also conducive to improving the maintenance efficiency of application software, and further, without using OPC software, solves the OPC compatibility problem when communicating with other brand models of PLC. Detailed descriptions are given below.

[0062] Embodiment 1

[0063] See also Figure 1 , Figure 1 1 is a flow chart of a TCP communication method based on the Omron FINS command protocol disclosed in an embodiment of the present invention. Figure 1 The described method can be applied to a TCP communication method based on the Omron FINS command protocol, wherein the device may include a server, wherein the server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 1 As shown, the TCP communication method based on the Omron FINS command protocol includes the following operations:

[0064] 101. According to the communication address information and communication port information of the determined target programmable controller, a corresponding communication object creation operation is performed to obtain a target communication object.

[0065] Optionally, the target programmable controller may be a PLC or other programmable controller, which is not limited in the embodiment of the present invention.

[0066] Optionally, the target communication object may be a Socket object, or other objects capable of implementing the same function, which is not limited in the embodiment of the present invention.

[0067] Optionally, for the target programmable controller and the target communication object, an example is given: the IP address (i.e., communication address information) of the target programmable controller PLC is 192.168.1.10, the port number (i.e., communication port information) is 9600, and the IP of the PC is 192.168.1.21, then a Socket object (i.e., target communication object) with IP=192.168.1.10 and port=9600 is created, and the embodiment of the present invention is not limited thereto.

[0068] Optionally, the communication address information of the target programmable controller may include but is not limited to the IP address information of the target programmable controller and / or the IP address information of a PC communicating with the target programmable controller, which is not limited in the embodiment of the present invention.

[0069] Optionally, the target communication object may include one or more of a read object, a write object, or a read-write object, which is not limited in the embodiment of the present invention.

[0070] 102. According to the preset communication command handshake protocol, corresponding communication connection establishment and handshake operations are performed on the target programmable controller and the target communication object.

[0071] Optionally, the communication command handshake protocol may be understood as a handshake protocol of a FINS command, which is not limited in the embodiment of the present invention.

[0072] Optionally, the above-mentioned corresponding communication connection establishment and handshake operations are performed on the target programmable controller and the target communication object. For example: the target communication object establishes communication with the target programmable controller according to the handshake protocol of the FINS command, and the protocol format content sent by the target communication object can be referred to as shown in Table 1-1, and the protocol format content fed back by the target programmable controller can be referred to as shown in Table 1-2. Specifically, the target communication object sends protocol information, and the target programmable controller feeds back protocol information. It is determined whether the handshake is successful based on the feedback protocol format. When the content fed back by the target programmable controller can indicate that the handshake is successful, it is determined that the communication connection between the target programmable controller and the target communication object is established and the handshake is successful. Further, for example, the content of the handshake instruction sent is: 46494E53 0000000C 00000000 0000000000000015, where 00000015 is the hexadecimal value of the last digit (21) of the IP address of the PC; determine whether the handshake is successful according to the feedback protocol format (the error code is 00000000 and the PLC end node number is the current PLC node number, indicating success). For example, in the instruction sent above, when the PLC feedback content is: 46494E53 00000010 00000001 00000000 000000150000000A, it indicates that the handshake is successful, where 0000000A is the hexadecimal value of the last digit (10) of the IP address of the PLC, that is, the PLC end node number, which is not limited in the embodiment of the present invention.

[0073] Optional, as shown in Table 1-1:

[0074]

[0075] Optional, Table 1-2 is as follows:

[0076]

[0077] 103. According to the preset data read and write protocol format, corresponding read and write interactive control operations are performed on the target programmable controller and the target communication object.

[0078] Optional, such as Figure 6 As shown, this solution may include creating a communication object, establishing a communication connection and establishing a PLC handshake, determining whether the handshake is successful, performing PLC reading / PLC writing if the handshake is successful, determining whether the communication is normal, performing read result processing / writing result processing if the communication is normal; if the handshake is unsuccessful, re-establishing the communication connection and establishing a PLC handshake; if the communication is abnormal, re-establishing the communication connection and establishing a PLC handshake, which is not limited in the embodiments of the present invention.

[0079] Optionally, the data reading and writing protocol format may be a data reading protocol format of a FINS command or a data writing protocol format of a FINS command, which is not limited in the embodiment of the present invention.

[0080] Optionally, the above performs corresponding read and write interactive control operations on the target programmable controller and the target communication object, for example:

[0081] (1) For data reading, the control target communication object is organized according to the data reading protocol format of the FINS command and sends instructions to read the PLC. The sent protocol format content can be referred to as shown in Table 1-3. The protocol format content fed back by the control target programmable controller can be referred to as shown in Table 1-4. For example, to read an address starting from D100, the instruction content sent by the target communication object is: 46494E53 0000001A 00000002 00000000 80 00 02 000A00 001500 FF 010182 006400 0001; judge whether it is successful according to the feedback protocol format (the read flag is equal to 0000 for success), for example, the feedback content is: 46494E53 00000018 00000002 00000000 C0 00 02 000A00 001500 FF 0101 0000D204, then the result of parsing the read value is 1234 (D204 in hexadecimal), which is not limited in the embodiment of the present invention.

[0082] Optional, Table 1-3 is as follows:

[0083]

[0084] Optional, Table 1-4 is as follows:

[0085]

[0086] Further optionally, the above-mentioned corresponding read and write interactive control operations are performed on the target programmable controller and the target communication object, for example:

[0087] (2) For data writing, the control target communication object organizes the data writing protocol format of the FINS command and sends instructions to write to the PLC. The sent protocol format content can be referred to as shown in Table 1-5. The protocol format content fed back by the control target programmable controller can be referred to as shown in Table 1-6. For example, if the string "abcd" (hexadecimal 62616463) is written to D10, the instruction content sent by the Socket object is: 46494E53 0000001C 00000002 00000000 80 00 02000A00 001500 FF 0101 82 000A00 0002 62616463; judge whether it is successful according to the feedback protocol format (the write success flag equals 0000, indicating success). For example, the feedback content is: 46494E53 00000016 00000002 00000000C0 00 02 000A00 001500 FF 0102 0000 indicates that the writing is successful, which is not limited in the embodiment of the present invention.

[0088] Optional, Table 1-5 is as follows:

[0089]

[0090] Optional, Table 1-6 is as follows:

[0091]

[0092] Optionally, the PC of this solution does not need to install OPC software, and can communicate after installing the operating system and configuring the IP. In addition, it saves the highly professional work such as installing OPC software and configuring, effectively improving maintenance efficiency, which is not limited in the embodiments of the present invention.

[0093] It can be seen that the TCP communication method based on the Omron FINS command protocol described in the embodiment of the present invention can realize TCP communication through communication object creation operation, communication connection establishment and handshake operation, and read-write interactive control operation, which is beneficial to improving the comprehensiveness and rationality of the TCP communication method, and further beneficial to improving the data reading and writing efficiency and convenience between the target programmable controller and the target communication object, thereby helping to improve the efficiency and convenience of TCP communication, and also helping to improve the maintenance efficiency of application software. Furthermore, there is no need to use OPC software to solve the OPC compatibility problem when communicating with PLCs of other brands and models.

[0094] In an optional embodiment, the above-mentioned performing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to the preset data read-write protocol format may include:

[0095] According to the communication connection establishment and handshake operation, determine the network number information of the target programmable controller;

[0096] Generate a target protocol instruction according to the network number information, the preset data read and write protocol format and the determined read and write related information, the target protocol instruction including a read protocol instruction and / or a write protocol instruction;

[0097] Control the target communication object to send target protocol instructions to the target programmable controller;

[0098] According to the target protocol instruction, the corresponding read and / or write operation is performed on the target programmable controller to obtain the feedback information in the target protocol format;

[0099] The control target programmable controller sends feedback information in the target protocol format to the target communication object.

[0100] Optionally, the read-write related information may include but is not limited to one or more of a PC network number, an instruction code, an address offset, read-write content and other information, and the embodiment of the present invention does not limit this.

[0101] Optionally, the protocol content corresponding to the read protocol instruction may include but is not limited to specific item types, the content of each item and a description; further, the specific item types may include but are not limited to instruction header, instruction length, instruction content, error code, ICF, RSV, GCT, PLC network address, PLC node address, PLC unit address, PC network address, PC node address, PC unit address, SID, read instruction, read address area, starting address, read length and one or more of other item types, which are not limited in the embodiments of the present invention.

[0102] Optionally, the protocol content corresponding to the write protocol instruction may include but is not limited to specific item types, the content of each item and a description; further, the specific item type may include but is not limited to instruction header, instruction length, instruction content, error code, ICF, RSV, GCT, PLC network address, PLC node address, PLC unit address, PC network address, PC node address, PC unit address, SID, write instruction, write address area, starting address, write number, write data and one or more of other item types, which are not limited in the embodiments of the present invention.

[0103] Optionally, the target protocol format feedback information may include read protocol feedback information and / or write protocol feedback information, which is not limited in the embodiment of the present invention.

[0104] Optionally, the read protocol feedback information may include but is not limited to specific item types, content and description of each item; further, the specific item types may include but are not limited to instruction header, instruction length, instruction content, error code, ICF, RSV, GCT, PLC network address, PLC node address, PLC unit address, PC network address, PC node address, PC unit address, SID, read instruction, read success flag, read value and one or more other item types, which are not limited in the embodiments of the present invention.

[0105] Optionally, the write protocol feedback information may include but is not limited to specific item types, content and description of each item; further, specific item types may include but are not limited to instruction header, instruction length, instruction content, error code, ICF, RSV, GCT, PLC network address, PLC node address, PLC unit address, PC network address, PC node address, PC unit address, SID, write instruction, write success flag, read value and one or more of other item types, which are not limited in the embodiments of the present invention.

[0106] It can be seen that this optional embodiment can generate target protocol instructions, and based on the target protocol instructions, control the target programmable controller and the target communication object to perform interactive reading and / or interactive writing operations, which is conducive to improving the comprehensiveness and rationality of the target protocol instruction generation method, and thus is conducive to improving the pertinence, accuracy and reliability of the determined target protocol instructions. In addition, it is conducive to improving the comprehensiveness and rationality of the interactive reading / writing method between the programmable controller and the communication object, and thus is conducive to improving the interactive accuracy, interactive efficiency and interactive convenience between the programmable controller and the communication object, reducing the number of interactions, and improving the performance of the programmable controller to a certain extent, which is conducive to improving the write / read efficiency and convenience of the programmable controller and the communication object.

[0107] In another optional embodiment, the above-mentioned generating the target protocol instruction according to the network number information, the preset data read and write protocol format and the determined read and write related information may include:

[0108] When the data communication demand is a demand for reading data, the address information and length information of each target read object are determined according to the determined read-write related information, and the read protocol item requirement information is determined according to the preset data read-write protocol format; the first starting address information is determined according to the address information of each target read object, and the comprehensive read length result is determined according to the length information of each target read object; the read protocol instruction is generated according to the network number information, the preset data read-write protocol format, the first starting address information, the comprehensive read length result and the read protocol item requirement information to determine the target protocol instruction;

[0109] When the data communication requirement is a data write requirement, the address information and data length information of each target write object are determined according to the determined read-write related information, and the write protocol item requirement information is determined according to the preset data read-write protocol format; the second starting address information is determined according to the address information of each target write object, and the comprehensive write length result is determined according to the data length information of each target write object; a write protocol instruction is generated according to the network number information, the preset data read-write protocol format, the second starting address information, the comprehensive write length result and the write protocol item requirement information to determine the target protocol instruction.

[0110] Optionally, the specific read protocol item corresponding to the read protocol item requirement information may refer to but not be limited to the specific item content corresponding to the read protocol instruction mentioned above, and the embodiment of the present invention does not limit this.

[0111] Optionally, the specific write protocol item corresponding to the write protocol item requirement information may refer to but not be limited to the specific item content corresponding to the write protocol instruction mentioned above, and the embodiment of the present invention does not limit this.

[0112] Optionally, the first starting address information is determined based on the address information of each target read object. For example, the address of the first read object among all target read objects is determined as the first starting address information, which is not limited in the embodiment of the present invention.

[0113] Optionally, the above-mentioned determination of the comprehensive read length result based on the length information of each target read object is illustrated by taking the sum of the lengths of all the read objects as the comprehensive read length result, which is not limited in the embodiment of the present invention.

[0114] Optionally, the second starting address information is determined based on the address information of each target write object. For example, the address of the first write object in all target read objects is determined as the second starting address information, which is not limited in the embodiment of the present invention.

[0115] Optionally, the above-mentioned comprehensive write length result is determined based on the data length information of each target write object. For example, the sum of the data lengths of all target write objects is determined as the comprehensive write length result, and the embodiment of the present invention is not limited to this.

[0116] Optionally, by determining the starting address information and the comprehensive length result, data can be read back or written to the PLC at one time, greatly improving the reading and writing efficiency, while also reducing the number of interactions with the PLC, alleviating the internal processing burden of the PLC, and improving the operating performance of the PLC, which is not limited in the embodiments of the present invention.

[0117] Optionally, the method for generating the target protocol instruction may also be: setting the starting address to the address of the first read / write object, and then: 1) if it is reading data, then the read length is set to the sum of the lengths of all read objects; if it is writing data, then the number of writes is set to the sum of the number of data of all write objects, and the content of the write data is in accordance with the protocol requirements to generate the target protocol instruction, which is not limited in the embodiments of the present invention.

[0118] It can be seen that this optional embodiment can match the corresponding target protocol instruction generation method according to the data communication demand for reading data or according to the data communication demand for writing data, which is conducive to improving the comprehensiveness and rationality of the target protocol instruction generation method, and is also conducive to improving the diversity, flexibility and selectivity of the target protocol instruction generation method, and thus is conducive to improving the accuracy and reliability of the generated target protocol instructions, thereby helping to improve the accuracy and efficiency of data reading / data writing based on the target protocol instructions.

[0119] In yet another optional embodiment, the above-mentioned performing corresponding read and / or write operations on the target programmable controller according to the target protocol instruction to obtain the target protocol format feedback information may include:

[0120] According to the target protocol instruction and the target programmable controller, one or more read / write objects are determined, and the read / write mode type corresponding to the read / write objects is determined;

[0121] When the read / write mode type is a one-by-one read / write type, corresponding read and / or write operations are performed on all read / write objects one by one to obtain feedback information in the target protocol format;

[0122] When the read / write mode type is a continuous read / write type, corresponding comprehensive read and / or comprehensive write operations are performed on all read / write objects according to the determined data communication requirements to obtain target protocol format feedback information.

[0123] Optionally, the above-mentioned corresponding reading and / or writing operations are performed on all read-write objects one by one, for example: PLC objects are read and / or written one by one, and the embodiment of the present invention is not limited to this.

[0124] Optionally, the above-mentioned corresponding comprehensive read and / or comprehensive write operations are performed on all read-write objects. For example, all objects are read and / or written at one time through the address of the first object and the total length of all objects read and / or written. The embodiment of the present invention is not limited to this.

[0125] Further optional, for the one-by-one reading method and the continuous reading method (i.e., comprehensive reading), an example is given: assuming that 100 conveyor segments are read, each conveyor segment has 4 reading objects, such as equipment status, destination station, pallet barcode, and pallet status. The reading time of each object is 5ms (the actual time consumption will vary with the CPU processing performance of the PLC, the network environment, etc.). The statistics are shown in the form of a chart as follows, refer to the following Table 1-7:

[0126]

[0127] It can be seen that this optional embodiment can match the corresponding target protocol format feedback information determination method for the read-write mode type of one-by-one read-write type and the read-write mode type of continuous read-write type, which is beneficial to improving the comprehensiveness and rationality of the protocol format feedback information determination method, and is also beneficial to improving the diversity, flexibility and selectivity of the protocol format feedback information determination method, and further helps to improve the accuracy and reliability of the determined protocol format feedback information, thereby helping to improve the accuracy and effectiveness of the data reading / data writing effect determined based on the protocol format feedback information.

[0128] In yet another optional embodiment, the above-mentioned performing corresponding comprehensive read and / or comprehensive write operations on all read / write objects according to the determined data communication requirements to obtain the target protocol format feedback information may include:

[0129] When the determined data communication demand is a read data demand, a read object is determined from all read-write objects, and according to the target protocol instruction, first starting address information, a comprehensive read length result, and read protocol item demand information are determined; according to the first starting address information, the comprehensive read length result, and the read protocol item demand information, corresponding continuous read operations are performed on all read objects to obtain target protocol format feedback information;

[0130] When the determined data communication requirement is a write data requirement, the write object is determined from all read-write objects, and according to the target protocol instruction, the second starting address information, the comprehensive write length result and the write protocol item requirement information are determined; according to the second starting address information, the comprehensive write number result and the write protocol item requirement information, the corresponding continuous write operation is performed on all write objects to obtain the target protocol format feedback information.

[0131] Optionally, the above-mentioned performing corresponding continuous reading operations on all read objects can be understood as reading all objects at one time, which is not limited in the embodiment of the present invention.

[0132] Optionally, the above-mentioned performing corresponding continuous write operations on all write objects can be understood as writing all objects at one time, which is not limited in the embodiment of the present invention.

[0133] It can be seen that this optional embodiment can match the corresponding comprehensive read / comprehensive write operations for the data communication demand for reading data and for the data communication demand for writing data, which is conducive to improving the comprehensiveness and rationality of the method for determining the protocol format feedback information, as well as improving the pertinence, diversity and selectivity of the method for determining the protocol format feedback information, thereby helping to improve the accuracy and reliability of the determined protocol format feedback information. In addition, it is conducive to improving the pertinence and rationality of the execution of the comprehensive read operation and the comprehensive write operation, thereby helping to improve the comprehensive reading accuracy and reliability, the comprehensive writing accuracy and reliability, and in addition, it is also conducive to reducing the number of interactions between the target programmable controller and the target communication object, thereby helping to improve data reading and writing efficiency.

[0134] In another optional embodiment, after performing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to the preset data read-write protocol format, the method may further include the following operations:

[0135] When the read-write interactive control operation includes an operation for data reading, determining second protocol format feedback information for data reading according to the read-write interactive control operation; judging whether the target programmable controller and the target communication object meet the preset read success condition according to the second protocol format feedback information; when judging that the target programmable controller and the target communication object do not meet the read success condition, executing the corresponding unsuccessful read processing operation according to the second protocol format feedback information;

[0136] When the read-write interactive control operation includes an operation for data writing, third protocol format feedback information for data writing is determined according to the read-write interactive control operation; based on the third protocol format feedback information, it is judged whether the target programmable controller and the target communication object meet the preset write success conditions; when it is judged that the target programmable controller and the target communication object do not meet the write success conditions, the corresponding unsuccessful writing processing operation is performed according to the third protocol format feedback information.

[0137] Further optionally, judging whether the target programmable controller and the target communication object meet the preset read success condition according to the feedback information in the second protocol format may include:

[0138] Determine the first content corresponding to the read success flag item according to the second protocol format feedback information, and judge whether the first content matches the preset read success content;

[0139] When it is determined that the first content matches the read success content, determining that the target programmable controller and the target communication object meet a preset read success condition;

[0140] When it is determined that the first content does not match the read success content, it is determined that the target programmable controller and the target communication object do not meet the preset read success condition.

[0141] Further optionally, judging whether the target programmable controller and the target communication object meet the preset write success condition according to the feedback information in the third protocol format may include:

[0142] Determine the second content corresponding to the write success flag item according to the third protocol format feedback information, and judge whether the second content matches the preset write success content;

[0143] When it is determined that the second content matches the write success content, determining that the target programmable controller and the target communication object meet a preset write success condition;

[0144] When it is determined that the second content does not match the write success content, it is determined that the target programmable controller and the target communication object do not meet the preset write success condition.

[0145] Further optionally, the above-mentioned execution of corresponding unsuccessful reading processing operations based on the second protocol format feedback information may be re-executing the above-mentioned operations of establishing corresponding communication connections and handshake operations on the target programmable controller and the target communication object based on the preset communication command handshake protocol, or may be determining specific read exception information based on the second protocol format feedback information and performing targeted processing, which is not limited to the embodiments of the present invention.

[0146] Further optionally, the above-mentioned execution of corresponding unsuccessful writing processing operations according to the feedback information in the third protocol format may be re-executing the above-mentioned operations according to the preset communication command handshake protocol to perform corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object, or it may be determining specific write exception information according to the feedback information in the third protocol format and performing targeted processing, which is not limited to the embodiments of the present invention.

[0147] Further optionally, when it is determined that the target programmable controller and the target communication object satisfy the preset write success conditions, a corresponding write result processing operation is performed, which is not limited in the embodiment of the present invention.

[0148] Further optionally, when it is determined that the target programmable controller and the target communication object satisfy the preset read success conditions, a corresponding read result processing operation is performed, which is not limited in the embodiment of the present invention.

[0149] It can be seen that this optional embodiment can provide corresponding read success judgment and response methods for data reading, and provide corresponding write success judgment and response methods for data writing, which is beneficial to improving the comprehensiveness and integrity of the TCP communication method, and further beneficial to improving the timeliness, rationality and accuracy of responses to unsuccessful reading or unsuccessful writing, thereby helping to improve the stability, accuracy and reliability of TCP communication.

[0150] Embodiment 2

[0151] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of another TCP communication method based on the Omron FINS command protocol disclosed in an embodiment of the present invention. Figure 2 The described method can be applied to a TCP communication device based on the Omron FINS command protocol, wherein the device may include a server, wherein the server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 2 As shown, the TCP communication method based on the Omron FINS command protocol includes the following operations:

[0152] 201. According to the communication address information and communication port information of the determined target programmable controller, a corresponding communication object creation operation is performed to obtain a target communication object.

[0153] 202. According to the preset communication command handshake protocol, corresponding communication connection establishment and handshake operations are performed on the target programmable controller and the target communication object.

[0154] 203. Determine feedback information in a first protocol format according to the communication connection establishment and handshake operation.

[0155] Optionally, the first protocol format feedback information may include but is not limited to specific item types, content and description of each item; further, the specific item type may include but is not limited to one or more of instruction header, instruction length, instruction content, error code, PC end node number, PLC end node number and other item types, etc., which are not limited in the embodiments of the present invention.

[0156] 204. According to the first protocol format feedback information, determine whether the target programmable controller and the target communication object meet the preset handshake success condition.

[0157] Further optionally, when it is determined that the target programmable controller and the target communication object do not meet the preset handshake success conditions, the above-mentioned operation of establishing a communication connection and performing a handshake operation on the target programmable controller and the target communication object according to the preset communication command handshake protocol is executed again, and the embodiment of the present invention is not limited thereto.

[0158] 205. When it is determined that the target programmable controller and the target communication object meet the handshake success condition, corresponding read-write interactive control operations are performed on the target programmable controller and the target communication object according to a preset data read-write protocol format.

[0159] In the embodiment of the present invention, for other descriptions of step 201 to step 205, please refer to other detailed descriptions of step 101 to step 103 in embodiment 1, and the embodiment of the present invention will not be repeated here.

[0160] It can be seen that the embodiment of the present invention can realize TCP communication through communication object creation operation, communication connection establishment and handshake operation, and read-write interactive control operation, which is conducive to improving the comprehensiveness and rationality of the TCP communication method, and then is conducive to improving the data reading and writing efficiency and convenience between the target programmable controller and the target communication object, thereby helping to improve the efficiency and convenience of TCP communication, and is also conducive to improving the maintenance efficiency of application software. Furthermore, there is no need to use OPC software to solve the OPC compatibility problem when communicating with PLCs of other brands and models; and it can also determine whether the handshake success conditions are met. If they are met, the subsequent data reading and writing operations are performed, which is conducive to improving the comprehensiveness and integrity of the TCP communication method, and then is conducive to improving the execution timeliness, execution rationality and execution accuracy of the read-write interactive control operations, thereby helping to improve the accuracy and effectiveness of the data reading and writing effects.

[0161] In an optional embodiment, judging whether the target programmable controller and the target communication object meet the preset handshake success condition according to the feedback information in the first protocol format may include:

[0162] Determine, according to the first protocol format feedback information, a first feedback content for the error code item, and determine a preset first handshake success content for the error code item;

[0163] Determine whether the first feedback content matches the first handshake success content;

[0164] When it is determined that the first feedback content matches the first handshake success content, determining that the target programmable controller and the target communication object meet a preset handshake success condition;

[0165] When it is determined that the first feedback content does not match the first handshake success content, it is determined that the target programmable controller and the target communication object do not meet the preset handshake success condition.

[0166] It can be seen that this optional embodiment can determine the first feedback content in the first protocol format feedback information, and determine whether the handshake success condition is met based on the matching of the first feedback content and the first handshake success content, which is conducive to improving the comprehensiveness and rationality of the method for determining whether the handshake success condition is met, and further helps to improve the accuracy and reliability of the determined handshake success condition, thereby helping to improve the timeliness and rationality of the execution of subsequent data reading and writing interactive operations.

[0167] In another optional embodiment, the above-mentioned performing corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to the preset communication command handshake protocol may include:

[0168] According to a preset communication command handshake protocol, control the target communication object to send information in a first protocol format to the target programmable controller to establish a communication connection between the target communication object and the target programmable controller;

[0169] According to the communication command handshake protocol, control the target communication object and the target programmable controller to perform a corresponding handshake operation, and according to the handshake operation, control the target programmable controller to send feedback information in the first protocol format to the target communication object;

[0170] The first protocol format feedback information at least includes an error code item and its corresponding feedback content, and the feedback content corresponding to the error code item is used to indicate the handshake status between the target communication object and the target programmable controller.

[0171] Optionally, the information sent in the first protocol format may include but is not limited to specific item types, the content and description of each item; further, the specific item type may include but is not limited to one or more of an instruction header, instruction length, instruction content, error code, PC end node number and other item types, etc., which is not limited in the embodiments of the present invention.

[0172] Optionally, the feedback content corresponding to the above error code item is used to indicate the handshake status between the target communication object and the target programmable controller. For example: assuming that the data of the error code item in the first protocol format sending information is fixed to 00000000, when the preset handshake is successful, the error code item of the first protocol format feedback information is fixedly returned to 00000000, otherwise it is a corresponding error code, which is not limited to the embodiment of the present invention.

[0173] It can be seen that this optional embodiment can provide a specific communication connection establishment and handshake method, which is conducive to improving the comprehensiveness, integrity and rationality of the communication connection establishment and handshake method, and further helps to improve the accuracy and reliability of the communication connection establishment and handshake.

[0174] Embodiment 3

[0175] See also Figure 3 , Figure 3 1 is a schematic diagram of the structure of a TCP communication device based on the Omron FINS command protocol disclosed in an embodiment of the present invention. Figure 3 The described device may include a server, wherein the server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 3 As shown, the TCP communication device based on the Omron FINS command protocol may include:

[0176] The communication object creation module 301 is used to perform corresponding communication object creation operations according to the communication address information and communication port information of the determined target programmable controller to obtain the target communication object.

[0177] The communication connection and handshake module 302 is used to perform corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to a preset communication command handshake protocol.

[0178] The data reading and writing module 303 is used to perform corresponding reading and writing interactive control operations on the target programmable controller and the target communication object according to a preset data reading and writing protocol format.

[0179] It can be seen that implementation Figure 3 The described TCP communication device based on the Omron FINS command protocol can realize TCP communication through communication object creation operation, communication connection establishment and handshake operation, and read-write interactive control operation, which is beneficial to improving the comprehensiveness and rationality of the TCP communication method, and then to improving the data reading and writing efficiency and convenience between the target programmable controller and the target communication object, thereby helping to improve the efficiency and convenience of TCP communication, and also to improve the maintenance efficiency of application software. Furthermore, there is no need to use OPC software to solve the OPC compatibility problem when communicating with PLCs of other brands and models.

[0180] In an optional embodiment, if Figure 4 As shown, the device may also include:

[0181] The handshake judgment module 304 is used to determine the first protocol format feedback information according to the communication connection establishment and handshake operation after the communication connection and handshake module 302 performs the corresponding communication connection establishment and handshake operation on the target programmable controller and the target communication object according to the preset communication command handshake protocol; based on the first protocol format feedback information, judge whether the target programmable controller and the target communication object meet the preset handshake success condition; when it is judged that the target programmable controller and the target communication object meet the handshake success condition, the data read and write module 303 executes the above-mentioned steps of performing the corresponding read and write interactive control operations on the target programmable controller and the target communication object according to the preset data read and write protocol format.

[0182] It can be seen that implementation Figure 4 The described device can determine whether the handshake success condition is met. If the condition is met, the subsequent data reading and writing operations are performed, which is conducive to improving the comprehensiveness and integrity of the TCP communication method, and further conducive to improving the timeliness, rationality and accuracy of the execution of the read and write interactive control operations, thereby facilitating improving the accuracy and effectiveness of the data reading and writing effects.

[0183] In another optional embodiment, the handshake determination module 304 determines whether the target programmable controller and the target communication object meet the preset handshake success condition according to the first protocol format feedback information in a manner specifically including:

[0184] Determine, according to the first protocol format feedback information, a first feedback content for the error code item, and determine a preset first handshake success content for the error code item;

[0185] Determine whether the first feedback content matches the first handshake success content;

[0186] When it is determined that the first feedback content matches the first handshake success content, determining that the target programmable controller and the target communication object meet a preset handshake success condition;

[0187] When it is determined that the first feedback content does not match the first handshake success content, it is determined that the target programmable controller and the target communication object do not meet the preset handshake success condition.

[0188] It can be seen that implementation Figure 4 The described device can also determine the first feedback content in the first protocol format feedback information, and determine whether the handshake success condition is met based on the matching of the first feedback content and the first handshake success content, which is conducive to improving the comprehensiveness and rationality of the method for determining whether the handshake success condition is met, and further helps to improve the accuracy and reliability of the determined handshake success condition, thereby helping to improve the timeliness and rationality of the execution of subsequent data reading and writing interactive operations.

[0189] In another optional embodiment, the communication connection and handshake module 302 performs corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to the preset communication command handshake protocol, specifically including:

[0190] According to a preset communication command handshake protocol, control the target communication object to send information in a first protocol format to the target programmable controller to establish a communication connection between the target communication object and the target programmable controller;

[0191] According to the communication command handshake protocol, control the target communication object and the target programmable controller to perform a corresponding handshake operation, and according to the handshake operation, control the target programmable controller to send feedback information in the first protocol format to the target communication object;

[0192] The first protocol format feedback information at least includes an error code item and its corresponding feedback content, and the feedback content corresponding to the error code item is used to indicate the handshake status between the target communication object and the target programmable controller.

[0193] It can be seen that implementation Figure 4 The described device can also provide a specific communication connection establishment and handshake method, which is conducive to improving the comprehensiveness, integrity and rationality of the communication connection establishment and handshake method, and further helps to improve the accuracy and reliability of the communication connection establishment and handshake.

[0194] In another optional embodiment, the data reading and writing module 303 performs corresponding reading and writing interactive control operations on the target programmable controller and the target communication object according to the preset data reading and writing protocol format, specifically including:

[0195] According to the communication connection establishment and handshake operation, determine the network number information of the target programmable controller;

[0196] Generate a target protocol instruction according to the network number information, the preset data read and write protocol format and the determined read and write related information, the target protocol instruction including a read protocol instruction and / or a write protocol instruction;

[0197] Control the target communication object to send target protocol instructions to the target programmable controller;

[0198] According to the target protocol instruction, the corresponding read and / or write operation is performed on the target programmable controller to obtain the feedback information in the target protocol format;

[0199] The control target programmable controller sends feedback information in the target protocol format to the target communication object.

[0200] It can be seen that implementation Figure 4The described device can also generate target protocol instructions, and based on the target protocol instructions, control the target programmable controller and the target communication object to perform interactive reading and / or interactive writing operations, which is conducive to improving the comprehensiveness and rationality of the target protocol instruction generation method, and thus is conducive to improving the pertinence, accuracy and reliability of the determined target protocol instructions. In addition, it is conducive to improving the comprehensiveness and rationality of the interactive reading / writing method between the programmable controller and the communication object, and thus is conducive to improving the interactive accuracy, interactive efficiency and interactive convenience between the programmable controller and the communication object, reducing the number of interactions, and improving the performance of the programmable controller to a certain extent, which is conducive to improving the write / read efficiency and convenience of the programmable controller and the communication object.

[0201] In another optional embodiment, the data reading and writing module 303 generates the target protocol instruction according to the network number information, the preset data reading and writing protocol format and the determined reading and writing related information, specifically including:

[0202] When the data communication demand is a demand for reading data, the address information and length information of each target read object are determined according to the determined read-write related information, and the read protocol item requirement information is determined according to the preset data read-write protocol format; the first starting address information is determined according to the address information of each target read object, and the comprehensive read length result is determined according to the length information of each target read object; the read protocol instruction is generated according to the network number information, the preset data read-write protocol format, the first starting address information, the comprehensive read length result and the read protocol item requirement information to determine the target protocol instruction;

[0203] When the data communication requirement is a data write requirement, the address information and data length information of each target write object are determined according to the determined read-write related information, and the write protocol item requirement information is determined according to the preset data read-write protocol format; the second starting address information is determined according to the address information of each target write object, and the comprehensive write length result is determined according to the data length information of each target write object; a write protocol instruction is generated according to the network number information, the preset data read-write protocol format, the second starting address information, the comprehensive write length result and the write protocol item requirement information to determine the target protocol instruction.

[0204] It can be seen that implementation Figure 4The described device can also match the corresponding target protocol instruction generation method according to the data communication demand for reading data or according to the data communication demand for writing data, which is conducive to improving the comprehensiveness and rationality of the target protocol instruction generation method, and is also conducive to improving the diversity, flexibility and selectivity of the target protocol instruction generation method, thereby helping to improve the accuracy and reliability of the generated target protocol instructions, thereby helping to improve the accuracy and efficiency of data reading / data writing based on the target protocol instructions.

[0205] In another optional embodiment, the data reading module 303 performs corresponding read and / or write operations on the target programmable controller according to the target protocol instruction, and the method of obtaining the target protocol format feedback information specifically includes:

[0206] According to the target protocol instruction and the target programmable controller, one or more read / write objects are determined, and the read / write mode type corresponding to the read / write objects is determined;

[0207] When the read / write mode type is a one-by-one read / write type, corresponding read and / or write operations are performed on all read / write objects one by one to obtain feedback information in the target protocol format;

[0208] When the read / write mode type is a continuous read / write type, corresponding comprehensive read and / or comprehensive write operations are performed on all read / write objects according to the determined data communication requirements to obtain target protocol format feedback information.

[0209] It can be seen that implementation Figure 4 The described device can also match the corresponding target protocol format feedback information determination method for the read-write mode type of one-by-one read-write type and the read-write mode type of continuous read-write type, which is conducive to improving the comprehensiveness and rationality of the protocol format feedback information determination method, and is also conducive to improving the diversity, flexibility and selectivity of the protocol format feedback information determination method, and thus is conducive to improving the accuracy and reliability of the determined protocol format feedback information, thereby helping to improve the accuracy and effectiveness of the data reading / data writing effect determined based on the protocol format feedback information.

[0210] In another optional embodiment, the data reading module 303 performs corresponding comprehensive reading and / or comprehensive writing operations on all read-write objects according to the determined data communication requirements, and the method of obtaining the target protocol format feedback information specifically includes:

[0211] When the determined data communication demand is a read data demand, a read object is determined from all read-write objects, and according to the target protocol instruction, first starting address information, a comprehensive read length result, and read protocol item demand information are determined; according to the first starting address information, the comprehensive read length result, and the read protocol item demand information, corresponding continuous read operations are performed on all read objects to obtain target protocol format feedback information;

[0212] When the determined data communication requirement is a write data requirement, the write object is determined from all read-write objects, and according to the target protocol instruction, the second starting address information, the comprehensive write length result and the write protocol item requirement information are determined; according to the second starting address information, the comprehensive write number result and the write protocol item requirement information, the corresponding continuous write operation is performed on all write objects to obtain the target protocol format feedback information.

[0213] It can be seen that implementation Figure 4 The described device can also match the corresponding comprehensive read / comprehensive write operations according to the data communication requirements for reading data and according to the data communication requirements for writing data, which is conducive to improving the comprehensiveness and rationality of the method for determining the protocol format feedback information, as well as improving the pertinence, diversity and selectivity of the method for determining the protocol format feedback information, thereby helping to improve the accuracy and reliability of the determined protocol format feedback information. In addition, it is conducive to improving the pertinence and rationality of the execution of the comprehensive read operation and the comprehensive write operation, thereby helping to improve the comprehensive reading accuracy and reliability, the comprehensive writing accuracy and reliability, and in addition, it is also conducive to reducing the number of interactions between the target programmable controller and the target communication object, thereby helping to improve data reading and writing efficiency.

[0214] In yet another optional embodiment, Figure 4 As shown, the device may also include:

[0215] The read-write feedback module 305 is used for determining second protocol format feedback information for data reading according to the read-write interactive control operation after the data read-write module 303 performs corresponding read-write interactive control operations on the target programmable controller and the target communication object according to the preset data read-write protocol format, when the read-write interactive control operation includes an operation for data reading; judging whether the target programmable controller and the target communication object meet the preset read success condition according to the second protocol format feedback information; and performing corresponding unsuccessful read processing operations according to the second protocol format feedback information when it is judged that the target programmable controller and the target communication object do not meet the read success condition;

[0216] When the read-write interactive control operation includes an operation for data writing, third protocol format feedback information for data writing is determined according to the read-write interactive control operation; based on the third protocol format feedback information, it is judged whether the target programmable controller and the target communication object meet the preset write success conditions; when it is judged that the target programmable controller and the target communication object do not meet the write success conditions, the corresponding unsuccessful writing processing operation is performed according to the third protocol format feedback information.

[0217] It can be seen that implementation Figure 4 The described device can also provide corresponding read success judgment and response methods for data reading, and provide corresponding write success judgment and response methods for data writing, which is beneficial to improving the comprehensiveness and integrity of the TCP communication method, and further beneficial to improving the timeliness, rationality and accuracy of responses to unsuccessful reading or unsuccessful writing, thereby helping to improve the stability, accuracy and reliability of TCP communication.

[0218] Embodiment 4

[0219] See also Figure 5 , Figure 5 1 is a schematic diagram of the structure of another TCP communication device based on the Omron FINS command protocol disclosed in an embodiment of the present invention. Figure 5 The described device may include a server, wherein the server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 5 As shown, the device may include:

[0220] A memory 401 storing executable program codes;

[0221] a processor 402 coupled to the memory 401;

[0222] Furthermore, it may also include an input interface 403 and an output interface 404 coupled to the processor 402;

[0223] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the TCP communication method based on the Omron FINS command protocol described in the first or second embodiment.

[0224] Embodiment 5

[0225] An embodiment of the present invention discloses a computer storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute the steps of the TCP communication method based on the Omron FINS command protocol described in the first or second embodiment.

[0226] Embodiment 6

[0227] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps of the TCP communication method based on the Omron FINS command protocol described in Example 1 or Example 2.

[0228] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0229] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0230] Finally, it should be noted that the TCP communication method and device based on the Omron FINS command protocol disclosed in the embodiment of the present invention discloses only the preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A TCP communication method based on the Omron FINS command protocol, characterized in that: The method comprises: According to the communication address information and communication port information of the determined target programmable controller, a corresponding communication object creation operation is performed to obtain the target communication object; According to a preset communication command handshake protocol, corresponding communication connection establishment and handshake operations are performed on the target programmable controller and the target communication object; According to a preset data read and write protocol format, corresponding read and write interactive control operations are performed on the target programmable controller and the target communication object; And, performing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to a preset data read-write protocol format, including: Determine the network number information of the target programmable controller according to the communication connection establishment and handshake operation; Generate a target protocol instruction according to the network number information, a preset data read and write protocol format and the determined read and write related information, wherein the target protocol instruction includes a read protocol instruction and / or a write protocol instruction; Controlling the target communication object to send the target protocol instruction to the target programmable controller; According to the target protocol instruction, performing corresponding read and / or write operations on the target programmable controller to obtain target protocol format feedback information; Controlling the target programmable controller to send the target protocol format feedback information to the target communication object; And, generating a target protocol instruction according to the network number information, a preset data read and write protocol format and the determined read and write related information includes: When the data communication demand is a demand for reading data, the address information and length information of each target read object are determined according to the determined read-write related information, and the read protocol item requirement information is determined according to the preset data read-write protocol format; the first starting address information is determined according to the address information of each of the target read objects, and the comprehensive read length result is determined according to the length information of each of the target read objects; a read protocol instruction is generated according to the network number information, the preset data read-write protocol format, the first starting address information, the comprehensive read length result and the read protocol item requirement information to determine the target protocol instruction; When the data communication requirement is a data write requirement, the address information and data length information of each target write object are determined according to the determined read-write related information, and the write protocol item requirement information is determined according to the preset data read-write protocol format; the second starting address information is determined according to the address information of each of the target write objects, and the comprehensive write length result is determined according to the data length information of each of the target write objects; a write protocol instruction is generated according to the network number information, the preset data read-write protocol format, the second starting address information, the comprehensive write length result and the write protocol item requirement information to determine the target protocol instruction.

2. The TCP communication method based on the Omron FINS command protocol according to claim 1, characterized in that: After performing corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to the preset communication command handshake protocol, the method further includes: Determining first protocol format feedback information according to the communication connection establishment and handshake operation; According to the first protocol format feedback information, determining whether the target programmable controller and the target communication object meet a preset handshake success condition; When it is determined that the target programmable controller and the target communication object meet the handshake success condition, the step of performing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to a preset data read-write protocol format is executed; And, judging whether the target programmable controller and the target communication object meet a preset handshake success condition according to the first protocol format feedback information, includes: Determine, according to the first protocol format feedback information, a first feedback content for the error code item, and determine a preset first handshake success content for the error code item; Determining whether the first feedback content matches the first handshake success content; When it is determined that the first feedback content matches the first handshake success content, determining that the target programmable controller and the target communication object meet a preset handshake success condition; When it is determined that the first feedback content does not match the first handshake success content, it is determined that the target programmable controller and the target communication object do not meet a preset handshake success condition.

3. The TCP communication method based on the Omron FINS command protocol according to claim 1, characterized in that: The method of performing corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to the preset communication command handshake protocol includes: According to a preset communication command handshake protocol, controlling the target communication object to send information in a first protocol format to the target programmable controller to establish a communication connection between the target communication object and the target programmable controller; According to the communication command handshake protocol, control the target communication object and the target programmable controller to perform a corresponding handshake operation, and according to the handshake operation, control the target programmable controller to send feedback information in a first protocol format to the target communication object; The first protocol format feedback information at least includes an error code item and its corresponding feedback content, and the feedback content corresponding to the error code item is used to indicate the handshake status between the target communication object and the target programmable controller.

4. The TCP communication method based on the Omron FINS command protocol according to claim 1, characterized in that: The step of performing corresponding read and / or write operations on the target programmable controller according to the target protocol instruction to obtain feedback information in the target protocol format includes: Determine one or more read / write objects according to the target protocol instruction and the target programmable controller, and determine the read / write mode type corresponding to the read / write object; When the read-write mode type is a one-by-one read-write type, corresponding read and / or write operations are performed on all the read-write objects one by one to obtain target protocol format feedback information; When the read / write mode type is a continuous read / write type, corresponding comprehensive read and / or comprehensive write operations are performed on all the read / write objects according to the determined data communication requirements to obtain feedback information in a target protocol format; And, according to the determined data communication requirements, performing corresponding comprehensive read and / or comprehensive write operations on all the read-write objects to obtain target protocol format feedback information, including: When the determined data communication demand is a read data demand, a read object is determined from all the read-write objects, and according to the target protocol instruction, first starting address information, a comprehensive read length result and read protocol item demand information are determined; according to the first starting address information, the comprehensive read length result and the read protocol item demand information, corresponding continuous read operations are performed on all the read objects to obtain target protocol format feedback information; When the determined data communication requirement is a write data requirement, a write object is determined from all the read-write objects, and according to the target protocol instruction, the second starting address information, the comprehensive write length result and the write protocol item requirement information are determined; according to the second starting address information, the comprehensive write length result and the write protocol item requirement information, corresponding continuous write operations are performed on all the write objects to obtain the target protocol format feedback information.

5. The TCP communication method based on the Omron FINS command protocol according to any one of claims 1 to 4, characterized in that: After performing corresponding read-write interactive control operations on the target programmable controller and the target communication object according to the preset data read-write protocol format, the method further includes: When the read-write interactive control operation includes an operation for data reading, determining second protocol format feedback information for the data reading according to the read-write interactive control operation; judging whether the target programmable controller and the target communication object meet a preset read success condition according to the second protocol format feedback information; when judging that the target programmable controller and the target communication object do not meet the read success condition, executing a corresponding unsuccessful read processing operation according to the second protocol format feedback information; When the read-write interactive control operation includes an operation for writing data, third protocol format feedback information for writing the data is determined according to the read-write interactive control operation; based on the third protocol format feedback information, it is judged whether the target programmable controller and the target communication object meet the preset write success conditions; when it is judged that the target programmable controller and the target communication object do not meet the write success conditions, a corresponding unsuccessful writing processing operation is performed according to the third protocol format feedback information.

6. A TCP communication device based on the Omron FINS command protocol, characterized in that: The device comprises: The communication object creation module is used to perform corresponding communication object creation operations according to the communication address information and communication port information of the determined target programmable controller to obtain the target communication object; A communication connection and handshake module, used to perform corresponding communication connection establishment and handshake operations on the target programmable controller and the target communication object according to a preset communication command handshake protocol; A data reading and writing module, used to perform corresponding reading and writing interactive control operations on the target programmable controller and the target communication object according to a preset data reading and writing protocol format; And, the data reading and writing module performs corresponding reading and writing interactive control operations on the target programmable controller and the target communication object according to the preset data reading and writing protocol format, specifically including: Determine the network number information of the target programmable controller according to the communication connection establishment and handshake operation; Generate a target protocol instruction according to the network number information, a preset data read and write protocol format and the determined read and write related information, wherein the target protocol instruction includes a read protocol instruction and / or a write protocol instruction; Controlling the target communication object to send the target protocol instruction to the target programmable controller; According to the target protocol instruction, performing corresponding read and / or write operations on the target programmable controller to obtain target protocol format feedback information; Controlling the target programmable controller to send the target protocol format feedback information to the target communication object; And, the data reading and writing module generates the target protocol instruction according to the network number information, the preset data reading and writing protocol format and the determined reading and writing related information, specifically including: When the data communication demand is a demand for reading data, the address information and length information of each target read object are determined according to the determined read-write related information, and the read protocol item requirement information is determined according to the preset data read-write protocol format; the first starting address information is determined according to the address information of each of the target read objects, and the comprehensive read length result is determined according to the length information of each of the target read objects; a read protocol instruction is generated according to the network number information, the preset data read-write protocol format, the first starting address information, the comprehensive read length result and the read protocol item requirement information to determine the target protocol instruction; When the data communication requirement is a data write requirement, the address information and data length information of each target write object are determined according to the determined read-write related information, and the write protocol item requirement information is determined according to the preset data read-write protocol format; the second starting address information is determined according to the address information of each of the target write objects, and the comprehensive write length result is determined according to the data length information of each of the target write objects; a write protocol instruction is generated according to the network number information, the preset data read-write protocol format, the second starting address information, the comprehensive write length result and the write protocol item requirement information to determine the target protocol instruction.

7. A TCP communication device based on the Omron FINS command protocol, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the TCP communication method based on the Omron FINS command protocol as described in any one of claims 1-5.

8. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the TCP communication method based on the Omron FINS command protocol as described in any one of claims 1-5.