CN116383110A - Modbus communication module and communication method - Google Patents

Modbus communication module and communication method Download PDF

Info

Publication number
CN116383110A
CN116383110A CN202211709975.2A CN202211709975A CN116383110A CN 116383110 A CN116383110 A CN 116383110A CN 202211709975 A CN202211709975 A CN 202211709975A CN 116383110 A CN116383110 A CN 116383110A
Authority
CN
China
Prior art keywords
entering
data
modbus
secondary side
address
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
CN202211709975.2A
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.)
Frecon Electric Shenzhen Co ltd
Original Assignee
Frecon Electric Shenzhen 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 Frecon Electric Shenzhen Co ltd filed Critical Frecon Electric Shenzhen Co ltd
Priority to CN202211709975.2A priority Critical patent/CN116383110A/en
Publication of CN116383110A publication Critical patent/CN116383110A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/36Handling requests for interconnection or transfer for access to common bus or bus system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • 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)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a Modbus communication module and a communication method, comprising a Modbus adaptation module which is respectively connected with a frequency converter and a PLC/upper computer; the Modbus adaptation module comprises a processing module, a keyboard, a primary side RS485 interface, a secondary side RS485 interface and a communication indicator lamp, wherein the keyboard is connected with the processing module; a signal isolation module connected with a PLC/upper computer is arranged on the secondary side RS485 interface; the invention completes two functions by a corresponding relation between the primary side address and the secondary side address, 1, the data of the secondary side address is analyzed, 2, the data is converted into the data corresponding to the primary side address, and then the data is written into a frequency converter; updating the data corresponding to the real-time update of the primary side to the secondary side; therefore, the interaction of data is achieved, and the addresses of the primary side and the secondary side can be changed according to the requirements of various occasions through the parameter setting function of the keyboard, so that the keyboard can adapt to various different occasions.

Description

