Method, device and system based on serial port communication

By designing a unique instruction number and check code mechanism for serial communication in the automatic motion control system, the problem of serial communication being susceptible to electromagnetic interference is solved, and the accuracy and non-repetitiveness of information transmission are achieved without increasing hardware costs and delays. .

CN118655824AActive Publication Date: 2024-09-17HEFEI ANXIN PRECISION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411148056.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-09-17
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In automatic motion control systems, serial communication is susceptible to electromagnetic interference. It is difficult for existing technology to effectively resist electromagnetic interference without increasing hardware costs and communication delays.

Method used

By assigning a unique instruction number to each task and using check codes in action data packets and confirmation data packets to determine the correctness and completeness of the data packets to ensure the accuracy and non-repetition of information transmission, a system is designed A method and system based on serial port communication, including the sending, confirmation and return status processes of the upper computer and the lower computer.

Benefits of technology

It ensures the normal transmission and accuracy of data packets in an electromagnetic interference environment without changing the hardware structure and increasing hardware costs. The communication logic is simple and the delay is low.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118655824A
    Figure CN118655824A
Patent Text Reader

Abstract

The invention relates to the technical field of communication, and discloses a method, a device and a system based on serial port communication, a corresponding instruction number is distributed for each task, an upper computer returns the same number in a confirmation action data packet or a machine state data packet to judge whether an instruction is received or not and whether the instruction is executed or not, and if yes, the task is executed. The lower computer judges whether the upper computer knows that the instruction is executed completely or not by checking the receiving condition of the action instruction completion code in the query instruction and checking whether the serial number of the query instruction is the same as the previous one or not, so that any data packet is subjected to electromagnetic interference; the communication process based on serial port communication can ensure that all information is normally transmitted and is not repeated, a hardware structure does not need to be changed, hardware cost does not need to be increased, communication logic is simple, and time delay is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device and system based on serial port communication. Background Art

[0002] In an automatic motion control system, there is often a host computer that controls the motion process far away from the motion end, and a slave computer that controls the motion near the motion end. The host computer needs to send control instructions to the slave computer, and the slave computer needs to send the current machine status and instruction execution status to the host computer.

[0003] The communication between the two often uses simple twisted pair serial communication for cost considerations, but serial communication is greatly affected by electromagnetic interference. Electromagnetic interference may cause communication problems between machines, resulting in the loss of information that needs to be sent and received during communication. There are currently two solutions to this. Solution 1: From an electrical perspective, improve the anti-electromagnetic interference ability of communication signals at the physical layer, such as replacing twisted pair cables with coaxial cables, adding shielding shells, and adding filtering at the circuit level; Solution 2: Use mature and complete network communication protocols, such as TCP / IP communication protocols.

[0004] However, for solution 1, improving the anti-electromagnetic interference capability at the physical layer often means an increase in the hardware cost of the equipment. For example, the price of coaxial cable is generally higher than that of twisted pair cable, the shielding shell takes up extra space, and the filter circuit itself requires cost. In theory, these operations can only reduce the impact of electromagnetic interference but cannot completely eliminate it. For solution 2, the perfect network protocol is often more complex, and when implemented on the lower computer (such as a single-chip microcomputer), it often consumes more logical resources and increases excessive communication delays. Therefore, the existing technology lacks a solution that can have a certain anti-electromagnetic interference capability without additional hardware modification, increasing equipment costs, and increasing communication delays. Summary of the invention

[0005] In order to solve the problems in the prior art, the present invention provides a method, device and system based on serial port communication.

[0006] In order to achieve the above object, the first aspect of the present invention provides a method based on serial communication, which is applied to a host computer to send an action flow, comprising the following steps: Sending an action data packet to a lower computer, wherein the action data packet includes an action instruction number and a check code; Receiving a confirmation action data packet from a lower computer, wherein the confirmation action data packet includes a confirmation action instruction number and a check code; Determine whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, end the sending action process and the sending action is successful; if not, re-send the action data packet to execute the sending action process until the sending action is successful.

[0007] Preferably, the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed.

[0008] Preferably, after sending the action data packet to the lower computer, if the confirmation action data packet is not received within a specified time, the action data packet is sent again to execute the sending action process until the sending action is successful.

