Data communication methods, communication devices and computer-readable storage media
By setting up multiple communication interfaces in the communication device and adopting a priority separation mechanism, the problem that existing technologies cannot support multiple communication interfaces at the same time is solved, realizing the simultaneous transmission of multiple communication data and data analysis feedback, thus enhancing the stability and versatility of the system.
Patent Information
- Application Number
- CN202310067319.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-18
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-01-18
AI Technical Summary
Existing technologies cannot simultaneously support multiple communication interfaces, data analysis, and communication feedback functions, forcing users to use multiple communication modules and different PC software in certain application scenarios.
By setting up multiple communication interfaces in the communication device and adopting a priority separation mechanism for timed refresh and communication interruption events, the efficient separation of data frame reception and processing is ensured, enabling the simultaneous transmission of multiple types of communication data.
It supports multiple communication interfaces while avoiding communication interruption and crosstalk, enhancing the stability and versatility of the system, and supporting data analysis and feedback functions.
Smart Images

Figure CN116094967B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a data communication method, communication device, and computer-readable storage medium. Background Technology
[0002] Currently, the market mainly offers the following types of communication modules, each with different application scenarios and supporting different communication protocols. For example, serial communication modules can support UART and RS485; I2C / SPI communication modules; and USB communication modules.
[0003] In certain application scenarios, such as when users want to use communication technologies like UART, I2C, and USB simultaneously, they also need to support data analysis and communication feedback functions. In such cases, users must use multiple communication modules and different PC software.
[0004] Therefore, how to provide a data communication method, communication device, and computer-readable storage medium to solve the shortcomings of existing technologies, such as the inability to support multiple communication interfaces simultaneously and the lack of support for data analysis and communication feedback functions, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to propose a data communication method that enables communication devices to separate packet receiving and data processing while supporting data communication through multiple communication interfaces, thereby enhancing versatility.
[0006] The first aspect of this invention provides a data communication method applied to a communication system, the communication system including a first communication device and N second communication devices connected to the first communication device, wherein the first communication device is provided with N communication interfaces, and the first communication device is connected to the second communication devices through the communication interfaces, and N is greater than or equal to 2; the data communication method includes the following steps: after the first communication device is powered on, each of the communication interfaces is detected; when a data frame reception event is detected at a communication interface, a timed refresh event of the communication interface is executed; simultaneously, during the execution of the timed refresh event of the communication interface, a communication interruption event is monitored according to a preset communication interruption priority; if so, the execution of the timed refresh event of the communication interface is paused, and the execution of the communication interruption event is switched to; after the communication interruption event is completed, the execution of the timed refresh event of the communication interface continues; if not, the execution of the timed refresh event of the communication interface continues; wherein the priority of the communication interruption event is higher than the priority of the timed refresh event.
[0007] In another illustrative embodiment of the present invention, the communication interruption event includes: a data frame reception event and / or an information transmission event; the preset communication interruption priority is: the data frame reception event has the highest priority, the information transmission event has the middle priority, and the timed refresh event has the lowest priority; wherein, the information transmission event includes: a feedback information transmission event and / or a heartbeat packet cyclic transmission event; the timed refresh event includes: a data frame data processing event and / or a timed interface display event. By defining the communication interruption priority, crosstalk between communication interruptions of different communication interfaces is avoided, enabling the simultaneous transmission of multiple communication data.
[0008] In another illustrative embodiment of the present invention, if there is a communication interface for receiving data frames, before executing the timed refresh event of the communication interface, the data communication method further includes: storing the data frames received by the communication interface in a first buffer space corresponding to the communication interface.
[0009] In another illustrative embodiment of the present invention, the steps of executing the data processing event in the timed refresh event of the communication interface include: cyclically determining whether the data frame of the communication interface has ended transmission; if so, verifying whether the data frame is complete; if the data frame is complete, sending a first feedback message to the second communication device that sent the data frame, and transferring the data frame from the first buffer space to the second buffer space; storing the data frame in the second buffer space in the programmable read-only memory of the first communication device; wherein the stored data frame has a timestamp; if the data frame is incomplete, sending a second feedback message to the second communication device that sent the data frame; the first feedback message is used to inform the second communication device that a complete data frame has been sent; the second feedback message is used to inform the second communication device that the data frame sent is incomplete; if not, continuing to determine whether the data frame has ended transmission; the steps of executing the timed interface display event in the timed refresh event of the communication interface include: periodically displaying the data frame. The first buffer space and the second buffer space can enhance system stability and prevent data frame overflow.
[0010] In another illustrative embodiment of the present invention, the data length in the first buffer space is read periodically and cyclically. If the data length of several consecutive received data frames remains unchanged, it is determined that the data frame transmission has ended. The determination of whether a data frame transmission has ended can be hot-swapped, enabling plug-and-play functionality.
[0011] In another illustrative embodiment of the present invention, the integrity of the data frame is verified by a pre-set verification method. If the verification result obtained by the pre-set verification method matches the verification result of the received data frame, the data frame is considered complete. The pre-set verification method includes no checksum, 8-bit checksum, XOR checksum, and / or CRC-16 checksum. Verifying the integrity of the data frame indicates whether the received data frame is valid.
[0012] In another illustrative embodiment of the present invention, when, according to a preset communication interruption priority, the monitored communication interruption event is a new data frame reception event occurring on the communication interface that has already received the data frame, the data communication method further includes: cyclically detecting whether a new data frame reception event has occurred on the communication interface that has already received the data frame; if so, pausing the execution of the timed refresh event of the communication interface and switching to the execution of the new data frame reception event; after the new data frame reception event is completed, continuing the execution of the timed refresh event of the communication interface; if not, pausing the execution of the timed refresh event of the communication interface and switching to the execution of the cyclic transmission event of the heartbeat packet in the information transmission event; wherein, the cyclic transmission event of the heartbeat packet refers to continuously sending heartbeat packets to the second communication device that sends the data frame according to a predetermined transmission period; if a third feedback information is received after sending several heartbeat packets, then the timed refresh event of the communication interface continues to be executed; if the third feedback information is not received after sending several heartbeat packets, it indicates that the communication of the second communication device that sends the data frame is abnormally interrupted, and an alarm information is generated; the third feedback information is used by the second communication device to inform the first communication device with which it communicates that its communication is normal. Data frame loss is prevented by setting the data frame receive event to the highest priority. A communication error correction mechanism is implemented by prioritizing the cyclical sending of heartbeat packets over the timed refresh event.
[0013] In another illustrative embodiment of the present invention, when a communication interruption event is detected as another communication interface receiving the data frame, based on a preset communication interruption priority, the data communication method further includes: cyclically detecting whether another communication interface has received the data frame; if so, pausing the timed refresh event of the communication interface that has already received the data frame and switching to executing the data frame receiving event of the other communication interface; after the data frame receiving event of the other communication interface is completed, continuing to execute the timed refresh event of the communication interface that has already received the data frame; if not, continuing to execute the timed refresh event of the communication interface that has already received the data frame. By setting the data frame receiving event to the highest priority, the loss of data frames received by other communication interfaces is avoided.
[0014] The present invention also provides a communication device that can separate packet receiving and data processing while supporting data communication through multiple communication interfaces, thereby enhancing versatility.
[0015] A second aspect of the present invention provides a communication device, comprising: N communication interfaces, at least one memory (403), and at least one processor. The communication interfaces are configured to connect to at least one communication device, where N is greater than or equal to 2; the memory is configured to store computer-readable code; and the processor is configured to invoke the computer-readable code to execute the steps of the aforementioned data communication method.
[0016] A third aspect of the present invention provides a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, cause the processor to perform the steps in the aforementioned data communication method. Attached Figure Description
[0017] The following figures are for illustrative purposes only and do not limit the scope of the invention.
[0018] Figure 1 This is an exemplary structural diagram of the present invention applied to a communication system.
[0019] Figure 2 This is an exemplary flowchart of the data communication method of the present invention.
[0020] Figure 3 This is an exemplary flowchart of step S22 in the data communication method of the present invention.
[0021] Figure 4 This is an exemplary structural diagram of the communication device of the present invention.
[0022] The accompanying figure is labeled as follows:
[0023] 1. Communication System
[0024] 11 First Communication Equipment
[0025] 12 Second Communication Equipment
[0026] 11A / 11B / … / 11E communication interfaces
[0027] 400 communication equipment
[0028] 402 processor
[0029] 403 Memory
[0030] Steps in the data communication method (S21-S24)
[0031] Steps in S221~S222 (S22)
[0032] Steps in S2211~S2214 S221 Detailed Implementation
[0033] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described with reference to the accompanying drawings. In the drawings, the same reference numerals indicate components with the same or similar structures but the same function.
[0034] In this document, “illustrative” means “serving as an example, illustration or description”, and any illustration or implementation described herein as “illustrative” should not be construed as a more preferred or advantageous technical solution.
[0035] To keep the drawings concise, only the parts relevant to the invention are shown schematically in each figure, and they do not represent the actual structure of the product. Furthermore, for ease of understanding, in some figures, only one of the components with the same structure or function is shown schematically, or only one is labeled.
[0036] In this article, "one" can mean not only "only one" but also "more than one". In this article, "first", "second", etc., are used only to distinguish them from each other, not to indicate their importance or order.
[0037] This embodiment provides a data communication method, which is applied to, for example... Figure 1 The communication system 1 shown includes a first communication device 11 and N second communication devices 12 connected to the first communication device 11. The first communication device 11 has N communication interfaces (e.g., communication interfaces 11A, 11B, ..., 11N). The first communication device 11 is connected to the second communication devices 12 through these communication interfaces, and N is greater than or equal to 2. For example, as shown... Figure 1 As shown, communication interface 11A can be I2C, communication interface 11B can be SPI, communication interface 11C can be UART, communication interface 11D can be RS485, and communication interface 11E can be USB. The data communication method provided in this embodiment enables the communication device to support data communication through multiple communication interfaces while separating packet reception and data processing, thus enhancing versatility.
[0038] Before executing the data communication method, in order to allow users to switch between multiple configuration parameters in the same mode, this embodiment needs to obtain the parameter configurations of each communication interface, such as transmission rate and data stream verification method.
[0039] For example, if the UART communication rate is changed and an instruction is received to switch to a baud rate of 9600: 14F0 03 08F000 0000 00 00 00F0, the MCU will initialize the UART configuration information, configure the baud rate to 9600, and then start UART transmit and receive communication.
[0040] Please see Figure 2 This is shown as an exemplary flowchart of a data communication method. Figure 2 As shown, the data communication method includes the following steps:
[0041] S21: After the first communication device is powered on, check whether a data frame reception event has occurred on each communication interface. If yes, execute S22 and S23; otherwise, return to S21 and continue checking whether a data frame reception event has occurred on each communication interface.
[0042] S22, when a data frame reception event is detected on a communication interface, the timed refresh event of that communication interface is executed.
[0043] The timed refresh events include: data processing events for data frames and / or timed interface display events.
[0044] In this embodiment, to enhance system stability and prevent data frame overflow, each communication interface adopts a dual-buffered data caching structure, that is, a first buffer space and a second buffer space are set up for each communication interface to cache data frames. The first buffer space and the second buffer space occupy RAM space.
[0045] In this embodiment, S22 further includes;
[0046] The data frames received by the communication interface are stored in the first buffer space corresponding to the communication interface.
[0047] Please see Figure 3 This is shown as an exemplary process diagram of S22. Figure 3 As shown, S22 includes:
[0048] S221, executes the data processing event of the data frame of the communication interface.
[0049] Please continue reading. Figure 3 S221 includes the following steps:
[0050] S2211, repeatedly check whether the data frame transmission of the communication interface has ended; if yes, then execute S2212. If no, continue checking whether the data frame transmission of the communication interface has ended.
[0051] In this embodiment, the data length in the first buffer space is read periodically. If the data length of the received data frames remains unchanged for several consecutive times (e.g., 3 consecutive times), the data frame transmission is considered to have ended. The determination of whether the data frame transmission has ended can be hot-swapped, allowing for plug-and-play functionality.
[0052] S2212, Check if the data frame is complete. If yes, proceed to S2213; otherwise, proceed to S2214.
[0053] In this embodiment, the integrity of the data frame is verified using a pre-set verification method. If the verification result obtained through the pre-set method matches the verification result of the received data frame, the data frame is considered complete. The pre-set verification methods include no parity, 8-bit checksum, XOR checksum, and / or CRC-16 checksum. Verifying the integrity of the data frame indicates whether the received data frame is valid.
[0054] Among them, no verification: no verification calculation is required, and the data frame is displayed directly.
[0055] 8-bit checksum: The received data bits are summed directly, and then the lower 8 bits are taken as the check result.
[0056] XOR check: Perform an XOR operation on the received data, and the resulting XOR value is the check result.
[0057] CRC-16 Checksum: 1) Preset a 16-bit register to hexadecimal FFFF (all 1s), this register is called the 16-bit CRC register; 2) XOR the first 8 bits of data with the least significant bit of the 16-bit CRC register, and put the result into the CRC register; 3) Check the least significant bit of the CRC register after XOR. If the least significant bit is 1: the CRC register is first shifted right by 1 bit, and then XORed with the polynomial A001H; if it is 0, the CRC register is shifted right by 1 bit, and no XOR is needed with the polynomial; 4) Repeat step 3) until it is shifted right 8 times, so that the entire 8 bits of data have been processed; 5) Repeat steps 2) to 4) to process the next 8 bits of data; 6) The final CRC register is the CRC code.
[0058] S2213, if the data frame is complete, a first feedback message is sent to the second communication device that sent the data frame, and the data frame is transferred from the first buffer space to the second buffer space. The data frame in the second buffer space is then stored in the programmable read-only memory of the first communication device so that the tester can download the data frame. The stored data frame contains a timestamp. The first feedback message is used to inform the second communication device that a complete data frame has been sent.
[0059] S222, execute the timed interface display event within the timed refresh event of this communication interface to periodically display data frames. Periodically displaying data frames allows testers to view key information data and event status on the display screen in real time.
[0060] S2214, if the data frame is incomplete, a second feedback message is sent to the second communication device that sent the data frame. The second feedback message is used to inform the second communication device that the data frame sent is incomplete.
[0061] S23: During the execution of S22, listen for a communication interruption event based on the preset communication interruption priority. If yes, execute S24; otherwise, continue executing the timed refresh event of the communication interface.
[0062] In this embodiment, communication interruption events include: data frame reception events and / or information transmission events. Information transmission events include: feedback information transmission events and / or, cyclic heartbeat packet transmission events. The preset communication interruption priorities are: data frame reception events have the highest priority, information transmission events have the middle priority, and timed refresh events have the lowest priority. In this embodiment, by defining communication interruption priorities, crosstalk between communication interruptions of different communication interfaces is avoided, enabling the simultaneous transmission of multiple types of communication data.
[0063] S24, if a communication interruption event is detected, the execution of the timed refresh event of the communication interface is paused, and the execution of the communication interruption event is switched to proceed; after the communication interruption event is completed, the execution of the timed refresh event of the communication interface resumes. The communication interruption event has a higher priority than the timed refresh event.
[0064] Specifically, when, according to a preset communication interruption priority, the monitored communication interruption event is a new data frame reception event occurring on a communication interface that has already received a data frame, the data communication method further includes:
[0065] The system continuously checks whether a new data frame reception event has occurred on the communication interface that has already received data frames. If so, it pauses the timed refresh event of that communication interface and proceeds to execute the new data frame reception event. After the new data frame reception event is completed, it resumes the timed refresh event of that communication interface. If not, it pauses the timed refresh event of that communication interface and proceeds to execute the cyclic transmission event of the heartbeat packet in the information transmission event. The cyclic transmission event of the heartbeat packet refers to continuously sending heartbeat packets to the second communication device that transmits data frames according to a predetermined transmission period.
[0066] If a third feedback message is received after sending several heartbeat packets consecutively, the timed refresh event of the communication interface continues to be executed. If no third feedback message is received after sending several heartbeat packets consecutively, it indicates that the communication of the second communication device sending the data frame has been abnormally interrupted, and an alarm message is generated (this alarm message can be an audible alarm and / or an indicator light alarm). The third feedback message is used by the second communication device to inform the first communication device with which it is communicating that its communication is normal. This embodiment avoids data frame loss by setting the data frame reception event to the highest priority. This embodiment implements a communication error correction mechanism by giving the priority of the cyclic heartbeat packet sending event higher than that of the timed refresh event.
[0067] In this embodiment, when an alarm is generated, the tester can manually disable the alarm by pressing a button after on-site inspection. In this embodiment, when the second communication device experiences a communication interruption, it can receive a reset signal to reset the communication device.
[0068] Specifically, when, according to a preset communication interruption priority, the detected communication interruption event is a data frame reception event occurring on another communication interface, the data communication method further includes:
[0069] The system iteratively checks if another communication interface has triggered a data frame reception event. If so, it pauses the timed refresh event of the communication interface that has already received a data frame and proceeds to execute the data frame reception event of the other communication interface. Once the data frame reception event of the other communication interface is complete, it resumes executing the timed refresh event of the communication interface that has already received a data frame. If not, it continues executing the timed refresh event of the communication interface that has already received a data frame. This embodiment sets the data frame reception event to the highest priority to avoid losing data frames received by other communication interfaces.
[0070] This embodiment also provides a communication device. Figure 4 This is an exemplary structural diagram of a communication device according to this application. Figure 4 As shown, the communication device 400 includes N communication interfaces (communication interfaces 11A, 11B, ..., 11N, where N is greater than or equal to 2). For example, as... Figure 4 The device includes communication interfaces 11A, 11B, 11C, 11D, and 11E, at least one processor 402, and at least one memory 403. The communication interfaces are configured to connect to at least one communication device, the memory 403 is configured to store computer-readable code, and the processor 402 is configured to invoke the computer-readable code to execute steps in the described data communication method.
[0071] At least one processor 402 may include a microprocessor, an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a central processing unit (CPU), a graphics processing unit (GPU), a state machine, etc. Embodiments of computer-readable media include, but are not limited to, floppy disks, CD-ROMs, magnetic disks, memory chips, ROMs, RAMs, ASICs, configured processors, all-optical media, all magnetic tapes or other magnetic media, or any other media from which a computer processor can read instructions. Furthermore, various other forms of computer-readable media can send or carry instructions to a computer, including routers, private or public networks, or other wired and wireless transmission devices or channels. Instructions may include code in any computer programming language, including C, C++, C++, Visual Basic, Java, and JavaScript.
[0072] At least one memory 403 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Memory 403 stores an operating system and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof. The operating instructions may include various operation instructions for implementing various operations. The operating system may include various system programs for implementing various basic business functions and handling hardware-based tasks.
[0073] Finally, this embodiment provides a computer-readable storage medium storing computer-readable instructions. When executed by a processor, the computer-readable instructions cause the processor to perform the steps in the aforementioned data communication method.
[0074] At any possible level of technical detail, this application can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this application.
[0075] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, (but not limited to) electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0076] The computer-readable program described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer-readable program instructions from the network and forwards these instructions to a computer-readable storage medium in the respective computing / processing device. The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and procedural programming languages such as "C" or similar programming languages. Computer-readable program instructions may execute entirely on a user's computer, partially on a user's computer, as a standalone software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of this application.
[0077] It should be understood that although this specification is described according to various embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
[0078] The detailed descriptions listed above are merely specific illustrations of feasible embodiments of the present invention and are not intended to limit the scope of protection of the present invention. All equivalent implementations or modifications made without departing from the spirit of the present invention, such as combinations, divisions, or repetitions of features, should be included within the scope of protection of the present invention. In this patent application, nouns and pronouns referring to persons are not limited to specific genders.
Claims
1. A data communication method, characterized in that, The method is applied to a communication system (1), which includes a first communication device (11) and N second communication devices (12). The first communication device (11) is provided with N communication interfaces, and the first communication device (11) is connected to the second communication devices (12) through the communication interfaces. N is greater than or equal to 2. The data communication method includes the following steps: After the first communication device is powered on, each of the communication interfaces is detected. When a data frame reception event is detected on a communication interface, a timed refresh event for that communication interface is executed. Simultaneously, during the execution of the timed refresh event, a communication interruption event is monitored according to a preset communication interruption priority. If a communication interruption event occurs, the execution of the timed refresh event is paused, and the execution of the communication interruption event is initiated. After the communication interruption event is completed, the execution of the timed refresh event resumes. If no communication interruption event occurs, the execution of the timed refresh event continues. The communication interruption event has a higher priority than the timed refresh event. Communication interruption events include: data frame reception events and / or message transmission events; The preset communication interruption priorities are: data frame reception event is the highest priority, information transmission event is the middle priority, and timed refresh event is the lowest priority; wherein, the information transmission event includes: feedback information transmission event and / or heartbeat packet cyclic transmission event; the timed refresh event includes: data frame data processing event and / or timed interface display event.
2. The data communication method according to claim 1, characterized in that, If a communication interface for receiving data frames exists, the data communication method further includes the following steps before executing the timed refresh event of that communication interface: The data frames received by the communication interface are stored in the first buffer space corresponding to the communication interface.
3. The data communication method according to claim 2, characterized in that, The steps for executing the data processing event in the timed refresh event of this communication interface include: The system iteratively determines whether the data frame of the communication interface has finished transmitting; if so, it checks whether the data frame is complete; if the data frame is complete, it sends a first feedback message to the second communication device that sent the data frame, and transfers the data frame from the first buffer space to the second buffer space; it stores the data frame in the second buffer space in the programmable read-only memory of the first communication device; wherein the stored data frame has a timestamp. If the data frame is incomplete, a second feedback message is sent to the second communication device that sent the data frame; the first feedback message is used to inform the second communication device that a complete data frame has been sent; the second feedback message is used to inform the second communication device that the data frame sent is incomplete; otherwise, it continues to determine whether the data frame transmission has ended. The steps for executing the timed refresh event of this communication interface, specifically the timed interface display event, include: The data frames are displayed periodically.
4. The data communication method according to claim 3, characterized in that, The data length in the first buffer space is read in a timed loop. If the data length of several consecutive received data frames remains unchanged, it is determined that the data frame transmission has ended.
5. The data communication method according to claim 3, characterized in that, The integrity of the data frame is verified by a pre-set verification method. If the verification result obtained by the pre-set verification method is consistent with the verification result of the received data frame, it indicates that the data frame is complete. The pre-set verification method includes no verification, 8-bit checksum, XOR checksum / / or CRC-16 checksum.
6. The data communication method according to claim 3, characterized in that, When, according to a preset communication interruption priority, the monitored communication interruption event is a new data frame reception event occurring on a communication interface that has already received the data frame, the data communication method further includes: The system continuously checks whether a new data frame reception event has occurred on the communication interface that has received the data frame. If so, it pauses the execution of the timed refresh event of the communication interface and proceeds to execute the new data frame reception event. After the new data frame reception event is completed, it resumes the execution of the timed refresh event of the communication interface. If not, it pauses the execution of the timed refresh event of the communication interface and proceeds to execute the cyclic transmission event of the heartbeat packet in the information transmission event. The cyclic transmission event of the heartbeat packet refers to continuously sending heartbeat packets to the second communication device that sends the data frame according to a predetermined transmission period. If a third feedback message is received after sending several heartbeat packets, the timed refresh event of the communication interface continues to be executed; if the third feedback message is not received after sending several heartbeat packets, it indicates that the communication of the second communication device sending the data frame is abnormally interrupted, and an alarm message is generated; the third feedback message is used by the second communication device to inform the first communication device with which it is communicating that its communication is normal.
7. The data communication method according to claim 3, characterized in that, When, according to a preset communication interruption priority, the detected communication interruption event is a data frame reception event occurring on another communication interface, the data communication method further includes: The system continuously checks whether another communication interface has received the data frame. If so, it pauses the timed refresh event of the communication interface that has received the data frame and switches to executing the data frame receiving event of the other communication interface. After the data frame receiving event of the other communication interface is completed, it resumes executing the timed refresh event of the communication interface that has received the data frame. If not, it continues executing the timed refresh event of the communication interface that has received the data frame.
8. A communication device, characterized in that, include: N communication interfaces are configured to connect to at least one communication device, where N is greater than or equal to 2. At least one memory (403) is configured to store computer-readable code; At least one processor (402) is configured to invoke the computer-readable code to perform the steps of the data communication method as claimed in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, cause the processor to perform the steps of the data communication method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Interrupt-driven content protection of a memory device
CN112102861A
Interrupt processing method and device
CN114416408A