A method and system for sending and receiving data
A data sending method and data technology, applied in the field of communication, can solve the problems of poor real-time performance, long program time, and consumption of software systems, and achieve the effect of enhancing real-time performance and easy reuse
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0057] figure 1 A flow chart showing the implementation of the data sending method provided by Embodiment 1 of the present invention is described in detail as follows:
[0058] In S101, receiving a data sending request from an application;
[0059] In S102, according to the request, the character data to be sent is stored in the sending buffer;
[0060] In S103, return to continue executing the application program, and call the sending interrupt callback function;
[0061] In the embodiment of the present invention, return to continue to execute the application program, and call the sending interrupt callback function at the same time, without waiting for the completion of data transmission before returning to the main application program.
[0062]In the embodiment of the present invention, the hardware automatically turns on the sending function, turns on the sending and sending interrupt, and when a character data is sent, the microcontroller calls the sending interrupt ca...
Embodiment 2
[0083] Figure 5 A flow chart showing the implementation of the data receiving method provided by Embodiment 2 of the present invention is described in detail as follows:
[0084] In S501, when character data is received, a receiving interrupt is generated and the receiving interrupt callback function is called;
[0085] In this embodiment, the single-chip microcomputer receives the data packet by enabling the receiving interrupt callback function.
[0086] In S502, in the receiving callback function, store the received character data into the receiving buffer;
[0087] In S503, in the timing interrupt, parse the character data in the receiving buffer, and process the parsed character data.
[0088] Optionally, the structure of the receiving buffer can be the same as that of the sending buffer, or a different structure. For example, the receiving buffer includes a character array with a length of N, a data push position pointer pushInPos And a data fetch location pointer po...
Embodiment 3
[0109] Figure 8 It shows the structural diagram of the data transmission system provided by the third embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown. The system can be a software unit, a hardware unit or a software unit built in a single-chip microcomputer. Hard binding unit.
[0110] The system includes:
[0111] a receiving unit 81, configured to receive a data transmission request from an application;
[0112] The storage unit 82 is used to store the character data to be sent into the sending buffer according to the request;
[0113] The calling unit 83 is used to return to continue executing the application program, and call the sending interrupt callback function;
[0114] The sending unit 84 is configured to send the character data in the sending buffer in the sending interrupt callback function.
[0115] Optionally, the sending buffer includes a character array with ...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 