[0009] A second aspect of the present invention provides a method based on serial communication, which is applied to a lower computer to confirm an action process, comprising the following steps: Check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; If they are inconsistent, a confirmation action data packet is uploaded to the host computer, the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends.

[0010] Preferably, if they are consistent, after executing the instruction indicated by the action instruction content in the action data packet, the confirmation action data packet is uploaded to the host computer to end the process.

[0011] A fourth aspect of the present invention provides a method based on serial communication, which is applied to the lower computer return status process, comprising the following steps: S1. Check whether the action instruction completion code reception status in the query data packet from the host computer is "received status", and the query instruction number of the query data packet is different from the query instruction number of the query data packet with a correct verification code received last time, and the action instruction completion code to be delivered in the machine status data packet sent to the host computer last time is "deliverable"; S2. If not, query the lower computer submodule whether there is an action instruction that has been completed but the completion status has not been transmitted. If so, upload the machine status data packet to the upper computer, wherein the action instruction completion code is: the action instruction number of the earliest completed action instruction that has been completed but the completion status has not been transmitted, and the action instruction completion code to be transmitted is "available for transmission", and end the process; if not, upload the machine status data packet to the upper computer, wherein the action instruction completion code to be transmitted is "not available for transmission".

[0012] Preferably, after checking the query data packet from the upper computer in step S1, if yes, the lower computer submodule is informed that the instruction completion status corresponding to the action instruction number equal to the action instruction completion code in the machine status data packet sent last time has been transmitted, and then step S2 is executed.

[0013] A fifth aspect of the present invention provides a method for machine-to-machine communication based on serial communication, comprising the following steps: The upper computer sends an action data packet to the lower computer, wherein the action data packet includes an action instruction number and a check code, and the action instruction number is different from the instruction number of the previous action and the instruction numbers of all actions being executed; After the lower computer receives the action data packet and verifies that the check code therein is correct, it checks whether the action instruction number of the action data packet is consistent with the action instruction number of the action data packet with the correct check code received last time. If they are consistent, the instruction indicated by the action instruction content in the action data packet is executed, and then the confirmation action data packet is uploaded to the upper computer; if they are inconsistent, the confirmation action data packet is directly uploaded to the upper computer, and the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received; The upper computer receives the confirmation action data packet, determines whether the verification code of the confirmation action data packet is correct and the corresponding confirmation action instruction number is equal to the action instruction number, and if so, completes the communication; if not, resends the action data packet to the lower computer until the communication is completed.

[0014] Preferably, if the upper computer does not receive the confirmation action data packet within the specified time, it resends the action data packet to the lower computer until the communication is completed.

[0015] A sixth aspect of the present invention provides a device based on serial communication, which is applied to a host computer to send an action flow, comprising: The sending module is used to send the action data packet to the lower computer, wherein the action data packet includes the action instruction number and the check code; A receiving module, used for receiving a confirmation action data packet from a lower computer, wherein the confirmation action data packet includes a confirmation action instruction number and a check code; The judgment module is used to judge whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, the sending action process is terminated and the sending action is successful; if not, the action data packet is re-issued to execute the sending action process until the sending action is successful.

[0016] A seventh aspect of the present invention provides a device based on serial communication, which is applied to a lower computer to confirm an action process, comprising: A checking module is used to check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; The uploading module is used to upload a confirmation action data packet to the host computer if the inspection results of the inspection module are inconsistent. The confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends.

[0017] An eighth aspect of the present invention provides a system based on serial port communication, comprising a host computer and a slave computer, wherein the host computer is used to execute a sending action process when a new action needs to be executed, and the slave computer is used to execute a confirmation action process each time an action data packet is received from the host computer and the verification code of the data packet is correct; and / or, the host computer is used to execute a query process at regular intervals when there is no new action, and the slave computer is used to execute a return status process each time a query data packet is received from the host computer and the verification code of the data packet is correct.

[0018] Through the above technical solution, a corresponding instruction number is assigned to each task. The upper computer determines whether the instruction is received and executed by returning the same number in the confirmation action data packet or the machine status data packet. The lower computer determines whether the upper computer knows that the instruction has been executed by checking the reception of the action instruction completion code in the query instruction and checking whether the query instruction number is the same as the previous one. Therefore, after any data packet is subject to electromagnetic interference, the communication process based on serial communication can ensure that all information is transmitted normally and without duplication, without making any changes to the hardware structure, without increasing hardware costs, and the communication logic is simple and the delay is low.

