CN112788032A - Method for automatically identifying custom protocol and MODBUS protocol - Google Patents

Method for automatically identifying custom protocol and MODBUS protocol Download PDF

Info

Publication number
CN112788032A
CN112788032A CN202110039220.5A CN202110039220A CN112788032A CN 112788032 A CN112788032 A CN 112788032A CN 202110039220 A CN202110039220 A CN 202110039220A CN 112788032 A CN112788032 A CN 112788032A
Authority
CN
China
Prior art keywords
power panel
protocol
modbus
check
custom
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
CN202110039220.5A
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.)
Xiamen Dnake Environment Intelligent Technology Co ltd
Original Assignee
Xiamen Dnake Environment Intelligent Technology 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 Xiamen Dnake Environment Intelligent Technology Co ltd filed Critical Xiamen Dnake Environment Intelligent Technology Co ltd
Priority to CN202110039220.5A priority Critical patent/CN112788032A/en
Publication of CN112788032A publication Critical patent/CN112788032A/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/18Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40228Modbus

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

A method for automatically identifying a custom protocol and an MODBUS protocol comprises the following steps: s1, setting a custom protocol and an MODBUS protocol in the power panel; s2, setting the power panel as a custom protocol; s3, the power panel receives the data packet sent by the controller; s4, the power panel checks the data packet, if the check is successful, the step S10 is skipped to, if the check is unsuccessful, the step S5 is executed; s5, adding 1 to the check count M value of the power panel, jumping to step S2, and jumping to step S6 if M is more than the set times; s6, switching the power panel into an MODBUS protocol; s7, the power panel receives the data packet sent by the controller; s8, the power panel checks the data packet, if the check is successful, the step S11 is skipped to, if the check is unsuccessful, the step S9 is executed; s9, adding 1 to the check count N value of the power panel, jumping to step S6, and jumping to step S2 if N is more than the set times; s10, the power panel works according to a self-defined protocol mode; and S11, the power panel works according to the MODBUS protocol mode.

Description

Method for automatically identifying custom protocol and MODBUS protocol
Technical Field
The invention relates to a protocol identification method, in particular to a method for automatically identifying a custom protocol and an MODBUS protocol.
Background
In the fresh air control system, a user sends a control instruction to the power panel through the controller, and the power panel drives each function of fresh air successively according to the instruction. Because of different requirements of use environments, the current controller has two protocols (a self-defined protocol or an MODBUS protocol) and various appearances for customers to select, and power panel software corresponding to the controller is re-programmed according to the controller selected by the customers during production, so that production disorder is caused, and the cost is increased. In order to save the production cost, the applicant has made intensive studies and developed the present application.
Disclosure of Invention
The invention provides a method for automatically identifying a custom protocol and an MODBUS protocol, and mainly aims to solve the problem that the protocol cannot be automatically identified between a controller and a power panel in a fresh air control system.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method for automatically identifying a custom protocol and an MODBUS protocol comprises the following steps:
s1, two protocols, namely a custom protocol and an MODBUS protocol, are built in the power panel;
s2, setting the power panel as a custom protocol, and executing a program according to the baud rate of the custom mode;
s3, the power panel receives the data packet sent by the controller at regular intervals;
s4, the power panel checks the data packet according to the data checking method of the custom protocol, if the check is successful, the identification controller is the custom protocol, the step S10 is skipped, the automatic identification is finished, and if the check is unsuccessful, the step S5 is executed;
s5, adding 1 to the check count M value of the power panel, jumping to step S2, and jumping to step S6 if M is more than the set times;
s6, switching the power panel to an MODBUS protocol, and executing a program according to the Baud rate of the MODBUS protocol mode;
s7, the power panel receives the data packet sent by the controller at regular intervals;
s8, the power panel checks the data packet according to the data checking method of the MODBUS protocol, if the checking is successful, the recognition controller is the MODBUS protocol, the step S11 is skipped to, the automatic recognition is finished, and if the checking is unsuccessful, the step S9 is executed;
s9, adding 1 to the check count N value of the power panel, jumping to step S6, and jumping to step S2 if N is more than the set times;
s10, the power panel works according to a self-defined protocol mode;
and S11, the power panel works according to the MODBUS protocol mode.
Further, in the steps S3 and S7, the power board receives the data packet sent by the controller in a frame identification manner according to the time interval.
Further, the count M in step S5 and the count N in step S9 are the number of times of determination when the baud rate is switched.
Further, in the step S5, when M is less than or equal to 3, go to step S2, if M > 3, go to step S6; in step S9, when M is less than or equal to 3, go to step S6, and if M > 3, go to step S2.
Further, the verification in steps S4 and S8 is to verify the check code or check bit of the data packet.
As can be seen from the above description of the present invention, compared with the prior art, the present invention has the following advantages: the two protocols are built in the power panel, and the power panel automatically switches to the protocol matched with the controller through analysis, verification and judgment of the data packet of the controller, so that when a user selects different controllers, the power panel does not need to rewrite a protocol program corresponding to the controller. Meanwhile, when the first verification is unsuccessful, the receiving and verification of data are increased for many times, and the reliability of the judgment is improved.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
Referring to fig. 1, a method for automatically identifying a custom protocol and a MODBUS protocol includes the following steps:
s1, two protocols, namely a custom protocol and an MODBUS protocol, are built in the power panel;
s2, setting the power panel as a custom protocol, and executing a program according to the baud rate of the custom mode;
s3, the power panel receives the data packet sent by the controller at regular intervals;
s4, the power panel checks the data packet according to the data checking method of the custom protocol, if the check is successful, the identification controller is the custom protocol, the step S10 is skipped, the automatic identification is finished, and if the check is unsuccessful, the step S5 is executed;
s5, adding 1 to the check count M value of the power panel, jumping to step S2, and jumping to step S6 if M is more than the set times;
s6, switching the power panel to an MODBUS protocol, and executing a program according to the Baud rate of the MODBUS protocol mode;
s7, the power panel receives the data packet sent by the controller at regular intervals;
s8, the power panel checks the data packet according to the data checking method of the MODBUS protocol, if the checking is successful, the recognition controller is the MODBUS protocol, the step S11 is skipped to, the automatic recognition is finished, and if the checking is unsuccessful, the step S9 is executed;
s9, adding 1 to the check count N value of the power panel, jumping to step S6, and jumping to step S2 if N is more than the set times;
s10, the power panel works according to a self-defined protocol mode;
and S11, the power panel works according to the MODBUS protocol mode.
Further illustrated is:
in the steps S3 and S7, the power board receives the data packets sent by the controller in a frame identification manner according to the time interval.
The counted M value in the step S5 and the counted N value in the step S9 are the times of judgment when the baud rate is switched.
In the step S5, when M is less than or equal to 3, the step S2 is skipped, and if M is more than 3, the step S6 is skipped; in step S9, when M is less than or equal to 3, go to step S6, and if M > 3, go to step S2.
The check in steps S4 and S8 is to check the check code or check bit of the data packet.
The two protocols are built in the power panel, and the power panel automatically switches to the protocol matched with the controller through analysis, verification and judgment of the data packet of the controller, so that when a user selects different controllers, the power panel does not need to rewrite a protocol program corresponding to the controller. Meanwhile, when the first verification is unsuccessful, the receiving and verification of data are increased for many times, and the reliability of the judgment is improved.
The above description is only an embodiment of the present invention, but the design concept of the present invention is not limited thereto, and any insubstantial modifications made by using the design concept should fall within the scope of infringing the present invention.