Modbus communication module and communication method
Technical Field
The invention relates to the field of MODBUS communication of frequency converters, in particular to a Modbus communication module and a communication method, which are mainly used for realizing the update and replacement of equipment in the aspect of 485 bus processing of field equipment in industrial control industry without modifying an original bus system.
Background
MODBUS communication is a one-to-many communication mode, that is, only 1 host exists in a single network segment, so that multiple slaves can be allowed, but to realize communication between the master and the slave, the host must know the register address of the slave device.
For some variable-frequency terminal clients, the control system of a workshop and the field 485 bus equipment are only in a layer which can be used, the modification of the master station equipment in the system can not be realized, and when the equipment is damaged and needs to be replaced with new equipment, the difference of register addresses can cause the non-use.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a Modbus communication module and a communication method; the problem that equipment cannot be used due to the fact that the MODBUS register addresses of new equipment and old equipment are different is solved.
The Modbus communication module is realized by the following technical scheme: the device comprises a Modbus adaptation module which is respectively connected with a frequency converter and a PLC/upper computer; the Modbus adaptation module comprises a processing module, a keyboard, a primary side RS485 interface, a secondary side RS485 interface and a communication indicator lamp, wherein the keyboard is connected with the processing module; a signal isolation module connected with a PLC/upper computer is arranged on the secondary side RS485 interface;
the Modbus adaptation module is provided with a secondary side data processing module of the ModBUS adaptation module and a primary side data processing module of the ModBUS adaptation module; the MODBUS adaptation module secondary side data processing module is connected with a secondary side RS485 interface; the MODBUS adaptation module primary side data processing module is connected with a primary side RS485 interface.
The Modbus communication method is realized by the following technical scheme:
the secondary side data processing module of the MODBUS adaptation module specifically comprises the following steps:
s1, receiving PLC data, and entering S2;
s2, judging whether the equipment station number is correct, if so, entering S3, and if not, entering S13;
s3, modbus data verification, and entering S4;
s4, judging whether the verification is successful, if so, entering S5, and if not, entering S13;
s5, searching a secondary side matching address, and entering S6;
s6, judging whether the address exists, if so, entering S7, and if not, entering S13;
s7, judging Modbus command codes, and simultaneously carrying out S8, S9 and S10;
s8, a 0x03 command is sent to S11;
s9, 0x06 command, entering S14;
s10, 0x010 command; entering S11;
s11, judging whether the continuous operation is carried out, if the continuous operation is carried out in S8, entering S12, and if the continuous operation is carried out in S10, entering S14; s8 and S10 are discontinuous, and S13 is entered;
s12, acquiring secondary side address data, and entering S15;
s13, preparing fault response data, and entering S15;
s14, writing data into the address, setting an address writing event flag bit corresponding to the primary side;
s15, returning response data to the upper computer;
the MODBUS adaptation module primary side data processing module specifically comprises the following steps:
s1, whether a transmission busy bit is 1 or not, entering S2 if not, and entering S7 if not;
s2, writing the polling address into an event address bit, and entering S3;
s3, judging whether a writing event exists or not; writing is performed, S4 is performed, and writing is performed, S5 is performed;
s4, writing the data into a frequency converter, and entering S6;
s5, circularly reading the data of the frequency converter, and entering S6;
s6, the busy position is 1, and S7 is entered;
s7, judging whether data are received or not, if yes, entering S8, and if not, directly ending;
s8, judging whether the data is successfully checked, if so, entering S9, otherwise, directly ending
S9, judging whether a command is written or not, if so, entering S10, otherwise, entering S11;
s10, clearing a primary side write event log, and ending;
s11, updating address data of a primary register, and entering S12;
s12, updating the address data of the corresponding secondary side register, and ending.
The beneficial effects of the invention are as follows: through a corresponding relation to the addresses of the primary side and the secondary side, two functions are completed:
1. analyzing the data of the secondary side address, converting the data into data corresponding to the primary side address, and then writing the data into a frequency converter;
2. and updating the data corresponding to the real-time update of the primary side to the secondary side. Therefore, the interaction of data is achieved, and the address of the primary side and the secondary side can be changed according to the requirements of various occasions through the parameter setting function of the keyboard, so that the device can adapt to various different occasions, and the problem that the register addresses are not matched during equipment replacement is well solved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a Modbus communication module;
FIG. 2 is a schematic diagram illustrating the processing steps of a secondary side data processing module of the MODBUS adaptation module;
fig. 3 is a schematic diagram of a processing step of a primary side data processing module of the MODBUS adaptation module.
Detailed Description
All of the features disclosed in this specification, or all of the steps in a method or process disclosed, may be combined in any combination, except for mutually exclusive features and/or steps.
Any feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise. That is, each feature is one example only of a generic series of equivalent or similar features, unless expressly stated otherwise.
As shown in fig. 1, the Modbus communication module of the present invention includes a Modbus adapting module respectively connected to a frequency converter and a PLC/host; the Modbus adaptation module comprises a processing module, a keyboard, a primary side RS485 interface, a secondary side RS485 interface and a communication indicator lamp, wherein the keyboard is connected with the processing module; a signal isolation module connected with a PLC/upper computer is arranged on the secondary side RS485 interface;
the Modbus adaptation module is provided with a secondary side data processing module of the ModBUS adaptation module and a primary side data processing module of the ModBUS adaptation module; the MODBUS adaptation module secondary side data processing module is connected with a secondary side RS485 interface; the MODBUS adaptation module primary side data processing module is connected with a primary side RS485 interface.
In this embodiment, the MODBUS adapting module has a function menu structure, and functional parameters of the module are set through the keyboard, including addresses corresponding to the primary side and the secondary side, decimal point numbers of the primary side and the secondary side data, communication formats and station addresses, and normal work can be performed after parameter setting is completed; the method mainly relates to communication format parameters, primary side address setting and secondary side address setting.
The Modbus communication method of the invention is as shown in FIG. 2: the flow is the flow of secondary side data processing, and the role of the secondary side is MODBUS slave station;
s1: the secondary side RS485 interface receives data from the PLC/upper computer;
s2: judging whether the received MODBUS station number is matched with the station number of the module, if not, jumping to the step S13;
s3: performing CRC16 check on the received data;
s4: judging whether CRC check is successful;
s5: after the data verification is successful, the address information in the data is acquired and is compared with all secondary side addresses;
s6: judging whether a matching address is found, if not, jumping to the step S13;
s7: if the matching address is found, judging the function command (0 x03,0x06,0x 10) of the data;
s8: if the function command is 0x03 (reading a plurality of data), jumping to step S11;
s9: if the function command is 0x06 (writing single data), jumping to the step S14;
s10: if the function command is 0x10 (writing a plurality of data), entering the next step;
s11: judging whether addresses in the plurality of addresses are continuously read/continuously written or not, if not, jumping to the step S13;
s12: acquiring data in a secondary side address, and preparing for data response;
s13: preparing fault response data, and jumping to the step S15;
s14: writing the received PLC data into the secondary side address, updating the data of the address corresponding to the primary side and writing in the event flag bit;
s15: returning the data to the PLC, and ending the flow;
as shown in fig. 3, the role of the primary side of the process corresponds to the role of the MODBUS master station for the frequency converter:
s1: judging whether the sent busy flag bit is 1, if so, jumping to a step S7;
s2: polling write event flag bits of all addresses of a primary side;
s3: judging whether a writing event exists, if not, jumping to the step S5;
s4: if a writing event exists, writing primary address data with the writing event into a frequency converter;
s5: if no writing event exists, circularly reading the data of the frequency converter to update the primary side address data and the corresponding secondary side address data;
s6: after the data transmission is completed, a busy flag position 1 is transmitted;
s7: judging whether data are received or not, if not, ending the program;
s8: if data is received, judging whether the data verification is successful, and if the data verification is failed, ending the program;
s9: if the data verification is successful, judging whether the data verification is a writing event or not;
s10: if the write event is the write event, the write event flag bit of the corresponding address of the primary side is cleared, and the program is ended;
s11: if the task is a cyclic reading task, updating the primary address data;
s12: updating corresponding secondary side address data;
the invention can be used for a communication device which is suitable for the register address of the MODBUS frequency converter of any manufacturer, and is mainly used for occasions where certain PLC or upper computer programs cannot be changed when certain new frequency converters are replaced by old ones. By the device, new equipment supporting MODBUS communication can be conveniently accessed to the communication bus, the original register address in the PLC or the upper computer does not need to be modified, and the device is provided with an isolation signal isolation circuit to enhance the anti-interference capability of the equipment.
The foregoing is merely illustrative of specific embodiments of the present invention, and the scope of the invention is not limited thereto, but any changes or substitutions that do not undergo the inventive effort should be construed as falling within the scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope defined by the claims.

