Real-time data transmission method, device, equipment and readable storage medium

By receiving calibration instructions in serial communication and generating timestamps, the problem of data storage timing disorder caused by asynchronous communication is solved, the efficiency and accuracy of real-time data transmission are improved, and the accuracy of time-domain analysis of data is ensured.

CN115987449BActive Publication Date: 2024-11-26HANGZHOU HOLLYSYS AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211131157.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-16
Publication Date
2024-11-26
Estimated Expiration
2042-09-16

AI Technical Summary

Technical Problem

Existing serial communications lead to data storage timing disorder in an asynchronous communication environment, which in turn affects the accuracy of data time domain analysis, especially in systems with high requirements for real-time performance.

Method used

By receiving the timing instructions of the upper computer, performing the timing operations and generating a timestamp, adding the timestamp to the serial port data, and sending it to the upper computer as the data to be transmitted, ensuring the consistency of the timestamps during the transmission process.

Benefits of technology

It solves the problem of data storage timing disorder caused by asynchronous communication, improves the efficiency and accuracy of real-time data transmission, and avoids data time domain analysis errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115987449B_ABST
    Figure CN115987449B_ABST
Patent Text Reader

Abstract

The present invention discloses a real-time data transmission method, which is applied to the communication field, including: receiving a time calibration instruction from a host computer, and performing a time calibration operation according to the time calibration instruction; after performing the time calibration operation, generating serial port data and a first timestamp; adding the first timestamp to the serial port data as data to be transmitted; and sending the data to be transmitted to the host computer. The present invention solves the problem of data storage timing disorder caused by transmission when real-time data is transmitted through a serial port between asynchronous communication devices by adding a timestamp to the generated serial port data after time calibration, using the method as data to be transmitted and sending it to the host computer, thereby solving the problem of errors in the time domain analysis of the stored data and improving the efficiency of real-time data transmission. In addition, the present invention also provides a real-time data transmission device, equipment and readable storage medium, which also have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a real-time data transmission method, device, equipment and a readable storage medium. Background Art

[0002] With the application of computer systems and the development of microcomputer networks, communication functions are becoming more and more important. Since serial communication transmits information one bit at a time on a transmission line, fewer transmission lines are used, thus saving communication costs in long-distance communication.

[0003] Existing serial communication mainly relies on the data receiving and sending timing and adding check bits to ensure the accuracy of data and timing, while the two ends of serial communication are asynchronous communication, and there are differences in the receiving and sending rates. For example, in a scenario where a single-chip microcomputer is used as the lower computer and a PC (microcomputer) is used as the upper computer, this method is fine if the upper and lower computers have relatively low real-time requirements, but this method cannot meet the requirements of systems with high data real-time requirements. Due to the asynchronous communication between the upper and lower computers, later data will be stored before older data, causing data storage timing disorder, which in turn leads to errors in the time domain analysis of the stored data. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a real-time data transmission method, device, equipment and readable storage medium, which solves the problem of data storage timing disorder caused by transmission in asynchronous communication in the prior art, and further solves the problem of errors in time domain analysis of stored data.

[0005] In order to solve the above technical problems, the present invention provides a real-time data transmission method, comprising:

[0006] Receive the time calibration instruction from the host computer, and perform the time calibration operation according to the time calibration instruction;

[0007] After executing the time calibration operation, generating serial port data and a first timestamp;

[0008] Adding the first timestamp to the serial port data as data to be transmitted;

[0009] The data to be transmitted is sent to the host computer.

[0010] Optionally, after performing the time calibration operation, generating serial port data and a first timestamp includes:

[0011] Receiving a communication instruction from the host computer and a generated second timestamp;

[0012] Calculate the first time interval from the time when the host computer communication instruction is received after time calibration to the time when the serial port data is generated;

[0013] The second timestamp is added to the first time interval to obtain the first timestamp.

[0014] Optionally, the receiving of a time calibration instruction from a host computer includes:

[0015] Receive the time calibration instruction from the host computer and the generated third timestamp.