Claims (5)

1. A method for automatically identifying a custom protocol and an MODBUS protocol is characterized in that: the method comprises the following steps:
s1, two protocols, namely a custom protocol and an MODBUS protocol, are built in the power panel;
s2, setting the power panel as a custom protocol, and executing a program according to the baud rate of the custom mode;
s3, the power panel receives the data packet sent by the controller at regular intervals;
s4, the power panel checks the data packet according to the data checking method of the custom protocol, if the check is successful, the identification controller is the custom protocol, the step S10 is skipped, the automatic identification is finished, and if the check is unsuccessful, the step S5 is executed;
s5, adding 1 to the check count M value of the power panel, jumping to step S2, and jumping to step S6 if M is more than the set times;
s6, switching the power panel to an MODBUS protocol, and executing a program according to the Baud rate of the MODBUS protocol mode;
s7, the power panel receives the data packet sent by the controller at regular intervals;
s8, the power panel checks the data packet according to the data checking method of the MODBUS protocol, if the checking is successful, the recognition controller is the MODBUS protocol, the step S11 is skipped to, the automatic recognition is finished, and if the checking is unsuccessful, the step S9 is executed;
s9, adding 1 to the check count N value of the power panel, jumping to step S6, and jumping to step S2 if N is more than the set times;
s10, the power panel works according to a self-defined protocol mode;
and S11, the power panel works according to the MODBUS protocol mode.
2. The method of claim 1 for automatically identifying custom protocols and MODBUS protocols, wherein: in the steps S3 and S7, the power board receives the data packets sent by the controller in a frame identification manner according to the time interval.
3. The method of claim 1 for automatically identifying custom protocols and MODBUS protocols, wherein: the counted M value in the step S5 and the counted N value in the step S9 are the times of judgment when the baud rate is switched.
4. The method of claim 1 for automatically identifying custom protocols and MODBUS protocols, wherein: in the step S5, when M is less than or equal to 3, the step S2 is skipped, and if M is more than 3, the step S6 is skipped; in step S9, when M is less than or equal to 3, go to step S6, and if M > 3, go to step S2.
5. The method of claim 1 for automatically identifying custom protocols and MODBUS protocols, wherein: the check in steps S4 and S8 is to check the check code or check bit of the data packet.
CN202110039220.5A 2021-01-12 2021-01-12 Method for automatically identifying custom protocol and MODBUS protocol Pending CN112788032A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110039220.5A CN112788032A (en) 2021-01-12 2021-01-12 Method for automatically identifying custom protocol and MODBUS protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110039220.5A CN112788032A (en) 2021-01-12 2021-01-12 Method for automatically identifying custom protocol and MODBUS protocol