[0019] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings: Figure 1 This is a schematic diagram of an action flow of sending by a host computer according to an embodiment of the present invention; Figure 2 This is a schematic diagram of an embodiment of the present invention applied to a lower computer confirmation action flow; Figure 3 It is a schematic diagram of the return state flow of the embodiment of the present invention applied to the lower computer. DETAILED DESCRIPTION

[0021] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0022] In the embodiment of the present invention, the main information sent by the upper computer to the lower computer includes: instructions (including action instructions and query instructions), and the receipt of action instruction completion codes. The main information sent by the lower computer to the upper computer includes: action instruction completion codes, the current state of the machine, and the receipt of action instructions. Therefore, the communication protocol scheme is designed as follows: The host computer sends the following two types of data packets to the slave computer: The action data packet includes ① action instruction number, ② action instruction content, and ③ check code.

[0023] The query data packet includes ① the query instruction number, ② the action instruction completion code reception status, and ③ the check code.

[0024] The lower computer will send the following two types of data packets to the upper computer: The confirmation action data packet includes ① confirmation action instruction number and ② check code.

[0025] The machine status data packet includes ① the current machine status, ② the action instruction completion code, ③ the action instruction completion code to be transmitted, and ④ the verification code.

[0026] The first aspect of the embodiment of the present invention provides a method based on serial communication, which is applied to a host computer to send an action flow, such as Figure 1 As shown, the following steps are included: Send action data packets to the lower computer; The action instruction content in the data packet is the detailed information of the new action to be executed; the action instruction number is newly generated, and when it is generated, it is guaranteed to be different from the instruction number of the previous action and also different from the instruction numbers of all actions being executed.

[0027] Wait for and receive confirmation action data packets from the lower computer; Determine whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, end the sending action process and the sending action is successful; if not, re-send the action data packet to execute the sending action process until the sending action is successful.

[0028] In another embodiment of the present invention, after the upper computer sends the action data packet to the lower computer, if the confirmation action data packet is not received within a specified time, the action data packet is resent to execute the sending action process until the sending action is successful.

[0029] A second aspect of the embodiment of the present invention provides a method based on serial communication, such as Figure 2 As shown, the process applied to the lower computer to confirm the action process, that is, the process executed each time an action data packet is received from the upper computer and the check code of the data packet is correct, includes the following steps: Check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; If they are inconsistent, the confirmation action data packet is uploaded to the host computer, and the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends; If they are consistent, after executing the instruction indicated by the action instruction content in the action data packet, the confirmation action data packet is uploaded to the host computer, and the action instruction number of the instruction is told to the lower computer submodule, and the process ends.

[0030] A third aspect of the embodiment of the present invention provides a method based on serial communication, such as Figure 3 As shown, the process applied to the return status of the lower computer, that is, the process executed each time a query data packet is received from the upper computer and the check code of the data packet is correct, includes the following steps: S1. Check whether the action instruction completion code reception status in the query data packet from the host computer is "received status", and the query instruction number of the query data packet is different from the query instruction number of the query data packet with a correct verification code received last time, and the action instruction completion code to be delivered in the machine status data packet sent to the host computer last time is "deliverable"; S2. If not, query the lower computer submodule whether there is an action instruction that has been completed but the completion status has not been transmitted. If so, upload the machine status data packet to the upper computer, wherein the action instruction completion code is: the action instruction number of the earliest completed action instruction that has been completed but the completion status has not been transmitted, and the action instruction completion code to be transmitted is "available for transmission", and end the process; if not, upload the machine status data packet to the upper computer, wherein the action instruction completion code to be transmitted is "not available for transmission".

[0031] Further, after checking the query data packet from the upper computer in step S1, if yes, the lower computer submodule is informed that the instruction completion status corresponding to the action instruction number equal to the action instruction completion code in the machine status data packet sent last time has been transmitted, and then step S2 is executed.