[0016] Optionally, performing a time calibration operation according to the time calibration instruction includes:

[0017] Calculate the second time interval from the time when the host computer time calibration instruction is received to the time when the time calibration data is sent;

[0018] Add the second time interval to the third timestamp as a fourth timestamp;

[0019] The fourth timestamp is sent to the host computer for time calibration.

[0020] Optionally, sending the fourth timestamp to the host computer for time calibration includes:

[0021] Determine whether the deviation value between the fourth timestamp and the time of the host computer is less than a preset deviation threshold;

[0022] If so, it is determined that the time calibration is completed.

[0023] Optionally, the adding the first timestamp to the serial port data as data to be transmitted includes:

[0024] The first timestamp is added to the front position of the serial port data as the data to be transmitted.

[0025] Optionally, the receiving of a time calibration instruction from a host computer includes:

[0026] A time calibration instruction is received at a preset interval.

[0027] The present invention also provides a real-time data transmission device, comprising:

[0028] A first execution module, used for receiving a time calibration instruction from a host computer and performing a time calibration operation according to the time calibration instruction;

[0029] A generating module, used for generating serial port data and a first timestamp after executing the time calibration operation;

[0030] A second execution module, configured to add the first timestamp to the serial port data as data to be transmitted;

[0031] The first sending module is used to send the data to be transmitted to the host computer.

[0032] The present invention also provides a real-time data transmission device, comprising:

[0033] A transmission component, used for executing data transmission;

[0034] Memory for storing computer programs;

[0035] The processor is used to execute the computer program to implement the steps of the above-mentioned real-time data transmission method.

[0036] The present invention also provides a readable storage medium for storing a computer program, wherein the computer program implements the steps of the above-mentioned real-time data transmission method when executed by a processor.

[0037] It can be seen that the method receives the time calibration instruction of the host computer and performs the time calibration operation according to the time calibration instruction. After performing the time calibration operation, serial port data and a first timestamp are generated, and the first timestamp is added to the serial port data as the data to be transmitted, and the data to be transmitted is sent to the host computer. The method solves the problem of data storage timing disorder caused by transmission when real-time data is transmitted through the serial port between asynchronous communication devices by adding a timestamp to the generated serial port data after time calibration, and sends it to the host computer as the data to be transmitted. It further solves the problem of errors in the time domain analysis of the stored data, and improves the efficiency of real-time data transmission.

[0038] In addition, the present invention also provides a real-time data transmission device, equipment and readable storage medium, which also have the above beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0040] Figure 1 A flowchart of a real-time data transmission method provided by an embodiment of the present invention;

[0041] Figure 2 A flowchart of another real-time data transmission method provided by an embodiment of the present invention;

[0042] Figure 3 An exemplary diagram of a real-time data transmission method provided by an embodiment of the present invention;

[0043] Figure 4 A schematic diagram of the structure of a real-time data transmission device provided by an embodiment of the present invention;

[0044] Figure 5 A schematic diagram of the structure of a real-time data transmission device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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.

[0046] Please refer to Figure 1 , Figure 1 A flowchart of a real-time data transmission method provided by an embodiment of the present invention. The method may include:

[0047] S101: Receive a time calibration instruction from a host computer and perform a time calibration operation according to the time calibration instruction.

[0048] This embodiment does not limit the execution subject, for example, it can be a single-chip microcomputer; it can also be a PC; it can also be other execution terminals that can be used as lower computers. After receiving the time calibration instruction from the upper computer, the lower computer performs the time calibration operation according to the time calibration instruction. This embodiment does not limit the startup time of the program that receives the time calibration instruction from the upper computer, for example, it can be automatically started after the lower computer is turned on; it can also be started when the upper computer sends the time calibration instruction. In order to reduce the running time and improve the efficiency of receiving the time calibration instruction, this embodiment can adopt the automatic startup after the lower computer is turned on. Further, in order to improve the accuracy of the time scale and improve the efficiency of real-time data transmission, this embodiment can adopt the method of receiving every first preset interval receiving time. This embodiment does not limit the setting value of the first preset interval receiving time, for example, it can be 5 hours. This embodiment does not limit the setting basis of the setting value of the first preset interval receiving time, for example, it can be set according to the rate at which the lower computer generates data, and the higher the rate at which the lower computer generates data, the smaller the setting value of the first preset interval receiving time; it can also be set according to the time calibration frequency pre-set by the upper computer.

