CN111767240A - Automatic construction method of serial communication protocol - Google Patents
Automatic construction method of serial communication protocol Download PDFInfo
- Publication number
- CN111767240A CN111767240A CN202010912876.9A CN202010912876A CN111767240A CN 111767240 A CN111767240 A CN 111767240A CN 202010912876 A CN202010912876 A CN 202010912876A CN 111767240 A CN111767240 A CN 111767240A
- Authority
- CN
- China
- Prior art keywords
- data
- slave
- excel
- host
- protocol
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/151—Transformation
- G06F40/154—Tree transformation for tree-structured or markup documents, e.g. XSLT, XSL-FO or stylesheets
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0002—Serial port, e.g. RS232C
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Communication Control (AREA)
Abstract
The invention provides an automatic construction method of a serial communication protocol, which comprises the following steps: confirming interactive contents of a communication protocol; editing excel according to a specified format; analyzing by an analyzing tool to generate files required by an upper computer, an equipment host and an equipment slave; wherein the specified format comprises mapped variable name, data type, data attribute, address offset ID. The method can greatly reduce the development workload and the development period, improve the stability of the protocol and eliminate the problem caused by the development difference of personnel.
Description
Technical Field
The invention belongs to the field of embedded communication, and particularly relates to an automatic construction method of a serial communication protocol.
Background
At present, serial communication is widely applied in the embedded field, and because the communication is stable and the cost is very low, low-end MCU can be adapted among bottom layer devices in the embedded field, the serial communication is widely applied in various industries. The serial port belongs to a physical medium and is a carrier of communication data, and a specific communication protocol, a specific communication speed and the like are configured and realized by software. In the current serial application scenario, all products are basically related to protocol development. At present, mainstream serial port protocols include modbus, ydt and the like, but the protocols are protocol frames, specific protocol contents still need developers to develop and design, and packaging and unpacking are indispensable. Meanwhile, developers are more headache in terms of the solution of the whole system, and may need to develop a corresponding device communication protocol interface and a corresponding upper computer software protocol. This involves a lot of work and the work repeatability is very high. The communication mode of the prior art device is shown in fig. 1.
Disclosure of Invention
In order to solve the above problems, the present invention provides an automatic construction method of a serial communication protocol, and referring to fig. 2, the method automatically constructs a set of protocols among a device host, a device slave, and an upper computer. The method integrates the protocol development work 3 into 1, and fills in excel according to the specified format, so as to complete the automatic construction of the communication protocol.
The invention provides an automatic construction method of a serial communication protocol, which comprises the following steps: confirming interactive contents of a communication protocol; editing excel according to a specified format; analyzing the excel through an analysis tool to generate files required by an upper computer, an equipment host and an equipment slave; wherein the specified format comprises mapped variable name, data type, data attribute, address offset ID. Wherein the data type is a data type appointed to be used in protocol communication; the mapped variable name is a data variable which is used in a slave machine program and needs to be communicated; the address offset ID is a communication address of the variable in a protocol which is uniquely marked according to a packetization mechanism; the data attribute is a read-write attribute that marks the data variable. Wherein confirming the interactive content of the communication protocol comprises: and in the slave program, data variables, data types and data attributes which are specially required to be interacted are combed. Before the excel is edited according to the specified format, the method also comprises the following steps: according to the communication requirement, the number of the sub-packets and the corresponding address offset ID of each packet are determined.
Wherein editing excel according to a specified format comprises: and filling an excel form according to the specified format and the number of the packages of the excel, wherein the excel form comprises all the packages and the content of each data variable in each package. Wherein analyzing by the analysis tool comprises: and loading excel content to obtain a data linked list, and then constructing corresponding xml files, host files and slave files according to the data linked list and the specified xml rule, the host files and the slave files. Putting the slave file into a slave program; putting the host file into a host program, and performing interface interaction of host file data by an application layer of the host according to requirements; and (4) placing the xml file into a root directory of an upper computer tool, and analyzing by the upper computer according to an xml format, so that communication with the slave computer can be realized.
The method can greatly reduce the development workload and the development period, improve the stability of the protocol and eliminate the problem caused by the development difference of personnel.
Drawings
FIG. 1 illustrates a prior art device communication scheme;
FIG. 2 is a protocol block diagram for automatic construction of a serial communication protocol according to the present invention;
FIG. 3 is a schematic diagram of an automatic protocol construction for a serial communication protocol;
FIG. 4 is a table attribute diagram of a serial communication protocol;
FIG. 5 is a schematic diagram of a tool for parsing a serial communication protocol;
FIG. 6 is a drawing of a protocol packet distribution machine of a serial communication protocol;
FIG. 7 is a diagram of an xml file format for a serial communication protocol;
fig. 8 is an operation flowchart of automatic construction of a serial communication protocol.
Detailed Description
In order that those skilled in the art will better understand the embodiments of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and the embodiments.
Referring to fig. 3, the protocol automatic construction method provided by the invention is mainly characterized in that excel is edited according to a specified format, and files required by an upper computer, an equipment host and an equipment slave are generated by analyzing through an analyzing tool, wherein the files are integrated with the transceiving mechanisms of all protocols and the contents of package and unpacking by default.
In the automatic protocol construction method provided by the invention, the excel table specifies the specific format requirement. FIG. 4 is a protocol build table attribute diagram.
In the protocol format, the data type is a data type designated for use in protocol communication. The mapped variable names are data variables used in the slave programs and needing communication. And the address offset ID uniquely marks the communication address of the variable in the protocol according to a packetization mechanism. And the data attribute marks the read-write attribute of the data variable.
Referring to fig. 5, the analysis tool is a set of tool developed by the PC, and mainly loads excel content according to a specified rule to obtain a data linked list, and then constructs corresponding xml files, host files, and slave files according to the data linked list, the specified xml rule, and templates of the host file and the slave files.
The designated rule means that the analysis tool determines the number of nodes of the linked list through the number of sub-packets according to the writing format of the excel, each node corresponds to the data content of each specific packet in the excel, the variable name, the data type, the data attribute and the address offset ID mapped in each packet are loaded respectively, and finally a complete data linked list is formed.
The sub-packaging mechanism is that a user defines all communication data contents in batches according to requirements. In order to improve communication efficiency and quality, the packetization mechanism specifies that the size of each packet of data cannot be larger than 240 bytes. Fig. 6 is a diagram of a protocol packetizer.
After the analysis of the Excel analysis tool is completed, 3 types of files, an xml file required by an upper computer, a host file x _ master.c and x _ master.h required by a device host, and an x _ slave.c and x _ slave.h required by a device slave are automatically constructed. FIG. 7 is a diagram of an xml file format.
The xml file is consistent with the specified filling format, has the requirements of data type, address offset ID, data attribute and the like, and is packaged through the Module field. The upper computer can completely realize the communication with the equipment slave computer by analyzing the xml file without developing a receiving and sending protocol of the upper computer.
The x _ slave.c and x _ slave.h files required by the equipment slave automatically create a structural body corresponding to each packet and a processing function mechanism for receiving and transmitting the packet according to a sub-packet principle. The equipment slave computer program does not need to operate any interface, and the data in the program operation can be automatically updated according to the protocol communication.
And automatically constructing a structural body corresponding to each packet and an interface of a read-write function corresponding to each packet according to a sub-packet principle by using x _ master.c and x _ master.h files required by the equipment host. The host application program can realize the read-write access to the slave data only by calling the automatically constructed interface without concerning the protocol.
Referring to fig. 8, the automatic construction method of the serial communication protocol provided by the present invention has the following specific implementation processes:
(1) and confirming the interactive content of the communication protocol.
(2) And in the slave program, data variables, data types and data attributes which are specially required to be interacted are combed.
(3) According to the communication requirement, the number of the sub-packets and the corresponding address offset ID of each packet are determined.
(4) And filling a form according to the automatically constructed excel format and the number of the packages, wherein the form comprises all the packages and the content of each data variable in each package, namely the data variable, the data type, the data attribute and the address offset ID.
(5) And automatically constructing by using an analysis tool to generate an xml file, a host file and a slave file.
(6) The slave file is put into the slave program.
(7) And putting the host file into a host program, and performing interface interaction of host file data by an application layer of the host according to requirements.
(8) And (4) placing the xml file into a root directory of an upper computer tool, and analyzing by the upper computer according to an xml format, so that communication with the slave computer can be realized.
The above embodiments are merely exemplary illustrations of the present invention, and are not intended to limit the present invention. Further steps not described in detail belong to technical content well known to the person skilled in the art. Corresponding changes and modifications within the spirit of the invention are also within the scope of the invention.
Claims (7)
1. An automatic construction method of a serial communication protocol comprises the following steps:
confirming interactive contents of a communication protocol;
editing excel according to a specified format;
analyzing the excel through an analysis tool to generate files required by an upper computer, an equipment host and an equipment slave;
wherein the specified format comprises mapped variable name, data type, data attribute, address offset ID.
2. The automatic construction method according to claim 1, wherein the data type is a data type designated for use in protocol communication; the mapped variable name is a data variable which is used in a slave machine program and needs to be communicated; the address offset ID is a communication address of the variable in a protocol which is uniquely marked according to a packetization mechanism; the data attribute is a read-write attribute that marks the data variable.
3. The automated building method of claim 1, wherein confirming interactive contents of the communication protocol comprises: and in the slave program, data variables, data types and data attributes which are specially required to be interacted are combed.
4. The automated building method according to claim 1, wherein before editing the excel according to the specified format further comprises:
according to the communication requirement, the number of the sub-packets and the corresponding address offset ID of each packet are determined.
5. The automated building method according to claim 1, wherein editing excel according to a specified format comprises:
and filling an excel form according to the specified format and the number of the packages of the excel, wherein the excel form comprises all the packages and the content of each data variable in each package.
6. The automated build method of claim 1 wherein parsing by the parsing tool comprises:
loading the excel content according to the writing format, the sub-packet quantity and the data content of the excel to obtain a data linked list, and then constructing corresponding xml files, host files and slave files according to the data linked list and the specified xml rule, the host files and the slave files.
7. The automated build method of claim 6, further comprising:
putting the slave file into a slave program;
putting the host file into a host program, and performing interface interaction of host file data by an application layer of the host according to requirements;
and (4) placing the xml file into a root directory of an upper computer tool, and analyzing by the upper computer according to an xml format, so that communication with the slave computer can be realized.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010912876.9A CN111767240B (en) | 2020-09-03 | 2020-09-03 | Automatic construction method of serial communication protocol |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010912876.9A CN111767240B (en) | 2020-09-03 | 2020-09-03 | Automatic construction method of serial communication protocol |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111767240A true CN111767240A (en) | 2020-10-13 |
CN111767240B CN111767240B (en) | 2020-12-11 |
Family
ID=72729200
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010912876.9A Active CN111767240B (en) | 2020-09-03 | 2020-09-03 | Automatic construction method of serial communication protocol |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111767240B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070074103A1 (en) * | 2005-09-13 | 2007-03-29 | Rudolf Zeller | System and method for converting complex multi-file database structures to HTML |
CN105022846A (en) * | 2015-07-06 | 2015-11-04 | 东北电力大学 | Multichannel synchronous data acquisition system |
CN109189619A (en) * | 2018-08-13 | 2019-01-11 | 光梓信息科技(上海)有限公司 | I2C bus compatible test method, system, storage medium and equipment |
-
2020
- 2020-09-03 CN CN202010912876.9A patent/CN111767240B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070074103A1 (en) * | 2005-09-13 | 2007-03-29 | Rudolf Zeller | System and method for converting complex multi-file database structures to HTML |
CN105022846A (en) * | 2015-07-06 | 2015-11-04 | 东北电力大学 | Multichannel synchronous data acquisition system |
CN109189619A (en) * | 2018-08-13 | 2019-01-11 | 光梓信息科技(上海)有限公司 | I2C bus compatible test method, system, storage medium and equipment |
Non-Patent Citations (1)
Title |
---|
沈显庆等: ""变电站智能辅助控制***协议测试软件的实现"", 《黑龙江科技大学学报》 * |
Also Published As
Publication number | Publication date |
---|---|
CN111767240B (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104932364B (en) | The OPC UA conversion equipments and method of a kind of Modbus communications protocol | |
CN106940642B (en) | Bus simulator system with dynamic ICD configuration | |
US10666718B2 (en) | Dynamic data transport between enterprise and business computing systems | |
CN112799321B (en) | DBC file rapid creating method following CAN bus communication protocol | |
US20030055862A1 (en) | Methods, systems, and articles of manufacture for managing systems using operation objects | |
CN104053164A (en) | Internet-of-things gateway testing system and method | |
CN112311664A (en) | Industrial Internet data interaction method and system and industrial gateway | |
CN103117881A (en) | Resource management system of Internet of Things | |
CN110489812A (en) | Multilayer level netlist processing method, device, computer equipment and storage medium | |
CN115827168B (en) | Optimization method for virtual machine communication in binary simulation environment | |
CN102289774A (en) | Graphical message processing and test system and method in financial transaction processing system | |
CN103399735A (en) | Method for developing intermediate layer of remote function call interface | |
CN116132511A (en) | Proxy-based sensor equipment cross-bus and cross-protocol access DDS network system | |
CN113296979B (en) | Data communication method for unreal engine and external program | |
CN111767240B (en) | Automatic construction method of serial communication protocol | |
CN113505054B (en) | Network data static test system and test method for unmanned aerial vehicle control station | |
CN103365709A (en) | Recipe management method and system and semiconductor device control system | |
CN109062875A (en) | A kind of end C/S three-dimensional modeling data conversion method, device and storage medium | |
CN117632904A (en) | Model-driven data synchronization method and system | |
CN112306622B (en) | Construction method and device of VNF template | |
CN103546527B (en) | A kind of extendible industrial configuration or simulation software communication method | |
CN114968196A (en) | Development platform architecture based on CODESYS software | |
US20200311040A1 (en) | Dynamically rendering an application programming interface for internet of things applications | |
CN112732551A (en) | Automatic test method and system for radio frequency indexes | |
Ramesh et al. | Case Study on Server–Client Protocols of Industrial Controllers |
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 |