CN115002231A - Communication protocol based on HEX format, communication device and medium - Google Patents

Communication protocol based on HEX format, communication device and medium Download PDF

Info

Publication number
CN115002231A
CN115002231A CN202210587035.4A CN202210587035A CN115002231A CN 115002231 A CN115002231 A CN 115002231A CN 202210587035 A CN202210587035 A CN 202210587035A CN 115002231 A CN115002231 A CN 115002231A
Authority
CN
China
Prior art keywords
data
sent
data packet
protocol
identity information
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.)
Pending
Application number
CN202210587035.4A
Other languages
Chinese (zh)
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.)
Stelight Instrument Inc
Original Assignee
Stelight Instrument Inc
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 Stelight Instrument Inc filed Critical Stelight Instrument Inc
Priority to CN202210587035.4A priority Critical patent/CN115002231A/en
Publication of CN115002231A publication Critical patent/CN115002231A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a communication protocol, a communication device and a medium based on an HEX format, relates to the field of communication, and aims to provide a communication protocol with high confidentiality and high communication efficiency, a data protocol framework is constructed based on the HEX format; writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; wherein, the identity information of the data to be sent may be discontinuous; and sending the data packet to the slave. The HEX format has an encryption attribute, effective data can be obtained only by analyzing the data packet according to a set rule by both communication parties, and the identity information of data to be sent in the sent data packet can be discontinuous, namely the data packet contains data information of any address.

Description