[0032] A fourth aspect of an embodiment of the present invention provides a method for machine-to-machine communication based on serial communication, comprising the following steps: The upper computer sends an action data packet to the lower computer, wherein the action data packet includes an action instruction number and a check code, and the action instruction number is different from the instruction number of the previous action and the instruction numbers of all actions being executed; After the lower computer receives the action data packet and verifies that the check code therein is correct, it checks whether the action instruction number of the action data packet is consistent with the action instruction number of the action data packet with the correct check code received last time. If they are consistent, the instruction indicated by the action instruction content in the action data packet is executed, and then the confirmation action data packet is uploaded to the upper computer; if they are inconsistent, the confirmation action data packet is directly uploaded to the upper computer, and the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received; The upper computer receives the confirmation action data packet, determines whether the verification code of the confirmation action data packet is correct and the corresponding confirmation action instruction number is equal to the action instruction number. If so, the communication is completed; if not, the action data packet is resent to the lower computer until the communication is completed; if the upper computer does not receive the confirmation action data packet within the specified time, the action data packet is resent to the lower computer until the communication is completed.

[0033] Based on the same inventive concept, a fifth aspect of an embodiment of the present invention provides a device based on serial port communication, which is applied to a host computer to send an action flow, including: The sending module is used to send the action data packet to the lower computer, wherein the action data packet includes the action instruction number and the check code; A receiving module, used for receiving a confirmation action data packet from a lower computer, wherein the confirmation action data packet includes a confirmation action instruction number and a check code; The judgment module is used to judge whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, the sending action process is terminated and the sending action is successful; if not, the action data packet is re-issued to execute the sending action process until the sending action is successful.

[0034] Based on the same inventive concept, a sixth aspect of an embodiment of the present invention provides a device based on serial communication, which is applied to a lower computer to confirm an action process, including: A checking module is used to check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; The uploading module is used to upload a confirmation action data packet to the host computer if the inspection results of the inspection module are inconsistent. The confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends.

[0035] Based on the same inventive concept, the seventh aspect of the embodiment of the present invention provides a system based on serial port communication, including an upper computer and a lower computer, the upper computer is used to execute the sending action process when a new action needs to be executed, and the lower computer is used to execute the confirmation action process each time an action data packet is received from the upper computer and the check code of the data packet is correct, and the working principle is as follows: The upper computer sends an action data packet to the lower computer, wherein the action data packet includes an action instruction number and a check code, and the action instruction number is different from the instruction number of the previous action and the instruction numbers of all actions being executed; After the lower computer receives the action data packet and verifies that the check code therein is correct, it checks whether the action instruction number of the action data packet is consistent with the action instruction number of the action data packet with the correct check code received last time. If they are consistent, the instruction indicated by the action instruction content in the action data packet is executed, and then the confirmation action data packet is uploaded to the upper computer; if they are inconsistent, the confirmation action data packet is directly uploaded to the upper computer, and the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received; The upper computer receives the confirmation action data packet, determines whether the verification code of the confirmation action data packet is correct and the corresponding confirmation action instruction number is equal to the action instruction number. If so, the communication is completed; if not, the action data packet is resent to the lower computer until the communication is completed; if the upper computer does not receive the confirmation action data packet within the specified time, the action data packet is resent to the lower computer until the communication is completed.

[0036] In another embodiment of the present invention, a system based on serial port communication includes a host computer and a slave computer. The host computer is used to execute a query process at regular intervals when there is no new action, and the slave computer is used to execute a return status process each time a query data packet is received from the host computer and the verification code of the data packet is correct.

[0037] The upper execution query process includes the following steps: Send a query data packet to the lower computer. The query instruction number is generated by a new one, and it is ensured that the query instruction number is different from the query instruction number of the previous query data packet; the action instruction completion code reception status is "not received status".

[0038] Wait for and receive machine status data packets from the lower computer.

[0039] If the machine status data packet from the lower computer is not received for a long time, or the check code of the received machine status data packet is incorrect, the data packet just sent in step ① is resent without any modification, and the process goes to step ②. If the machine status data packet from the lower computer is received and the data packet is normal, the machine status information in the upper computer is updated according to the machine status information in the data packet. Then, if the action instruction completion code to be transmitted in the machine status data packet is "nothing to transmit", the process ends; otherwise, the process goes to step ④.

[0040] Let the host computer know that the task corresponding to the action instruction completion code just received has been completed.