[0049] Furthermore, in order to save the cost of the single-chip microcomputer and improve the universality of the application, the above-mentioned receiving the time calibration instruction of the host computer may include the steps of receiving the time calibration instruction of the host computer and generating a third timestamp.

[0050] The timestamp is a string indicating time, generally consisting of eight-byte characters. The setting basis of the third timestamp is not limited. It can be the time when the host computer generates the time calibration instruction as the third timestamp; it can also be the time when the host computer sends the time calibration instruction as the third timestamp.

[0051] Further, in order to improve the accuracy of time synchronization and the efficiency of real-time data transmission, the time synchronization operation performed according to the time synchronization instruction may include the following steps, which may include:

[0052] S201: Calculate a second time interval from the time when the time calibration instruction of the host computer is received to the time when the time calibration data is sent.

[0053] After receiving the time calibration instruction and the third timestamp from the host computer, obtain the time when the lower computer receives the time calibration instruction from the host computer and the time when the lower computer sends the time calibration data to the host computer, and calculate the second time interval between receiving the time calibration instruction from the host computer and sending the time calibration data by the lower computer.

[0054] S202: Add the second time interval to the third timestamp to obtain a fourth timestamp.

[0055] The third timestamp generated by the upper computer and the second time interval between when the lower computer receives the time calibration instruction from the upper computer and sends the time calibration data is calculated as the fourth timestamp.

[0056] S203: Send the fourth timestamp to the host computer for time calibration.

[0057] The fourth timestamp obtained by the processing of the lower computer is sent to the upper computer for time calibration.

[0058] Further, in order to improve the accuracy and efficiency of time calibration, the sending of the fourth timestamp to the host computer for time calibration may include the following steps, which may include:

[0059] S301: Determine whether a deviation between the fourth timestamp and the time of the host computer is less than a preset deviation threshold.

[0060] Determine whether the time deviation value between the fourth timestamp and the current time of the host computer is less than the preset deviation threshold. The present embodiment does not limit the setting value of the preset deviation threshold, for example, it can be 1 microsecond. The present embodiment does not limit the setting basis of the preset deviation threshold, for example, it can be set according to the rate value of the serial port data generated by the lower computer, the larger the rate value of the serial port data generated by the lower computer, the smaller the setting value of the preset deviation threshold; it can also be based on the operator's custom setting of the preset deviation threshold.

[0061] S302: If yes, it is determined that the time calibration is completed.

[0062] S102: After executing the time calibration operation, generating serial port data and a first timestamp.

[0063] After the lower computer completes the time calibration operation, it communicates and generates serial port data and a first timestamp, wherein the first timestamp is a time mark when the serial port data is generated, and one serial port data corresponds to one timestamp. The serial port data generated in this embodiment is generally multiple, which is not limited here. This embodiment is described by taking one serial port data generated as an example.

[0064] Further, in order to improve the accuracy of the timestamp corresponding to the serial port data, and thus improve the efficiency of real-time data transmission, the above-mentioned generation of the serial port data and the first timestamp after the time calibration operation is performed may include the following steps. For details, please refer to Figure 2 , Figure 2 A flowchart of another real-time data transmission method provided by an embodiment of the present invention. The method may include:

[0065] S401: Receive a communication instruction from a host computer and a generated second timestamp.