Claims (2)

1. The utility model provides a Modbus communication module which characterized in that: the device comprises a Modbus adaptation module which is respectively connected with a frequency converter and a PLC/upper computer; the Modbus adaptation module comprises a processing module, a keyboard, a primary side RS485 interface, a secondary side RS485 interface and a communication indicator lamp, wherein the keyboard is connected with the processing module; a signal isolation module connected with a PLC/upper computer is arranged on the secondary side RS485 interface;
the Modbus adaptation module is provided with a secondary side data processing module of the ModBUS adaptation module and a primary side data processing module of the ModBUS adaptation module; the MODBUS adaptation module secondary side data processing module is connected with a secondary side RS485 interface; the MODBUS adaptation module primary side data processing module is connected with a primary side RS485 interface.
2. A Modbus communication module communication method is characterized in that: the secondary side data processing module of the MODBUS adaptation module specifically comprises the following steps:
s1, receiving PLC data, and entering S2;
s2, judging whether the equipment station number is correct, if so, entering S3, and if not, entering S13;
s3, modbus data verification, and entering S4;
s4, judging whether the verification is successful, if so, entering S5, and if not, entering S13;
s5, searching a secondary side matching address, and entering S6;
s6, judging whether the address exists, if so, entering S7, and if not, entering S13;
s7, judging Modbus command codes, and simultaneously carrying out S8, S9 and S10;
s8, 0x03 command (read multiple), and the process goes to S11;
s9, 0x06 command (write single), enter S14;
s10, 0x010 command (read multiple); entering S11;
s11, judging whether the continuous operation is carried out, if the continuous operation is carried out in S8, entering S12, and if the continuous operation is carried out in S10, entering S14; s8 and S10 are discontinuous, and S13 is entered;
s12, acquiring secondary side address data, and entering S15;
s13, preparing fault response data, and entering S15;
s14, writing data into the address, setting an address writing event flag bit corresponding to the primary side;
s15, returning response data to the upper computer;
the MODBUS adaptation module primary side data processing module specifically comprises the following steps:
s1, whether a transmission busy bit is 1 or not, entering S2 if not, and entering S7 if not;
s2, writing the polling address into an event address bit, and entering S3;
s3, judging whether a writing event exists or not; writing is performed, S4 is performed, and writing is performed, S5 is performed;
s4, writing the data into a frequency converter, and entering S6;
s5, circularly reading the data of the frequency converter, and entering S6;
s6, the busy position is 1, and S7 is entered;
s7, judging whether data are received or not, if yes, entering S8, and if not, directly ending;
s8, judging whether the data is successfully checked, if so, entering S9, otherwise, directly ending S9, judging whether to write in a command, if so, entering S10, otherwise, entering S11;
s10, clearing a primary side write event log, and ending;
s11, updating address data of a primary register, and entering S12;
s12, updating the address data of the corresponding secondary side register, and ending.
CN202211709975.2A 2022-12-29 2022-12-29 Modbus communication module and communication method Pending CN116383110A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211709975.2A CN116383110A (en) 2022-12-29 2022-12-29 Modbus communication module and communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211709975.2A CN116383110A (en) 2022-12-29 2022-12-29 Modbus communication module and communication method

Publications (1)

Publication Number Publication Date
CN116383110A true CN116383110A (en) 2023-07-04

Family

ID=86975618

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211709975.2A Pending CN116383110A (en) 2022-12-29 2022-12-29 Modbus communication module and communication method

Country Status (1)