[0041] Send a query data packet to the lower computer. The query instruction number is generated by a new one, and it is ensured that the query instruction number is different from the query instruction number of the previous query data packet; the action instruction completion code reception status is "received status".

[0042] Wait for and receive machine status data packets from the lower computer.

[0043] If the machine status data packet from the lower computer is not received for a long time, or the check code of the received machine status data packet is incorrect, the data packet just sent in step ⑤ is resent without any modification, and the process goes to step ⑥. If the machine status data packet from the lower computer is received and the data packet is normal, the machine status information in the upper computer is updated according to the machine status information in the data packet. Then, if the action instruction completion code to be transmitted in the machine status data packet is "nothing to transmit", the process ends; otherwise, the process goes to step ④.

[0044] The lower execution return status process includes the following steps: Check whether the action instruction completion code reception status in the received query data packet is "received status", and the query instruction number of the query data packet is different from the query instruction number of the query data packet with the correct verification code received last time, and the action instruction completion code waiting to be delivered in the machine status data packet sent last time is "deliverable". If all three conditions above are met, go to step ②, otherwise go to step ③.

[0045] Inform the lower computer submodule that the instruction completion status corresponding to the action instruction number equal to the action instruction completion code in the machine status data packet sent last time has been transmitted.

[0046] Query the lower computer submodule whether there is an action instruction that has been completed but the completion status has not been transmitted. If yes, go to step ④, otherwise jump to step ⑤.

[0047] Upload a machine status data packet to the host computer, where the action command completion code is: the action command number of the earliest completed action command that has been completed but the completion status has not been transmitted. The action command completion code to be transmitted is "available for transmission". Then end the process.

[0048] Upload a machine status data packet to the host computer. The action command completion code to be transmitted is "nothing to transmit". Then end the process.

[0049] It is worth noting that the pending transmission status of the action instruction completion code in the machine status data packet can be omitted, and a specific number is not used when generating the action instruction number. When the action instruction completion code in the machine status data packet is this number, it indicates that the pending transmission status of the action instruction completion code is "nothing to transmit".

[0050] The technical solution of the present invention assigns a corresponding instruction number to each task. The upper computer judges whether the instruction is received and executed by returning the same number in the confirmation action data packet or the machine status data packet. The lower computer judges whether the upper computer knows that the instruction has been executed by checking the reception of the action instruction completion code in the query instruction and checking whether the query instruction number is the same as before. Compared with the solution 1 in the prior art, the present invention does not need to make any changes to the hardware structure. The normal processing of signal interference can be achieved through the design of the process itself without increasing the hardware cost. Compared with the solution 2 in the prior art, the present invention utilizes the characteristics of the automatic motion control system communication that "the communication delay requirement is stricter, but the data volume requirement for a single communication is looser", and designs a solution with simpler logic and lower delay than the common mature communication protocol.

[0051] In summary, the communication protocol of the present invention realizes that after any data packet is subject to electromagnetic interference, the communication process based on serial communication can ensure that all information is transmitted normally and without duplication, without making any changes to the hardware structure, without increasing hardware costs, and has the goals of simple communication logic and low latency.

[0052] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity, or apparatus.

[0053] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method based on serial communication, It is characterized in that Applied to the host computer sending action process, including the following steps: Sending an action data packet to a lower computer, wherein the action data packet includes an action instruction number and a check code; Receiving a confirmation action data packet from a lower computer, wherein the confirmation action data packet includes a confirmation action instruction number and a check code; Determine whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, end the sending action process and the sending action is successful; if not, re-send the action data packet to execute the sending action process until the sending action is successful.

2. The method according to claim 1, It is characterized in that The action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed.

3. The method according to claim 1 or 2, It is characterized in that After sending the action data packet to the lower computer, if the confirmation action data packet is not received within the specified time, the action data packet is sent again to execute the sending action process until the sending action is successful.

4. A method based on serial communication, It is characterized in that Applied to the lower computer confirmation action process, including the following steps: Check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; If they are inconsistent, a confirmation action data packet is uploaded to the host computer, the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends.

5. The method according to claim 4, It is characterized in that If they are consistent, the instruction indicated by the action instruction content in the action data packet is executed, and then the confirmation action data packet is uploaded to the host computer to end the process.