[0066] Receive the communication instruction of the host computer and the generated second timestamp, wherein the second timestamp is the moment mark when the host computer sends the communication instruction. This embodiment does not limit the startup time of the program that receives the communication instruction of the host computer and the generated second timestamp, for example, it can be automatically started after the time calibration operation is completed; it can also be started when the host computer sends the communication instruction. In order to reduce the running time and improve the efficiency of receiving the communication instruction, this embodiment can adopt automatic startup after the time calibration operation is completed. This embodiment does not limit the frequency of receiving the communication instruction of the host computer and the generated second timestamp, for example, it can be receiving the communication instruction of the host computer and the generated second timestamp once before the next time calibration operation; it can also be receiving the communication instruction of the host computer and the generated second timestamp in real time before the next time calibration operation; it can also be receiving the communication instruction of the host computer and the generated second timestamp once every second preset interval reception time before the next time calibration operation. This embodiment does not limit the setting value of the second preset interval reception time, for example, it can be 1 second. This embodiment does not limit the setting basis of the setting value of the second preset interval receiving time, for example, it can be set according to the rate at which the lower computer generates data, and the higher the rate at which the lower computer generates data, the smaller the setting value of the second preset interval receiving time. In order to increase the rate of real-time data transmission and improve the efficiency of real-time data transmission, this embodiment can adopt a method of receiving a communication instruction from the upper computer and the generated second timestamp once before the next time calibration operation.

[0067] S402: Calculate a first time interval from the time when the communication instruction from the host computer is received after time calibration to the time when the serial port data is generated.

[0068] The time when the lower computer receives the communication instruction of the upper computer after time calibration and the time when the lower computer generates serial port data are obtained, and the first time interval between receiving the communication instruction of the upper computer and generating the serial port data by the lower computer is calculated.

[0069] S403: Add the first time interval to the second timestamp to obtain a first timestamp.

[0070] The second timestamp generated by the upper computer and the first time interval between receiving the communication instruction of the upper computer and generating the serial port data by the lower computer are calculated as the first timestamp.

[0071] S103: Add the first timestamp to the serial port data as data to be transmitted.

[0072] After the first timestamp is generated, the first timestamp is added to the serial port data as data to be transmitted by the lower computer.

[0073] Furthermore, in order to increase the rate of data analysis and improve the efficiency of data transmission, the above-mentioned adding the first timestamp to the serial port data as the data to be transmitted may include adding the first timestamp to the front position of the serial port data as the data to be transmitted.

[0074] The first timestamp is added to the front position of the serial port data to form the data to be transmitted.

[0075] Furthermore, in order to improve data integrity and improve the accuracy of real-time data transmission, the above-mentioned real-time data transmission method may also include adding a check bit to the back end of the serial port data.

[0076] S104: Send the data to be transmitted to the host computer.

[0077] The data to be transmitted is sent to the host computer for processing. The present embodiment does not limit the sending method of the data to be transmitted to the host computer. For example, it can be sent directly after the data to be transmitted is generated, or it can be sent at a preset interval sending time. The present embodiment does not limit the setting value of the preset interval sending time. For example, it can be 2 microseconds. The present embodiment does not limit the setting basis of the setting value of the preset interval sending time. For example, it can be set according to the storage rate of the host computer. The larger the storage rate of the host computer, the smaller the setting value of the preset interval sending time. In order to improve the efficiency of real-time data transmission, the present embodiment can adopt a sending method of directly sending the data to be transmitted after it is generated.

[0078] Further, in order to make the present invention easier to understand, please refer to Figure 3 , Figure 3 An example diagram of a real-time data transmission method provided by an embodiment of the present invention may specifically include the following steps:

[0079] This example uses a PC as the host computer and a microcontroller as the slave computer.

[0080] Step S1: time adjustment operation.

[0081] Before the PC (host computer) and the MCU (slave computer) transmit data, the PC generates a time calibration command. When sending the time calibration command, the PC generates an eight-byte timestamp based on the current time as the third timestamp, adds it to the leading position of the time calibration command, and sends it to the MCU.

[0082] After startup, the microcontroller receives the time calibration command sent by the PC in real time, and calculates the second time interval from the microcontroller receiving the time calibration command sent by the PC to the microcontroller sending the time calibration data, and adds the time marked by the third timestamp received by the microcontroller to the time of the second time interval as the fourth timestamp.