Communication protocol based on HEX format, communication device and medium
Technical Field
The present application relates to the field of communications, and in particular, to a communication protocol based on a HEX format, a communication device, and a medium.
Background
The existing RS232/RS422/RS 485-based serial bus technology is generally based on MODBUS protocol for communication, because the Modbus protocol needs to operate the slave machine according to register address and coil address and only supports continuous transmission of continuous addresses, in complex application, if a plurality of instructions need to be transmitted, the communication speed is reduced. In addition, a communication mode based on a Programmable instrument Standard Command (SCPI) protocol is also a common mode, but the serial bus is unreliable, and the SCPI has no corresponding verification mechanism; the SCPI adopts an ASCII data format and has certain requirements on the hardware of the MCU; ASCII is a readable character and thus security of communication contents is not high.
Therefore, it is an urgent technical problem to provide a communication protocol with high security and high communication efficiency.
Disclosure of Invention
The purpose of the application is to provide a communication protocol with high confidentiality and high communication efficiency.
In order to solve the above technical problem, the present application provides a communication protocol based on the HEX format, which is applied to a host for master-slave communication, and includes:
constructing a data protocol framework based on the HEX format;
writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple;
writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate a data packet; wherein the identity information of the data to be transmitted may not be continuous;
and sending the data packet to the slave.
Preferably, in the HEX format-based communication protocol, the writing the identity information, the parameter type, and the parameter of the plurality of data to be sent into the data protocol framework to generate a data packet includes:
and writing the identity information, the parameter types and the parameters of the data to be sent and the check of a preset frame into the data protocol frame to generate the data packet.
Preferably, the HEX format-based communication protocol, the data protocol framework includes: frame header, frame length, frame number, slave equipment address and programmable data stream; wherein the function code, the number, the identity information, the parameter type, and the parameter are written into the programmable data stream.
In order to solve the above technical problem, the present application further provides a communication protocol based on the HEX format, which is applied to a slave device for master-slave communication, and includes:
receiving a data packet sent by a host; wherein the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate the data packet; wherein the identity information of the data to be sent may be discontinuous;
and analyzing the data packet.
Preferably, the above mentioned communication protocol based on HEX format, after receiving the data packet sent by the host, includes:
judging whether the information of the data packet is complete or not;
if the data packet is complete, the analyzing the data packet includes: verifying whether the information contained in the trial data packet conforms to a decoding rule; and analyzing the identity information, the parameter type and the parameter of the data to be sent in sequence according to the function code.
Preferably, after parsing the data packet, the HEX format-based communication protocol further includes:
sending a reply frame back to the host.
In order to solve the above technical problem, the present application further provides a communication device based on a HEX format communication protocol, which is applied to a host, and includes:
the constructing module is used for constructing a data protocol framework based on the HEX format;
the writing module is used for writing the function codes and the quantity corresponding to the data to be sent into the data protocol framework, wherein the quantity of the data to be sent is multiple;
the generating module is used for writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate a data packet; wherein the identity information of the data to be transmitted may not be continuous;
and the sending module is used for sending the data packet to a slave.
In order to solve the above technical problem, the present application further provides a communication device based on a HEX format communication protocol, which is applied to a slave, and includes:
the receiving module is used for receiving a data packet sent by the host; wherein the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate the data packet; wherein the identity information of the data to be transmitted may not be continuous;
and the analysis module is used for analyzing the data packet.
In order to solve the above technical problem, the present application further provides a communication device based on a HEX format communication protocol, including:
a memory for storing a computer program;
a processor for implementing the steps of the HEX format-based communication protocol when executing the computer program.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the HEX format-based communication protocol method.
The HEX format-based communication protocol provided by the present application, applied to a host, includes: constructing a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; wherein, the identity information of the data to be sent may be discontinuous; and sending the data packet to the slave. The HEX format has an encryption attribute, so that both communication parties can decrypt communication contents, and the identity information of data to be sent in a sent data packet can be discontinuous, namely the data packet contains data information of any address, and the data packet does not need to send data information of continuous addresses, so that the communication efficiency is improved.
In addition, the application also provides a device and a medium, which correspond to the communication protocol based on the HEX format and have the same effects.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a schematic flowchart of a HEX format-based communication protocol applied to a host according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a HEX format-based communication protocol applied to a slave according to an embodiment of the present application;
fig. 3 is a schematic diagram of a communication device based on a HEX format communication protocol applied to a host according to an embodiment of the present application;
fig. 4 is a schematic diagram of a communication device based on a HEX format communication protocol and applied to a slave according to an embodiment of the present application;
fig. 5 is a block diagram of another communication device based on the HEX format communication protocol according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The core of the application is to provide a communication protocol based on the HEX format.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings.
A communication protocol refers to the rules and conventions that must be followed by two entities to complete a communication or service. Data communication systems in a plurality of different geographical locations interconnected by communication channels and devices must have a common language between them to enable their co-operation for information exchange and resource sharing. What, how and when to communicate must follow certain mutually acceptable rules. This rule is the communication protocol. In computer communication, a communication protocol is used for realizing the standard between a computer and a network connection, and if the network does not have a uniform communication protocol, information transmission between the computers cannot be identified. The communication protocol refers to a communication rule stipulated in advance by the communication parties, and can be simply understood as a common language used for mutual conversation among computers. The two computers must use a communication protocol when communicating. The SCPI protocol is a communication protocol based on ASCII data format, through which instruments can be remotely interacted, such as configuring instrument parameters, obtaining instrument data, etc. All commands in the SCPI exist in the form of ASCII code character strings, after a user sends character strings to an instrument, data returned by the instrument is also the character strings, and then the user needs to analyze the meanings of the returned character strings by himself. The security of the communication content is not high due to the ASCII as a readable character; moreover, the SCPI itself has no check mechanism, and is applied to a bus with unreliable transmission, which may have a risk of frame error. Modbus is a serial communication protocol, needs to operate the slave according to a register address and a coil address, and only supports continuous transmission of continuous addresses, which causes reduction of communication speed if multiple instructions need to be transmitted. Therefore, the present application provides a communication protocol based on the HEX format with high security and high communication efficiency, the communication protocol provided by the present application is implemented based on the RS232/RS422/RS485 serial bus technology, fig. 1 is a schematic flow diagram of the communication protocol based on the HEX format provided by the embodiment of the present application, and the communication protocol is applied to a host, and includes:
step S11: constructing a data protocol framework based on the HEX format;
step S12: writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple;
step S13: writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; the identity information of the data to be sent may be discontinuous;
step S14: and sending the data packet to the slave.
In this embodiment, the data protocol framework is constructed based on the HEX format, that is, the data protocol framework is constructed according to a preset requirement, so as to fill the data information to be sent, which includes fixed data information, for example, a fixed frame header when the host sends the data information. HEX is known collectively as Intel HEX and such files are commonly used to transfer programs and data to be stored in ROM or EPROM. A Hex file is an ASCII text file made up of a line of text conforming to the Intel Hex file format. In the Intel HEX file, each row contains one HEX record. These records consist of hexadecimal-coded numbers corresponding to machine language code and/or constant data.
The function codes mentioned in this embodiment refer to different preset data codes corresponding to different instructions, and the corresponding function codes are written into a data protocol framework according to the instruction type corresponding to the data to be sent.
The identity information of the data to be sent mentioned in this embodiment may be ID information, a source address, and the like of the data to be sent, and the parameter type and the parameter may be an instruction object, a specific instruction, and the like. After the data packet is generated, the data packet based on the HEX format is sent to the slave
The communication protocol based on the HEX format is applied to a host, after a data protocol framework is constructed based on the HEX format, functional codes and quantity corresponding to data to be sent are written into the data protocol framework, wherein the quantity of the data to be sent is multiple, identity information, parameter types and parameters of the multiple data to be sent are written into the data protocol framework, and a data packet is generated, wherein the identity information of the data to be sent can be discontinuous, and the data packet is sent to a slave. The HEX format has an encryption attribute, effective data can be obtained only by analyzing the data packet according to a set rule by both communication parties, and the identity information of data to be sent in the sent data packet can be discontinuous, namely the data packet contains data information of any address.
According to the above embodiment, step S13 writes the identity information, the parameter type, and the parameter of the multiple data to be sent into the data protocol framework, and generates a data packet, including:
and verifying and writing the identity information, the parameter types and the parameters of the data to be sent and the preset frame into a data protocol frame to generate a data packet.
The default frame check mentioned in this embodiment is one of the most commonly used error checking methods in the field of data communication. A frame of data is treated as a long binary number (for example, a piece of 128-byte information is treated as a 1024-bit binary number), then the data is processed by a specified method, a specific number is obtained as a processing result, finally the specific number is attached to an information code as a check code and then transmitted (or stored) together as a frame, the same processing is carried out when receiving (or reading) is carried out, and whether the specific number and the check code obtained by the check processing are the same or not can be found whether an error occurs in the transmission (or storage) process.
The embodiment provides a preferred solution, and the data protocol framework includes: frame header, frame length, frame number, slave equipment address and programmable data stream; wherein, the function code, number, identity information, parameter type and parameter are written into the programmable data stream.
The data protocol framework provided by the embodiment comprises: frame head, frame length, frame number and slave equipment address, wherein the four data information are unified data information of data to be sent, functional codes, quantity, identity information, parameter types and parameters are written into a programmable data stream, and the functional codes, the quantity, the identity information, the parameter types and the parameters of the data to be sent are written into the programmable data stream according to the specific data information of the data to be sent.
Fig. 2 is a schematic flowchart of a communication protocol based on the HEX format according to an embodiment of the present application, which is applied to a slave, and as shown in fig. 2, a communication protocol based on the HEX format includes:
s21: receiving a data packet sent by a host; the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; the identity information of the data to be sent may be discontinuous;
s22: and analyzing the data packet.
The slave computer receives a data packet sent by the host computer and constructs a data protocol framework for the host computer based on the HEX format; writing the function codes and the quantity corresponding to the data to be sent into a data protocol framework, wherein the quantity of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; wherein, the identity information of the data to be transmitted may not be continuous.
And the slave machine analyzes the data contained in the data packet after receiving the data packet so as to obtain the instruction information sent by the host machine. Because the HEX format has an encryption attribute, both communication parties can decrypt the communication content, and the identity information of the data to be sent in the sent data packet can be discontinuous, that is, the data packet contains data information of any address, and it is not necessary to send data information of continuous addresses. The communication protocol based on the HEX format has good confidentiality and high communication efficiency.
According to the above embodiment, after receiving the data packet sent by the host in step S21, the method includes:
judging whether the information of the data packet is complete or not;
if complete, the data packet is analyzed, including: and analyzing the identity information, the parameter type and the parameter of the data to be sent in sequence according to the function code.
And judging whether the data packet sent by the host is complete or not, if not, sending error information to the host, and if so, analyzing the data packet, and sequentially analyzing the identity information, the parameter type and the parameters of the data to be sent according to the function code. The function code refers to different preset data codes corresponding to different instructions, and the corresponding function code is written into the data protocol framework according to the instruction type corresponding to the data to be sent.
According to the above embodiment, after parsing the data packet in step S11, the method further includes:
sending the reply frame back to the host.
The slave unit parses the data packet and sends a reply frame back to the host unit, and the embodiment does not limit the specific data information contained in the reply frame, and the slave unit is designed according to actual needs. For example, the operation result corresponding to the data to be sent in the data packet, the information of successfully receiving the data packet, and the like.
In the above embodiments, the detailed description is made on the communication protocol based on the HEX format, and the present application also provides embodiments corresponding to the communication device based on the communication protocol based on the HEX format. It should be noted that the present application describes the embodiments of the apparatus portion from two perspectives, one from the perspective of the function module and the other from the perspective of the hardware.
Fig. 3 is a schematic diagram of a communication device based on a HEX format communication protocol according to an embodiment of the present application, which is applied to a host, and as shown in fig. 3, the communication device includes:
a construction module 31 for constructing a data protocol framework based on the HEX format;
a writing module 32, configured to write the function codes and the number corresponding to the data to be sent into a data protocol framework, where the number of the data to be sent is multiple;
a generating module 33, configured to write the identity information, the parameter types, and the parameters of the multiple pieces of data to be sent into a data protocol framework, and generate a data packet; wherein, the identity information of the data to be sent may be discontinuous;
and a sending module 34, configured to send the data packet to the slave.
Specifically, the constructing module 31 constructs a data protocol framework based on the HEX format; the writing module 32 writes the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple; the generating module 33 writes the identity information, the parameter types and the parameters of the plurality of data to be sent into the data protocol framework to generate a data packet; wherein, the identity information of the data to be sent may be discontinuous; the sending module 34 sends the data packet to the slave.
In the communication device based on the communication protocol in the HEX format according to this embodiment, because the HEX format has an encryption attribute, both communication parties can analyze the data packet according to a predetermined rule to obtain valid data, and the identity information of the data to be sent in the sent data packet may be discontinuous, that is, the data packet includes data information of any address.
Fig. 4 is a schematic diagram of a communication device based on a HEX format communication protocol according to an embodiment of the present application, which is applied to a slave, as shown in fig. 4, and includes:
a receiving module 41, configured to receive a data packet sent by a host; the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; wherein, the identity information of the data to be sent may be discontinuous;
and the parsing module 41 is configured to parse the data packet.
Specifically, the receiving module 41 receives a data packet sent by the host; the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into a data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of a plurality of data to be sent into a data protocol framework to generate a data packet; the identity information of the data to be sent may be discontinuous; the parsing module 41 parses the data packet.
And the slave machine analyzes the data contained in the data packet after receiving the data packet so as to obtain the instruction information sent by the host machine. Because the HEX format has an encryption attribute, the two communication parties can analyze the data packet according to a set rule to obtain effective data, and the identity information of the data to be sent in the sent data packet can be discontinuous, that is, the data packet contains data information of any address.
Since the embodiment of the apparatus portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the apparatus portion, and details are not repeated here.
Fig. 5 is a block diagram of another communication apparatus based on a HEX format communication protocol according to an embodiment of the present application, and as shown in fig. 5, the communication apparatus based on the HEX format communication protocol includes: a memory 50 for storing a computer program;
a processor 51 for implementing the steps of the above embodiments of the communication protocol based on the HEX format when executing the computer program.
The communication device based on the HEX format communication protocol provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.
The processor 51 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 51 may be implemented in at least one hardware form of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 51 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in a wake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 51 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 51 may further include an Artificial Intelligence (AI) processor for processing computational operations related to machine learning.
Memory 50 may include one or more computer-readable storage media, which may be non-transitory. Memory 50 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 50 is at least used for storing the following computer program 501, wherein after being loaded and executed by the processor 51, the computer program can implement the relevant steps of the HEX format-based communication protocol disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 50 may also include an operating system 502, data 503, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 502 may include Windows, Unix, Linux, and the like. Data 503 may include, but is not limited to, data involved in implementing a HEX format based communication protocol, and the like.
In some embodiments, the communication device based on the HEX format communication protocol may further include a display screen 52, an input/output interface 53, a communication interface 54, a power supply 55, and a communication bus 56.
Those skilled in the art will appreciate that the configuration shown in fig. 5 does not constitute a limitation of a communication device based on a communication protocol of the HEX format and may include more or less components than those shown.
The communication device based on the HEX format communication protocol provided in the embodiment of the present application includes a memory and a processor, and when the processor executes a program stored in the memory, the processor can implement: a communication protocol based on the HEX format. Because the HEX format has an encryption attribute, both communication parties can analyze the data packet according to a set rule to obtain effective data, and the identity information of data to be sent in the sent data packet can be discontinuous, that is, the data packet contains data information of any address.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps as described in the HEX format based communication protocol embodiment above.
It is understood that, if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The present embodiment provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements: based on the communication protocol of the HEX format, because the HEX format has an encryption attribute, both communication parties can analyze the data packet according to a set rule to obtain effective data, and the identity information of data to be sent in the sent data packet can be discontinuous, that is, the data packet contains data information of any address.
The HEX format-based communication protocol, the communication device, and the medium provided by the present application are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A communication protocol based on HEX format, applied to a host for master-slave communication, comprising:
constructing a data protocol framework based on the HEX format;
writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple;
writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate a data packet; wherein the identity information of the data to be sent may be discontinuous;
and sending the data packet to the slave.
2. The HEX format-based communication protocol of claim 1, wherein said writing identity information, parameter types and parameters of a plurality of said data to be transmitted into said data protocol framework to generate a data packet comprises:
and verifying and writing the identity information, the parameter types and the parameters of the data to be sent and a preset frame into the data protocol framework to generate the data packet.
3. The HEX format-based communication protocol of claim 1 wherein said data protocol framework comprises: frame header, frame length, frame number, slave equipment address and programmable data stream; wherein the function code, the number, the identity information, the parameter type, and the parameter are written into the programmable data stream.
4. A communication protocol based on HEX format, applied to a slave in master-slave communication, comprising:
receiving a data packet sent by a host; wherein the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate the data packet; wherein the identity information of the data to be transmitted may not be continuous;
and analyzing the data packet.
5. The HEX format-based communication protocol of claim 4 wherein said receiving a packet sent by a host comprises:
judging whether the information of the data packet is complete or not;
if the data packet is complete, the analyzing the data packet includes: verifying whether the information contained in the trial data packet conforms to a decoding rule; and analyzing the identity information, the parameter type and the parameter of the data to be sent in sequence according to the function code.
6. The HEX format-based communication protocol of claim 5, wherein said parsing said packet further comprises:
sending a reply frame back to the host.
7. A communication device based on a communication protocol of HEX format, which is applied to a host computer of master-slave communication, and is characterized by comprising:
a construction module for constructing a data protocol framework based on the HEX format;
the writing module is used for writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple;
the generating module is used for writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate a data packet; wherein the identity information of the data to be transmitted may not be continuous;
and the sending module is used for sending the data packet to a slave.
8. A communication device based on a communication protocol of a HEX format is applied to a slave machine of master-slave communication, and is characterized by comprising:
the receiving module is used for receiving a data packet sent by the host; wherein the host constructs a data protocol framework based on the HEX format; writing the function codes and the number corresponding to the data to be sent into the data protocol framework, wherein the number of the data to be sent is multiple; writing the identity information, the parameter types and the parameters of the data to be sent into the data protocol framework to generate the data packet; wherein the identity information of the data to be sent may be discontinuous;
and the analysis module is used for analyzing the data packet.
9. A communications device based on a HEX-format communications protocol, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the HEX format based communication protocol of any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the HEX format based communication protocol method according to any of the claims 1 to 6.
CN202210587035.4A 2022-05-27 2022-05-27 Communication protocol based on HEX format, communication device and medium Pending CN115002231A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210587035.4A CN115002231A (en) 2022-05-27 2022-05-27 Communication protocol based on HEX format, communication device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210587035.4A CN115002231A (en) 2022-05-27 2022-05-27 Communication protocol based on HEX format, communication device and medium

