CN115037798A - Time system message data packet distribution method - Google Patents

Time system message data packet distribution method Download PDF

Info

Publication number
CN115037798A
CN115037798A CN202210958004.5A CN202210958004A CN115037798A CN 115037798 A CN115037798 A CN 115037798A CN 202210958004 A CN202210958004 A CN 202210958004A CN 115037798 A CN115037798 A CN 115037798A
Authority
CN
China
Prior art keywords
data
buffer area
temporary buffer
sentence
serial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210958004.5A
Other languages
Chinese (zh)
Other versions
CN115037798B (en
Inventor
王洪康
曾迎春
朱敏
温学斌
邓意峰
简和兵
李文龙
杨彩芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Jinnuoxin High Tech Co ltd
Original Assignee
Chengdu Jinnuoxin High Tech Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Jinnuoxin High Tech Co ltd filed Critical Chengdu Jinnuoxin High Tech Co ltd
Priority to CN202210958004.5A priority Critical patent/CN115037798B/en
Publication of CN115037798A publication Critical patent/CN115037798A/en
Application granted granted Critical
Publication of CN115037798B publication Critical patent/CN115037798B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Abstract

The invention discloses a time system message data packet distribution method which is applied to a data packet distribution device, wherein the data packet distribution device comprises a processor and serial character equipment, and the output end of the serial character equipment is connected with the processor. The time system message data packet distribution method comprises the following steps: setting a plurality of temporary buffer areas according to the type and the length of the statement to be received; setting a data receiving mode of the serial character device to an interrupt mode; after the serial character equipment receives the serial data, the processor stores the serial data in a cache register; the processor reads the serial data in the cache register after detecting the interrupt signal; the processor determines a temporary buffer area corresponding to the serial data according to the content of the serial data; and the processor stores the serial data to a corresponding temporary buffer zone. The method of the invention saves the memory resource of the system.

Description

Time system message data packet distribution method
Technical Field
The invention belongs to the technical field of navigation positioning, and particularly relates to a time-alignment message data packet distribution method.
Background
In the field of positioning, the message sent by the receiver is a standard 0183 format protocol. Usually, a plurality of messages are sent out continuously, and the messages need to be analyzed or forwarded one by one. The current processing method for the scene is to open up a buffer area to receive all the data, then read out the data from the buffer area, and analyze the data one by one. As shown in fig. 1, this method has the following disadvantages: firstly, double buffer spaces (such as a receiving buffer area and a processing buffer area in fig. 1) need to be opened up, and the pressure on a small processor such as an SDRAM (micro control unit) is large; secondly, for one buffer, while data is received and filled in, it is necessary to read out data at a proper time for analysis processing, if the transmission period of the message is not strict, when data is copied out of the buffer, a situation of truncating one frame of data is easy to occur, and if truncation is avoided, the problem of content continuity of two buffers needs to be considered.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a time system message data packet distribution method.
The purpose of the invention is realized by the following technical scheme: a time system message data packet distribution method is applied to a data packet distribution device, the data packet distribution device comprises a processor and serial character equipment, and the output end of the serial character equipment is connected with the processor. The method for distributing the time system message data packet comprises the following steps:
setting a plurality of temporary buffer areas according to the type and the length of the statement to be received;
setting a data receiving mode of the serial character device to an interrupt mode;
after the serial character equipment receives the serial data, the processor stores the serial data in a cache register;
the processor reads the serial data in the cache register after detecting the interrupt signal;
the processor determines a temporary buffer area corresponding to the serial data according to the content of the serial data;
and the processor stores the serial data to a corresponding temporary buffer zone.
Further, setting a plurality of temporary buffers according to the type and length of the statement to be received, including:
respectively setting a corresponding temporary buffer area for each type of first statement;
setting the size of a corresponding temporary buffer area according to the length of the first statement;
setting the size of a special buffer area according to a preset value;
the first sentence is a sentence with a known sentence head and a known sentence tail in the sentence to be received, and the second sentence is the rest sentences except the first sentence in the sentence to be received.
Further, the processor determines a temporary buffer corresponding to the serial data according to the content of the serial data, and includes:
judging whether serial data is received before first data, wherein the first data is currently received serial data;
if the serial data is not received before the first data, judging whether the first data is a statement head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and setting the temporary buffer area as a current buffer area; if the first data is not a sentence header, the temporary buffer area corresponding to the first data is a special buffer area;
if the serial data is received before the first data, judging whether a statement tail exists before the first data;
if the sentence tail does not exist before the first data, judging whether the first data is a sentence head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and taking the temporary buffer area as a current buffer area; if the first data is not the sentence header, the temporary buffer area corresponding to the first data is a special buffer area;
if a sentence end exists before the first data, judging whether a sentence head exists between the first data and the sentence end closest to the first data;
if a sentence head exists between the first data and a sentence tail closest to the first data, the temporary buffer area corresponding to the first data is a current buffer area;
if no sentence head exists between the first data and the sentence end nearest to the first data, judging whether the first data is the sentence head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and taking the temporary buffer area as a current buffer area; and if the first data is not the sentence header, the temporary buffer area corresponding to the first data is a special buffer area.
Further, determining a corresponding temporary buffer according to the statement type of the first data includes:
determining a statement type corresponding to the first data;
and acquiring a temporary buffer area corresponding to the statement type corresponding to the first data, and taking the temporary buffer area as the temporary buffer area corresponding to the first data.
Further, the method for distributing the time-system packet further includes:
the processor circularly inquires whether the serial data of each temporary buffer area has a statement tail;
and if the serial data in the temporary buffer area has a sentence tail, processing the serial data in the temporary buffer area.
Preferably, the processing of the serial data in the temporary buffer includes:
forwarding the serial data in the temporary buffer area; alternatively, the first and second electrodes may be,
and analyzing the serial data in the temporary buffer area.
Further, the processor is an MCU.
Further, the serial port baud rate of the MCU is 115200, and the clock frequency of the MCU is greater than or equal to 100 MHz.
Further, the clock frequency of the MCU is 100MHz, and the serial port baud rate of the MCU is less than or equal to 115200.
The invention has the beneficial effects that:
(1) the sum of the sizes of the temporary buffer areas is equal to the size of a receiving buffer area in the traditional method, so that the space occupied by processing the buffer area in the traditional method is reduced, the memory resource is saved, and the method is suitable for equipment with relatively less memory resource (such as a processor with a small SDRAM (synchronous dynamic random access memory) like an MCU (micro control unit);
(2) compared with the traditional method, the method is simpler, more convenient and more reliable; specifically, the method of the present invention only needs to determine the storage location when receiving the serial data, and after the received serial data is placed in the temporary buffer area, only needs to read the serial data for processing, and does not need to consider when to copy the data from the receiving buffer area to the processing buffer area, and does not need to consider how to do the data is still received during the process of copying the data.
Drawings
FIG. 1 is a schematic diagram of packet distribution in the prior art;
FIG. 2 is a schematic diagram of the packet distribution of the present invention;
FIG. 3 is a flow chart of packet distribution in the present invention;
FIG. 4 is a flow chart of determining a temporary buffer corresponding to serial data according to the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
Referring to fig. 2 to fig. 4, the embodiment provides a method for distributing a timing message packet:
a method for distributing time system message data packet is applied to a data packet distributing device, the data packet distributing device comprises a processor and a serial character device (the character device is a device which takes characters as units to transmit in the input and output transmission process, for example, the character device sends data according to a single byte), and the output end of the serial character device is connected with the processor.
As shown in fig. 2 and fig. 3, the method for distributing the time-keeping packet includes:
s100, setting a plurality of temporary buffer areas according to the type and the length of the statement to be received.
The statement to be received comprises a statement with a known head and a known tail, or the statement to be received comprises a statement with a known head and a known tail and a statement with an uncertain head and tail. The sentence with known head and tail refers to a sentence with a known sentence head and a sentence tail, and the sentence with uncertain head and tail refers to a sentence with uncertain sentence head and sentence tail.
In one embodiment, setting a plurality of temporary buffers according to the type and length of the statement to be received includes: respectively setting a corresponding temporary buffer area for each type of first statement, wherein the first statement is a statement with a known statement head and a known statement tail in the statement to be received; setting a temporary buffer area for storing a second statement, and recording the temporary buffer area as a special buffer area, wherein the second statement is the rest of the statements to be received except the first statement; setting the size of a corresponding temporary buffer area according to the length of the first statement; and setting the size of the special buffer area according to a preset value. The size of each temporary buffer area except the special buffer area ensures that a corresponding statement can be stored; in one embodiment, the size of the special buffer may also be determined according to the known length of the second statement, and when the special buffer is full and the second statement is received, the previous data is overwritten.
For example, a serial port (e.g., an interface such as UART, IIC, SPI) of the MCU is connected to the receiver (the receiver supports output 0183 statements), for example, the receiver outputs four types of statements (e.g., four statements such as GGA, ZDA, RMC, HEADING), five temporary buffers are set, wherein four temporary buffers correspond to four statements one to one, and the remaining temporary buffer is used as a special buffer.
S200, setting a data receiving mode of the serial character equipment to be an interrupt mode.
S300, after the serial character device receives the serial data, the processor stores the serial data in the cache register.
For example, after the serial port of the MCU receives a data, the data is stored in the buffer register of the serial port.
S400, the processor reads the serial data in the buffer register after detecting the interrupt signal.
And S500, the processor determines a temporary buffer area corresponding to the serial data according to the content of the serial data.
As shown in fig. 4, in one embodiment, the determining, by the processor, the temporary buffer corresponding to the serial data according to the content of the serial data includes:
s510, determining whether serial data is received before first data, where the first data is currently received serial data, if serial data is not received before the first data, performing S520, and if serial data is received before the first data, performing S550.
And S520, judging whether the first data is a statement header or not, if so, executing S530, and if not, executing S540.
And S530, determining a corresponding temporary buffer area according to the statement type of the first data, and setting the temporary buffer area as a current buffer area.
Specifically, determining a corresponding temporary buffer according to the statement type of the first data includes: determining a statement type corresponding to the first data; and acquiring a temporary buffer area corresponding to the statement type corresponding to the first data, and taking the temporary buffer area as the temporary buffer area corresponding to the first data.
And S540, the temporary buffer area corresponding to the first data is a special buffer area.
And S550, judging whether a statement tail exists before the first data, if the statement tail does not exist before the first data, executing S560, and if the statement tail exists before the first data, executing S570.
S560, judging whether the first data is a statement header, if so, executing S530, and if not, executing S540;
s570, judging whether a sentence head exists between the first data and the sentence end nearest to the first data, if so, taking the temporary buffer area corresponding to the first data as the current buffer area, and if not, executing S580;
s580, determine whether the first data is a sentence header, if the first data is a sentence header, execute S530, and if the first data is not a sentence header, execute S540.
And S600, the MCU stores the serial data to a corresponding temporary buffer area.
Namely, the MCU stores the serial data into a temporary buffer zone corresponding to the serial data.
In one embodiment, the method for distributing the time-system packet further includes: the processor circularly inquires whether the serial data of each temporary buffer area has a statement tail; and if the serial data in the temporary buffer area has a statement tail, processing the serial data in the temporary buffer area.
For example, the MCU circularly queries whether the serial data of each temporary buffer area has a statement tail; if the serial data of the temporary buffer area has a statement tail, forwarding the serial data in the temporary buffer area; or if the serial data in the temporary buffer area has a sentence tail, analyzing the serial data in the temporary buffer area.
In one embodiment, the processor is an MCU, the serial port baud rate of the MCU is 115200, and the clock frequency of the MCU is greater than or equal to 100 MHz; or the clock frequency of the MCU is 100MHz, and the serial port baud rate of the MCU is less than or equal to 115200. The time for the MCU to perform S400-S600 (i.e., the time for the MCU to complete responding to interrupts, reading data, finding a location, and storing data) is less than the time difference between the two bytes sent by the character device (the end of the first byte to the beginning of the second byte).
The foregoing is illustrative of the preferred embodiments of this invention, and it is to be understood that the invention is not limited to the precise form disclosed herein and that various other combinations, modifications, and environments may be resorted to, falling within the scope of the concept as disclosed herein, either as described above or as apparent to those skilled in the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (9)

1. A time system message data packet distribution method is applied to a data packet distribution device, the data packet distribution device comprises a processor and a serial character device, and the output end of the serial character device is connected with the processor, and the time system message data packet distribution method is characterized by comprising the following steps:
setting a plurality of temporary buffer areas according to the type and the length of the statement to be received;
setting a data receiving mode of the serial character device to an interrupt mode;
after the serial character equipment receives the serial data, the processor stores the serial data in a buffer register;
the processor reads the serial data in the cache register after detecting the interrupt signal;
the processor determines a temporary buffer area corresponding to the serial data according to the content of the serial data;
and the processor stores the serial data to a corresponding temporary buffer zone.
2. The method for distributing the timing message data packet according to claim 1, wherein the step of setting a plurality of temporary buffers according to the type and length of the statement to be received comprises:
respectively setting a corresponding temporary buffer area for each type of first statement;
setting a temporary buffer area for storing the second statement, and marking the temporary buffer area as a special buffer area;
setting the size of a corresponding temporary buffer area according to the length of the first statement;
setting the size of a special buffer area according to a preset value;
the first sentence is a sentence with a known sentence head and a known sentence tail in the sentence to be received, and the second sentence is the rest sentences except the first sentence in the sentence to be received.
3. The method according to claim 2, wherein the processor determines the temporary buffer corresponding to the serial data according to the content of the serial data, and comprises:
judging whether serial data is received before first data, wherein the first data is currently received serial data;
if the serial data is not received before the first data, judging whether the first data is a statement head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and setting the temporary buffer area as a current buffer area; if the first data is not a sentence header, the temporary buffer area corresponding to the first data is a special buffer area;
if the serial data is received before the first data, judging whether a statement tail exists before the first data;
if the sentence tail does not exist before the first data, judging whether the first data is a sentence head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and taking the temporary buffer area as a current buffer area; if the first data is not the sentence header, the temporary buffer area corresponding to the first data is a special buffer area;
if a sentence end exists before the first data, judging whether a sentence head exists between the first data and the sentence end closest to the first data;
if a sentence head exists between the first data and a sentence tail closest to the first data, the temporary buffer area corresponding to the first data is a current buffer area;
if no sentence head exists between the first data and the sentence end nearest to the first data, judging whether the first data is the sentence head: if the first data is a statement head, determining a corresponding temporary buffer area according to the statement type of the first data, and taking the temporary buffer area as a current buffer area; and if the first data is not the sentence header, the temporary buffer area corresponding to the first data is a special buffer area.
4. The method according to claim 3, wherein determining the corresponding temporary buffer according to the statement type of the first data includes:
determining a statement type corresponding to the first data;
and acquiring a temporary buffer area corresponding to the statement type corresponding to the first data, and taking the temporary buffer area as the temporary buffer area corresponding to the first data.
5. The method according to claim 1, wherein the method further comprises:
the processor circularly inquires whether the serial data of each temporary buffer area has a statement tail;
and if the serial data in the temporary buffer area has a sentence tail, processing the serial data in the temporary buffer area.
6. The method according to claim 5, wherein the processing the serial data in the temporary buffer comprises:
forwarding the serial data in the temporary buffer area; alternatively, the first and second electrodes may be,
and analyzing the serial data in the temporary buffer area.
7. The method according to claim 1, wherein the processor is an MCU.
8. The method according to claim 7, wherein the serial baud rate of the MCU is 115200, and the clock frequency of the MCU is greater than or equal to 100 MHz.
9. The method for distributing the time system message data packet according to claim 7, wherein a clock frequency of the MCU is 100MHz, and a serial baud rate of the MCU is less than or equal to 115200.
CN202210958004.5A 2022-08-11 2022-08-11 Time system message data packet distribution method Active CN115037798B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210958004.5A CN115037798B (en) 2022-08-11 2022-08-11 Time system message data packet distribution method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210958004.5A CN115037798B (en) 2022-08-11 2022-08-11 Time system message data packet distribution method

Publications (2)

Publication Number Publication Date
CN115037798A true CN115037798A (en) 2022-09-09
CN115037798B CN115037798B (en) 2022-12-27

Family

ID=83130508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210958004.5A Active CN115037798B (en) 2022-08-11 2022-08-11 Time system message data packet distribution method

Country Status (1)

Country Link
CN (1) CN115037798B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3599160A (en) * 1969-03-06 1971-08-10 Interdata Inc Time division multiplexing
CN1542587A (en) * 2003-11-05 2004-11-03 中兴通讯股份有限公司 Booting method for Pentium II processor system
CN103577378A (en) * 2013-11-15 2014-02-12 哈尔滨工业大学深圳研究生院 Full-duplex asynchronous serial communication method
CN105207816A (en) * 2015-09-16 2015-12-30 国网智能电网研究院 Software scheduling method for multi-buffer parallel encryption
WO2017000593A1 (en) * 2015-06-30 2017-01-05 中兴通讯股份有限公司 Packet processing method and device
US20190065548A1 (en) * 2017-02-20 2019-02-28 Ping An Technology (Shenzhen) Co., Ltd. Method and system of optimizing database system, electronic device and storage medium
CN112131156A (en) * 2020-09-03 2020-12-25 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, system, electronic equipment and storage medium
CN113890904A (en) * 2021-09-27 2022-01-04 新华三信息安全技术有限公司 Message parsing method and device, computer equipment and storage medium
CN114513545A (en) * 2022-04-19 2022-05-17 苏州浪潮智能科技有限公司 Request processing method, device, equipment and medium
US20220217098A1 (en) * 2019-05-31 2022-07-07 Microsoft Technology Licensing, Llc Streaming communication between devices

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3599160A (en) * 1969-03-06 1971-08-10 Interdata Inc Time division multiplexing
CN1542587A (en) * 2003-11-05 2004-11-03 中兴通讯股份有限公司 Booting method for Pentium II processor system
CN103577378A (en) * 2013-11-15 2014-02-12 哈尔滨工业大学深圳研究生院 Full-duplex asynchronous serial communication method
WO2017000593A1 (en) * 2015-06-30 2017-01-05 中兴通讯股份有限公司 Packet processing method and device
CN105207816A (en) * 2015-09-16 2015-12-30 国网智能电网研究院 Software scheduling method for multi-buffer parallel encryption
US20190065548A1 (en) * 2017-02-20 2019-02-28 Ping An Technology (Shenzhen) Co., Ltd. Method and system of optimizing database system, electronic device and storage medium
US20220217098A1 (en) * 2019-05-31 2022-07-07 Microsoft Technology Licensing, Llc Streaming communication between devices
CN112131156A (en) * 2020-09-03 2020-12-25 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, system, electronic equipment and storage medium
CN113890904A (en) * 2021-09-27 2022-01-04 新华三信息安全技术有限公司 Message parsing method and device, computer equipment and storage medium
CN114513545A (en) * 2022-04-19 2022-05-17 苏州浪潮智能科技有限公司 Request processing method, device, equipment and medium

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
付鹏飞: ""卫星控制仿真平台智能通信设备研制"", 《CNKI优秀硕士学位论文全文库》 *
冉德纲: ""Android平台下虚拟多串口并发通信的研究与实现"", 《CNKI优秀硕士学位论文全文库》 *
刘晓等: "一种基于单片机串口通信的数据缓存处理方法", 《信息通信》 *
张红兵等: "USB2.0中管道与数据传输类型详解", 《现代计算机》 *
龚鑫: "基于FPGA的GPS时统设计", 《科技致富向导》 *

Also Published As

Publication number Publication date
CN115037798B (en) 2022-12-27

Similar Documents

Publication Publication Date Title
TWI321419B (en) Atomic message division
RU2005120695A (en) LIGHTED INPUT / OUTPUT PROTOCOL
US6754391B2 (en) Systems and methods for rendering image-based data
CN101547153A (en) Data receiving apparatus, data receiving method, and program storage medium
US6931459B2 (en) Duplicator for recording medium and method for duplicating recording medium
JPH0653994A (en) Data transmission system and communication controller
CN115037798B (en) Time system message data packet distribution method
CN113852533B (en) Multi-channel data communication system and method and electronic equipment
US6381620B1 (en) Rich text medium displaying method and picture information providing system using calculated average reformatting time for multimedia objects
TW201006169A (en) Unsupervised traffic estimation for low-power media streaming
JP4703095B2 (en) How to sync multimedia files
JP2003196269A (en) Method for analyzing document represented in markup language
CN115190347B (en) Message processing method, message processing device, electronic equipment and storage medium
CN111399769B (en) Storage method and device for uploading files in MIME format
WO2022188598A1 (en) Broadcast information transmission method and apparatus, electronic device, and storage medium
JP2000155701A (en) Debugging circuit
JP2000132212A (en) Network unit for programmable controller
JP2006337859A (en) Display control device and method, and program
JP3264336B2 (en) Image conversion processor
CN114003089A (en) Method, system and device for synchronizing BMC (baseboard management controller) and operating system time
CN116015613A (en) Message processing method, device, electronic equipment and computer readable storage medium
CN117370233A (en) HDMI controller UPI storage circuit and UPI data storage method
KR100350245B1 (en) Method for discriminating data of switching system
JPH07271656A (en) Image data processing system
CN115794014A (en) Data restoration detection method and device for image input interface and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant