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

Time system message data packet distribution method Download PDF

Info

Publication number
CN115037798B
CN115037798B CN202210958004.5A CN202210958004A CN115037798B CN 115037798 B CN115037798 B CN 115037798B CN 202210958004 A CN202210958004 A CN 202210958004A CN 115037798 B CN115037798 B CN 115037798B
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.)
Active
Application number
CN202210958004.5A
Other languages
Chinese (zh)
Other versions
CN115037798A (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 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. 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 and positioning, and particularly relates to a time system 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-based 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 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.
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 statement head exists between the first data and the statement end nearest to the first data, judging whether the first data is the 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 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-based message data packet further comprises the following steps:
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.
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 100MHz.
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 the 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 short memory resource (such as a processor with smaller SDRAM (microprogrammed control Unit)) and is suitable for equipment with relatively short memory resource (such as an MCU (micro controller 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 being received during the process of copying the data.
Drawings
FIG. 1 is a diagram illustrating packet distribution in the prior art;
FIG. 2 is a schematic diagram of packet distribution in 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 protection of the present invention.
Referring to fig. 2 to fig. 4, this embodiment provides a method for distributing a time-synchronized packet data packet:
a method for distributing data packet of time system message includes connecting output end of serial character device to processor, using character device as unit to carry out transmission in input/output transmission course and using character device to send data according to single byte.
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 the known head and the known tail refers to a sentence with a known sentence head and a sentence tail, and the uncertain head and tail refers to a sentence with an uncertain sentence head and a 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.
And 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 in 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 100MHz; 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 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 the present invention, and it is to be understood that the invention is not limited to the precise form disclosed herein and is not to be construed as limited to the exclusion of other embodiments, and that various other combinations, modifications, and environments may be used and modifications may be made within the scope of the concepts described herein, either by the above teachings or the skill or knowledge of 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 (7)

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, 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;
the processor stores the serial data to a corresponding temporary buffer area;
setting a plurality of temporary buffer areas according to the type and the length of the statement to be received, comprising the following steps:
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;
the processor determines a temporary buffer area corresponding to the serial data according to the content of the serial data, and the temporary buffer area 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.
2. The method according to claim 1, 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.
3. The method for distributing the timing message packet according to claim 1, wherein the method for distributing the timing message packet 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.
4. The method according to claim 3, 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.
5. The method according to claim 1, wherein the processor is an MCU.
6. The method for distributing the time system message data packet according to claim 5, wherein the serial port baud rate of the MCU is 115200, and the clock frequency of the MCU is greater than or equal to 100MHz.
7. The method for distributing the time system message data packet according to claim 5, wherein the clock frequency of the MCU is 100MHz, and the serial port 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 CN115037798A (en) 2022-09-09
CN115037798B true 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 (6)

* 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
CN112131156A (en) * 2020-09-03 2020-12-25 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, system, electronic equipment and storage medium
CN114513545A (en) * 2022-04-19 2022-05-17 苏州浪潮智能科技有限公司 Request processing method, device, equipment and medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330776A (en) * 2015-06-30 2017-01-11 中兴通讯股份有限公司 Message processing method and device
CN107688589B (en) * 2017-02-20 2019-02-26 平安科技(深圳)有限公司 The method and device of Database System Optimization
CN112019450A (en) * 2019-05-31 2020-12-01 微软技术许可有限责任公司 Inter-device streaming communication
CN113890904B (en) * 2021-09-27 2023-10-27 新华三信息安全技术有限公司 Method, device, computer equipment and storage medium for message analysis

Patent Citations (6)

* 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
CN112131156A (en) * 2020-09-03 2020-12-25 山东云海国创云计算装备产业创新中心有限公司 Data transmission method, system, electronic equipment and storage medium
CN114513545A (en) * 2022-04-19 2022-05-17 苏州浪潮智能科技有限公司 Request processing method, device, equipment and medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
"Android平台下虚拟多串口并发通信的研究与实现";冉德纲;《CNKI优秀硕士学位论文全文库》;20190601;全文 *
"卫星控制仿真平台智能通信设备研制";付鹏飞;《CNKI优秀硕士学位论文全文库》;20060601;全文 *
USB2.0中管道与数据传输类型详解;张红兵等;《现代计算机》;20020430(第04期);全文 *
基于FPGA的GPS时统设计;龚鑫;《科技致富向导》;20131220(第35期);全文 *

Also Published As

Publication number Publication date
CN115037798A (en) 2022-09-09

Similar Documents

Publication Publication Date Title
CN108492827B (en) Wake-up processing method, device and the storage medium of application program
US6526446B1 (en) Hardware only transmission control protocol segmentation for a high performance network interface card
TWI321419B (en) Atomic message division
CN102468989B (en) The method and system of network data
CN109451006A (en) A kind of data transmission method, device, server and computer storage medium
WO2019148884A1 (en) Packet transmission method, storage medium, and computer device
US6931459B2 (en) Duplicator for recording medium and method for duplicating recording medium
US20020164079A1 (en) Systems and methods for rendering image-based data
EP1447947A2 (en) Frame alteration logic for network processors
CN211376201U (en) Command read-write device and memory
US6009471A (en) Server system and methods for conforming to different protocols
CN115037798B (en) Time system message data packet distribution method
US5367674A (en) Data stream optimizer utilizing difference coding between a current state buffer and a next state buffer
JP4703095B2 (en) How to sync multimedia files
WO2019095952A1 (en) Synchronization method and apparatus
JP2003196269A (en) Method for analyzing document represented in markup language
JP5046542B2 (en) Data processing apparatus and method, and information processing apparatus and method
CN101410788A (en) Method and system for printing full images using device
JP2739830B2 (en) Data communication device for multiprocessor system
JP2000155701A (en) Debugging circuit
JPH07244470A (en) Graphic display device
CN112306316B (en) Point reading method, point reading device and storage medium
CN116546116A (en) Data analysis method and device
JPH1168874A (en) Analytic system for transmission information
JP3264336B2 (en) Image conversion processor

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