Publications (1)

Publication Number Publication Date
CN115002231A true CN115002231A (en) 2022-09-02

Family

ID=83029312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210587035.4A Pending CN115002231A (en) 2022-05-27 2022-05-27 Communication protocol based on HEX format, communication device and medium

Country Status (1)

Country Link
CN (1) CN115002231A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346316A (en) * 2014-10-22 2015-02-11 四川东方电气自动控制工程有限公司 Design method of high-efficiency serial port communication protocol
CN107147657A (en) * 2017-05-31 2017-09-08 飞智控(天津)科技有限公司 Suitable for the communication protocol of multimachine reliable communication, decoding method and communication apparatus
CN108737259A (en) * 2018-05-08 2018-11-02 平安证券股份有限公司 Gateway device, data transmission method and storage medium
CN111818060A (en) * 2020-07-09 2020-10-23 厦门海为科技有限公司 Communication protocol, method and system supporting hybrid and discrete data transmission

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346316A (en) * 2014-10-22 2015-02-11 四川东方电气自动控制工程有限公司 Design method of high-efficiency serial port communication protocol
CN107147657A (en) * 2017-05-31 2017-09-08 飞智控(天津)科技有限公司 Suitable for the communication protocol of multimachine reliable communication, decoding method and communication apparatus
CN108737259A (en) * 2018-05-08 2018-11-02 平安证券股份有限公司 Gateway device, data transmission method and storage medium
CN111818060A (en) * 2020-07-09 2020-10-23 厦门海为科技有限公司 Communication protocol, method and system supporting hybrid and discrete data transmission

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
胡宁波: "基于嵌入式高精度激光测距系统的研究和实现", 《中国优秀硕士学位论文全文数据库》, no. 3, 15 March 2022 (2022-03-15), pages 35 - 50 *
胡宁波: "基于嵌入式高精度激光测距系统的研究和实现", 《中国优秀硕士学位论文全文数据库》, no. 3, pages 35 - 50 *