[0083] The fourth timestamp is sent to the PC, and the PC calculates the time deviation value between the current moment and the moment marked by the fourth timestamp. If the time deviation value between the current moment and the moment marked by the fourth timestamp is less than or equal to the set preset deviation threshold, it is determined that the time calibration is completed; if the time deviation value between the current moment and the moment marked by the fourth timestamp is less than the set preset deviation threshold, the time of the single-chip microcomputer or the PC is adjusted to ensure that the single-chip microcomputer and the PC have unified time synchronization, and the time calibration operation is re-executed after calibration.

[0084] Step S2: Data generation.

[0085] After the PC and the MCU complete the time calibration operation, the PC and the MCU perform data transmission. The PC generates a communication instruction, and when sending the communication instruction, the PC generates an eight-byte timestamp corresponding to the current time as the second timestamp, and adds it to the front position of the communication instruction and sends it to the MCU.

[0086] After the time calibration is completed, the single-chip computer receives the communication instruction sent by the PC, and calculates the first generation time interval from the single-chip computer receiving the communication instruction sent by the PC to the single-chip computer generating the first serial port data, and adds the time marked by the second timestamp received by the single-chip computer to the time of the first generation time interval as the first generation timestamp. The first generation timestamp is added to the leading position of the first serial port data, and the check bit is added to the trailing position of the first serial port data as the first data to be transmitted.

[0087] After the single-chip microcomputer generates the first serial port data, the single-chip microcomputer generates the second serial port data, and calculates the second generation time interval from the single-chip microcomputer receiving the communication command sent by the PC to the single-chip microcomputer generating the second serial port data, and adds the time marked by the second timestamp received by the single-chip microcomputer to the time of the second generation time interval as the second generation timestamp. The second generation timestamp is added to the leading position of the second serial port data, and the check bit is added to the trailing position of the second serial port data as the second data to be transmitted. The subsequent generation process of the data to be transmitted is similar to the generation process of the first and second data to be transmitted, and will not be repeated here.

[0088] Step S3: Data transmission.

[0089] After the data to be transmitted is generated, the single chip microcomputer sends the data to be transmitted to the PC for processing. It does not need to consider the transmission order for storage processing, and performs time domain data analysis through the timestamp in the front position of the data to be transmitted.

[0090] It should be noted that in this embodiment Figure 3 The description contents corresponding thereto are merely examples of the present invention and should not be construed as limitations of the present invention.

[0091] The real-time data transmission method provided by the embodiment of the present invention is applied to receive the time calibration instruction of the host computer, perform the time calibration operation according to the time calibration instruction, and generate serial port data and a first timestamp after performing the time calibration operation. The first timestamp is added to the serial port data, and the data to be transmitted is sent to the host computer as the data to be transmitted. This method solves the problem of data storage timing disorder caused by transmission when real-time data is transmitted through the serial port between asynchronous communication devices by adding a timestamp to the generated serial port data after time calibration, and sends it to the host computer as the data to be transmitted. It further solves the problem of errors in the time domain analysis of the stored data, improves the efficiency of real-time data transmission, and ensures the integrity of data transmission by adding a check bit at the post-position of the serial port data, thereby improving the efficiency of real-time data transmission.

[0092] The real-time data transmission device provided by an embodiment of the present invention is introduced below. The real-time data transmission device described below and the real-time data transmission method described above can be referred to each other.

[0093] Please refer to Figure 4 , Figure 4 A structural diagram of a real-time data transmission device provided by an embodiment of the present invention may include:

[0094] The first execution module 100 is used to receive a time calibration instruction from a host computer and execute a time calibration operation according to the time calibration instruction;

[0095] A generating module 200, for generating serial port data and a first timestamp after executing a time calibration operation;

[0096] The second execution module 300 is used to add the first timestamp to the serial port data as data to be transmitted;

[0097] The first sending module 400 is used to send the data to be transmitted to the host computer.

[0098] Based on the above embodiment, the generating module 200 may include:

[0099] A first execution unit, used for receiving a communication instruction from a host computer and a generated second timestamp;