Country Link
CN (1) CN116383110A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5956523A (en) * 1996-08-09 1999-09-21 Advantech Co., Ltd. Method and apparatus for reducing the number of RS232/RS485 transmission converters required for communicating between a PC and a plurality of instruments
CN202077059U (en) * 2010-12-27 2011-12-14 深圳市正弦软件技术有限公司 Bus bridge capable of changing PROFIBUS protocol to MODBUS protocol
CN103533099A (en) * 2013-10-14 2014-01-22 威海麦科电气技术有限公司 Variable-frequency drive and address mapping method thereof under MODBUS communication protocol
KR20190122385A (en) * 2018-04-20 2019-10-30 엘에스산전 주식회사 Master-Slave communication system
JP2020161937A (en) * 2019-03-26 2020-10-01 バックス情報システム株式会社 Radio communication system and communication distance extension system
CN112087357A (en) * 2020-09-07 2020-12-15 中国石油化工股份有限公司 Oil field-based digital Modbus communication address conversion box and control method
WO2021072981A1 (en) * 2019-10-17 2021-04-22 广东绿腾新能源服务有限公司 Blockchain-based energy data linking method and apparatus
CN114422288A (en) * 2021-12-29 2022-04-29 厦门诚通达智能科技有限公司 Communication system based on Modbus protocol
CN114567672A (en) * 2022-03-09 2022-05-31 深圳市东力科创技术有限公司 Communication conversion device, method and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5956523A (en) * 1996-08-09 1999-09-21 Advantech Co., Ltd. Method and apparatus for reducing the number of RS232/RS485 transmission converters required for communicating between a PC and a plurality of instruments
CN202077059U (en) * 2010-12-27 2011-12-14 深圳市正弦软件技术有限公司 Bus bridge capable of changing PROFIBUS protocol to MODBUS protocol
CN103533099A (en) * 2013-10-14 2014-01-22 威海麦科电气技术有限公司 Variable-frequency drive and address mapping method thereof under MODBUS communication protocol
KR20190122385A (en) * 2018-04-20 2019-10-30 엘에스산전 주식회사 Master-Slave communication system
JP2020161937A (en) * 2019-03-26 2020-10-01 バックス情報システム株式会社 Radio communication system and communication distance extension system
WO2021072981A1 (en) * 2019-10-17 2021-04-22 广东绿腾新能源服务有限公司 Blockchain-based energy data linking method and apparatus
CN112087357A (en) * 2020-09-07 2020-12-15 中国石油化工股份有限公司 Oil field-based digital Modbus communication address conversion box and control method
CN114422288A (en) * 2021-12-29 2022-04-29 厦门诚通达智能科技有限公司 Communication system based on Modbus protocol
CN114567672A (en) * 2022-03-09 2022-05-31 深圳市东力科创技术有限公司 Communication conversion device, method and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王俊杰;徐建文;: "基于MODBUS-RTU通讯协议的变频器PLC控制设计", 工业控制计算机, no. 02 *

Similar Documents

Publication Publication Date Title
CN112732636B (en) Configuration method, device and equipment of chip prototype verification system based on multiple FPGAs
CN111104272B (en) CAN bus controller testing method based on RX and TX
CN113189970B (en) Hardware-in-loop automatic test method and system of CAN bus controller and storage medium
CN108923957B (en) Distribution network terminal DTU fault elimination method and device and terminal equipment
CN110941218A (en) CAN bus controller test method
CN110390082B (en) Communication matrix comparison method and system
CN107294826B (en) CAN network-based TBOX parameter calibration method and device
CN103378994A (en) Method and terminal for testing communication equipment
CN113364732B (en) Vehicle-mounted terminal communication protocol analysis method and device
CN116383110A (en) Modbus communication module and communication method
CN103913672A (en) Satellite low-frequency interface automatic testing system
CN108763127B (en) Method for realizing Modbus adapter capable of realizing interconversion of source data and target data
CN115543755A (en) Performance monitoring method, device, system, equipment and medium
CN102722592B (en) Universal digital information recording device and method
CN218679102U (en) Profibus field bus signal conversion device
CN113676882A (en) Single-chip multi-antenna Bluetooth positioning system and method
CN108460078B (en) Auxiliary function execution method and device, storage medium and terminal
CN112084076A (en) Test method, electronic device, and storage medium
CN112765076B (en) MODBUS data processing method, device, equipment and computer readable storage medium
CN210609213U (en) Configurable protocol conversion gateway
CN113093688B (en) Input and output testing method and system for new energy vehicle control unit
CN114500148B (en) Conversion device, access method, electronic equipment and storage medium of PA equipment
JP2830380B2 (en) Identification system and article identification method
JP3870890B2 (en) Operation board, remote I / O communication control method
JP4864755B2 (en) Data processing system and diagnostic method

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