6. A method based on serial communication, It is characterized in that Applied to the lower computer return status process, including the following steps: S1. Check whether the action instruction completion code reception status in the query data packet from the host computer is "received status", and the query instruction number of the query data packet is different from the query instruction number of the query data packet with a correct verification code received last time, and the action instruction completion code to be delivered in the machine status data packet sent to the host computer last time is "deliverable"; S2. If not, query the lower computer submodule whether there is an action instruction that has been completed but the completion status has not been transmitted. If so, upload the machine status data packet to the upper computer, wherein the action instruction completion code is: the action instruction number of the earliest completed action instruction that has been completed but the completion status has not been transmitted, and the action instruction completion code to be transmitted is "available for transmission", and end the process; if not, upload the machine status data packet to the upper computer, wherein the action instruction completion code to be transmitted is "not available for transmission".

7. The method according to claim 6, It is characterized in that After checking the query data packet from the upper computer in step S1, if yes, the lower computer submodule is informed that the instruction completion status corresponding to the action instruction number equal to the action instruction completion code in the machine status data packet sent last time has been transmitted, and then step S2 is executed.

8. A machine-to-machine communication method based on serial communication, It is characterized in that The following steps are involved: The upper computer sends an action data packet to the lower computer, wherein the action data packet includes an action instruction number and a check code, and the action instruction number is different from the instruction number of the previous action and the instruction numbers of all actions being executed; After the lower computer receives the action data packet and verifies that the check code therein is correct, it checks whether the action instruction number of the action data packet is consistent with the action instruction number of the action data packet with the correct check code received last time. If they are consistent, the instruction indicated by the action instruction content in the action data packet is executed, and then the confirmation action data packet is uploaded to the upper computer; if they are inconsistent, the confirmation action data packet is directly uploaded to the upper computer, and the confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received; The host computer receives the confirmation action data packet, determines whether the verification code of the confirmation action data packet is correct and the corresponding confirmation action instruction number is equal to the action instruction number, and if so, completes the communication; If not, the action data packet is resent to the lower computer until the communication is completed.

9. The method according to claim 8, It is characterized in that If the upper computer does not receive the confirmation action data packet within the specified time, it will resend the action data packet to the lower computer until the communication is completed.

10. A device based on serial communication, It is characterized in that Applied to the host computer to send action flow, including: The sending module is used to send the action data packet to the lower computer, wherein the action data packet includes the action instruction number and the check code; A receiving module, used for receiving a confirmation action data packet from a lower computer, wherein the confirmation action data packet includes a confirmation action instruction number and a check code; The judgment module is used to judge whether the received verification code is correct and the received confirmation action instruction number is equal to the action instruction number. If so, the sending action process is terminated and the sending action is successful; if not, the action data packet is re-issued to execute the sending action process until the sending action is successful.

11. A device based on serial communication, It is characterized in that Applied to the lower computer to confirm the action process, including: A checking module is used to check whether the action instruction number received from the host computer is consistent with the action instruction number of the action data packet with the correct verification code received last time, and the action instruction number of the action data packet is different from the instruction number of the previous action and the instruction numbers of all actions being executed; The uploading module is used to upload a confirmation action data packet to the host computer if the inspection results of the inspection module are inconsistent. The confirmation action instruction number of the confirmation action data packet is equal to the action instruction number just received, and the process ends.

12. A system based on serial communication, It is characterized in that It includes an upper computer and a lower computer, wherein the upper computer is used to execute a sending action process when a new action needs to be executed, and the lower computer is used to execute a confirmation action process each time an action data packet is received from the upper computer and the verification code of the data packet is correct; and / or, the upper computer is used to execute a query process at regular intervals when there is no new action, and the lower computer is used to execute a return status process each time a query data packet is received from the upper computer and the verification code of the data packet is correct.

Citation Information

Patent Citations

  • Method for on-line burning and verifying method of EEPROM of automobile instrument

    CN105161130A

  • Chip online upgrading method and computer readable storage medium

    CN107562493A

  • Method and system for implementing request confirmation operation by single channel

    CN107959552A

  • Vehicle fault diagnosis communication method, device and equipment and storage medium

    CN115695020A

  • Inter-processor data communication method

    JP1998190770A