[0100] A first calculation unit, used for calculating a first time interval from the time when a communication instruction from a host computer is received after time calibration to the time when serial port data is generated;

[0101] The first generating unit is configured to add the first time interval to the second timestamp to obtain the first timestamp.

[0102] Based on the above embodiment, the first execution module 100 may include:

[0103] The second execution unit is used to receive the time calibration instruction from the host computer and the generated third timestamp.

[0104] Based on any of the above embodiments, the first execution module 100 may include:

[0105] The second calculation unit is used to calculate a second time interval from the time when the time calibration instruction of the host computer is received to the time when the time calibration data is sent;

[0106] A second generating unit, configured to add a second time interval to the third timestamp as a fourth timestamp;

[0107] The first sending unit is used to send the fourth timestamp to the host computer for time calibration.

[0108] Based on any of the foregoing embodiments, the first sending unit may include:

[0109] A first judging unit, used to judge whether a deviation value between the fourth timestamp and the time of the host computer is less than a preset deviation threshold;

[0110] The first determining unit is used to determine that the time calibration is completed if yes.

[0111] Based on any of the above embodiments, the second execution module 300 may include:

[0112] The third execution unit is used to add the first timestamp to the front position of the serial port data as the data to be transmitted.

[0113] Based on any of the above embodiments, the first execution module 100 may include:

[0114] The fourth execution unit is used to receive a time calibration instruction once every preset interval time.

[0115] The real-time data transmission device provided by the embodiment of the present invention is applied, and the first execution module 100 is used to receive the time calibration instruction of the host computer, and perform the time calibration operation according to the time calibration instruction. The generation module 200 is used to generate serial port data and a first timestamp after performing the time calibration operation. The second execution module 300 is used to add the first timestamp to the serial port data as the data to be transmitted, and the first sending module 400 is used to send the data to be transmitted to the host computer. The real-time data transmission device provided by the embodiment of the present invention solves the problem of data storage timing disorder caused by transmission when real-time data is transmitted through the serial port between asynchronous communication devices by adding a timestamp to the generated serial port data after time calibration, and sends it to the host computer as the data to be transmitted. It further solves the problem of errors in the time domain analysis of the stored data, improves the efficiency of real-time data transmission, and ensures the integrity of data transmission by adding a check bit at the post position of the serial port data, thereby improving the efficiency of real-time data transmission.

[0116] The real-time data transmission device provided by an embodiment of the present invention is introduced below. The real-time data transmission device described below and the real-time data transmission method described above can be referred to each other.

[0117] An embodiment of the present invention provides a real-time data transmission device, which may include:

[0118] A transmission component, used for executing data transmission;

[0119] Memory for storing computer programs;

[0120] The processor is used to execute a computer program to implement the above-mentioned real-time data transmission method.

[0121] The real-time data transmission device provided by the embodiment of the present invention is applied to receive the time calibration instruction of the host computer, perform the time calibration operation according to the time calibration instruction, and generate serial port data and a first timestamp after performing the time calibration operation. The first timestamp is added to the serial port data, and the data to be transmitted is sent to the host computer as the data to be transmitted. The method solves the problem of data storage timing disorder caused by transmission when real-time data is transmitted through the serial port between asynchronous communication devices by adding a timestamp to the generated serial port data after time calibration, and sends it to the host computer as the data to be transmitted. It further solves the problem of error in time domain analysis of stored data, and improves the efficiency of real-time data transmission.

[0122] like Figure 5, which is a schematic diagram of the structure of a real-time data transmission device, may include: a transmission component 10, a memory 20, a processor 30 and a communication bus 31. The transmission component 10, the memory 20 and the processor 30 communicate with each other through the communication bus 31.

[0123] In the embodiment of the present invention, the transmission component is used to complete the transmission of data.

[0124] In addition, the memory 20 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 20 may store programs for implementing the following functions:

[0125] Receive the time calibration instruction from the host computer and perform the time calibration operation according to the time calibration instruction;

[0126] After executing the time calibration operation, serial port data and a first timestamp are generated;