Similar Documents

Publication Publication Date Title
CN108897691A (en) Data processing method, device, server and medium based on interface analog service
CN110493030B (en) Network optimization method and device, computer equipment and storage medium
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN107404418B (en) Internet product testing method, device, equipment and storage medium
CN107436844A (en) A kind of generation method and device of interface use-case intersection
CN110187986B (en) Command management method, system, device and computer readable storage medium
CN109408247A (en) Interaction data processing method and device
US20200260277A1 (en) Method for wireless access authentication
CN110278272B (en) Universal method for simulating Socket request
CN112286815A (en) Interface test script generation method and related equipment thereof
CN115002231A (en) Communication protocol based on HEX format, communication device and medium
CN110022323A (en) A kind of method and system of the cross-terminal real-time, interactive based on WebSocket and Redux
US11797277B2 (en) Neural network model conversion method server, and storage medium
CN114417390A (en) Method and device for synchronizing data of network disk organization account, network disk and storage medium
WO2017084358A1 (en) Camera parameter read-write method and apparatus, and terminal device
CN112114931B (en) Deep learning program configuration method and device, electronic equipment and storage medium
CN108076067B (en) Method and system for authorized crawler configuration simulation login
US20200073916A1 (en) Collaborative documentation
KR20210057845A (en) Deep Learning Frame Work-Based Image Recognition Method and System Using Training Image Data
CN113743060B (en) Customizable report generation method, device, computer equipment and storage medium
CN109194529B (en) Interaction method and device for virtual SIM card and server apdu
CN112560462B (en) Event extraction service generation method, device, server and medium
CN113190367B (en) Cross-system data interaction method and device based on browser and electronic equipment
CN111736805B (en) Method and device for processing Excel table
CN112286700A (en) Remote information interaction method and device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Building 5, No. 1508, Xiangjiang Road, Suzhou High-tech Zone, Suzhou City, Jiangsu Province 215129

Applicant after: Suzhou Lianxun Instrument Co.,Ltd.

Address before: 215129 Building 1, No. 1508, Xiangjiang Road, high tech Zone, Suzhou, Jiangsu

Applicant before: STELIGHT INSTRUMENT Inc.

CB02 Change of applicant information
CB02 Change of applicant information

Address after: Building 5, No. 1508, Xiangjiang Road, Suzhou High-tech Zone, Suzhou City, Jiangsu Province 215129

Applicant after: Suzhou Lianxun Instrument Co.,Ltd.

Address before: 215129 Building 1, No. 1508, Xiangjiang Road, high tech Zone, Suzhou, Jiangsu

Applicant before: STELIGHT INSTRUMENT Inc.