Publications (1)

Publication Number Publication Date
CN112788032A true CN112788032A (en) 2021-05-11

Family

ID=75757104

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110039220.5A Pending CN112788032A (en) 2021-01-12 2021-01-12 Method for automatically identifying custom protocol and MODBUS protocol

Country Status (1)

Country Link
CN (1) CN112788032A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763396A (en) * 2014-02-12 2014-04-30 浙江大学 Energy consumption data acquisition unit and method based on multi-protocol parallel acquisition technology
CN105656600A (en) * 2015-12-29 2016-06-08 湖南先步信息股份有限公司 Communication method for slave station to adapt to two communication protocols
CN109510759A (en) * 2018-10-22 2019-03-22 智强通达科技(北京)有限公司 A kind of Universal-purpose quick multi-protocol gateway realization system and method
CN109587158A (en) * 2018-12-19 2019-04-05 武汉理工光科股份有限公司 Transparent transmission and the adaptive method of Modbus protocol conversion both of which are realized in Network Serial Port

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763396A (en) * 2014-02-12 2014-04-30 浙江大学 Energy consumption data acquisition unit and method based on multi-protocol parallel acquisition technology
CN105656600A (en) * 2015-12-29 2016-06-08 湖南先步信息股份有限公司 Communication method for slave station to adapt to two communication protocols
CN109510759A (en) * 2018-10-22 2019-03-22 智强通达科技(北京)有限公司 A kind of Universal-purpose quick multi-protocol gateway realization system and method
CN109587158A (en) * 2018-12-19 2019-04-05 武汉理工光科股份有限公司 Transparent transmission and the adaptive method of Modbus protocol conversion both of which are realized in Network Serial Port

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
佘立;李志强;: "基于Qt的多串口多协议数据接收解析软件的设计与实现", 电子质量, no. 01, 20 January 2011 (2011-01-20) *
谭方勇;王昂;刘子宁;: "基于ZigBee与MQTT的物联网网关通信框架的设计与实现", 软件工程, no. 04, 5 April 2017 (2017-04-05) *
郑艺;孙可;孙野;沈涛;: "基于IEC61375-2-3标准的安全数据传输协议设计及测试方法研究", 铁路通信信号工程技术, no. 09, 25 September 2020 (2020-09-25) *
韩月;张成名;: "基于MODBUS自由协议的数据校验方法探究", 数据通信, no. 06, 28 December 2014 (2014-12-28) *

Similar Documents

Publication Publication Date Title
CN102394719B (en) Multichannel HDLC data processing method based on FPGA
CN102779405B (en) Digital video recorder, infrared remote control receiving device and method
CN105955905A (en) Interface circuit based on serial bus structure and communication protocol
CN107748509B (en) ASI communication slave machine implementation method based on single chip microcomputer transceiving control
CN103405123A (en) Control method and control system of power-driven curtain
CN102354443A (en) Wireless infrared (IR) remote control device and operating method thereof
CN111786941B (en) Automatic identification method and communication method for communication protocol
CN107241161A (en) A kind of data transmission method and device
CN105472377B (en) Television set debugging method and device
CN108616582A (en) Pairing method, device and system of internal machine and wire controller
US10608778B2 (en) Data transmission method and terminal
JPS6112282B2 (en)
CN112788032A (en) Method for automatically identifying custom protocol and MODBUS protocol
CN101841393A (en) PWM (Pulse Width Modulation) input module and MVB (Multifunction Vehicle Bus) equipment based on MVB interface
CN103401956A (en) Address assigning method, data transmission method, indoor unit, outdoor unit and air-conditioning system
CN105843046B (en) Intelligent household electrical appliance master control communication method and system
CN110048863A (en) A kind of smart home device response arbitration system and method
CN105871622B (en) Sending, receiving method, control device, terminal and the system of information
CN205121274U (en) Serial ports stipulations message signal testing terminal row
CN109327832B (en) Single-type multi-terminal low-power-consumption wireless transmission system and transmission method thereof
CN110319537B (en) Method for controlling bus communication of air conditioner, host and air conditioning system
CN108449144B (en) A kind of mB1C code fiber optic serial data decoding method and communication means
CN112423291B (en) WIFI module detection and number burning method, controller, WIFI module and electrical equipment
CN1959741B (en) Communication terminal module with functions of encoding and decoding capabilities, and method for receiving and sending data
CN112152753A (en) Method and device for transmitting data with lower computer

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