[0127] Add the first timestamp to the serial port data as data to be transmitted;

[0128] Send the data to be transmitted to the host computer.

[0129] In a possible implementation, the memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0130] In addition, the memory 20 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0131] The processor 30 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device, a microprocessor or any conventional processor, etc. The processor 30 may call a program stored in the memory 20 .

[0132] Of course, it should be noted that Figure 5 The structure shown does not constitute a limitation on the real-time data transmission device in the embodiment of the present application. In actual applications, the real-time data transmission device may include Figure 5More or fewer components than shown, or combinations of certain components.

[0133] The following is an introduction to a readable storage medium provided in an embodiment of the present invention. The readable storage medium described below and the real-time data transmission method described above can be referenced to each other.

[0134] The present invention also provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned real-time data transmission method are implemented.

[0135] The readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0136] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0137] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0138] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device 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, article or device.

[0139] The real-time data transmission method, device, equipment and readable storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A real-time data transmission method, characterized in that: include: Receive the time calibration instruction from the host computer, and perform the time calibration operation according to the time calibration instruction; After executing the time calibration operation, generating serial port data and a first timestamp; Adding the first timestamp to the serial port data as data to be transmitted; Sending the data to be transmitted to the host computer; After executing the time calibration operation, generating serial port data and a first timestamp includes: Receiving a communication instruction from the host computer and a generated second timestamp; Calculate the first time interval from the time when the host computer communication instruction is received after time calibration to the time when the serial port data is generated; Add the first time interval to the second timestamp as the first timestamp; The receiving of the time calibration instruction from the host computer comprises: Receiving the time calibration instruction from the host computer and the generated third timestamp; The performing of the time calibration operation according to the time calibration instruction comprises: Calculate the second time interval from the time when the host computer time calibration instruction is received to the time when the time calibration data is sent; Add the second time interval to the third timestamp as a fourth timestamp; Sending the fourth timestamp to the host computer for time calibration; The sending the fourth timestamp to the host computer for time calibration includes: Determine whether the deviation value between the fourth timestamp and the time of the host computer is less than a preset deviation threshold; If so, it is determined that the time calibration is completed.

2. The real-time data transmission method according to claim 1, characterized in that: The adding the first timestamp to the serial port data as data to be transmitted includes: The first timestamp is added to the front position of the serial port data as the data to be transmitted.

3. The real-time data transmission method according to claim 1, characterized in that: The receiving of the time calibration instruction from the host computer comprises: A time calibration instruction is received at a preset interval.

4. A real-time data transmission device, characterized in that: include: A first execution module, used for receiving a time calibration instruction from a host computer and performing a time calibration operation according to the time calibration instruction; A generating module, used for generating serial port data and a first timestamp after executing the time calibration operation; A second execution module, configured to add the first timestamp to the serial port data as data to be transmitted; A first sending module, for sending the data to be transmitted to the host computer; The generating module comprises: A first execution unit, configured to receive a communication instruction from the host computer and a generated second timestamp; A first calculation unit, used for calculating a first time interval from the time when the communication instruction of the host computer is received after time calibration to the time when the serial port data is generated; a first generating unit, configured to add the first time interval to the second timestamp as the first timestamp; The first execution module includes: A second execution unit, used for receiving the time calibration instruction of the host computer and the generated third timestamp; The first execution module includes: A second calculation unit, used for calculating a second time interval from the time when the time calibration instruction of the host computer is received to the time when the time calibration data is sent; A second generating unit, configured to add the second time interval to the third timestamp as a fourth timestamp; A first sending unit, used for sending the fourth timestamp to the host computer for time calibration; The first sending unit includes: A first judging unit, used to judge whether a deviation value between the fourth timestamp and the time of the host computer is less than a preset deviation threshold; The first determining unit is used to determine that the time calibration is completed if yes.

5. A real-time data transmission device, characterized in that: include: A transmission component, used for executing data transmission; Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the real-time data transmission method according to any one of claims 1 to 3.

6. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the real-time data transmission method according to any one of claims 1 to 3 are implemented.