CN103916284A - RS485 communication interface automatic baud rate and communication address detection method - Google Patents

RS485 communication interface automatic baud rate and communication address detection method Download PDF

Info

Publication number
CN103916284A
CN103916284A CN201310003372.5A CN201310003372A CN103916284A CN 103916284 A CN103916284 A CN 103916284A CN 201310003372 A CN201310003372 A CN 201310003372A CN 103916284 A CN103916284 A CN 103916284A
Authority
CN
China
Prior art keywords
slave
main frame
baud rate
handshake protocol
communication
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
CN201310003372.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.)
SHANGHAI KAITONG DIGITAL CONTROL CO Ltd
Original Assignee
SHANGHAI KAITONG DIGITAL CONTROL 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 SHANGHAI KAITONG DIGITAL CONTROL CO Ltd filed Critical SHANGHAI KAITONG DIGITAL CONTROL CO Ltd
Priority to CN201310003372.5A priority Critical patent/CN103916284A/en
Publication of CN103916284A publication Critical patent/CN103916284A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses an RS485 communication interface automatic baud rate and communication address detection method. The method includes the steps that when a mainframe is connected with a single slave, the mainframe sends a fixed handshake protocol in a broadcast mode at one baud rate each time till the slave resounds so as to set up communication connection; when the mainframe is connected with multiple slaves, the mainframe sends a handshake protocol to each slave address, when the slave conducts decoding and determines that the handshake protocol is sent to the slave, the salve responds to a station number given by the mainframe, and when the slave conducts decoding and determines that the handshake protocol is not sent to the slave, the slave does not respond; when the mainframe receives the response from the slave, decoding is conducted, communication connection is set up, the baud rate and the station number which are in communication with the slave are recorded, and next circulation is started if no response is received. According to the method, the automatic baud rate and the communication address of an RS485 port can be accurately detected, communication connection between the mainframe and the slaves can be conveniently achieved, extra expenses of hardware are omitted, and errors caused by interference during communication are avoided as well.

Description

RS485 PORT COM auto-baud and address detection method
Technical field
The present invention relates to a kind of RS485 PORT COM auto-baud and address detection method.
Background technology
RS485 PORT COM is a kind of data communication bus being widely used, and is often applied between centralized control hinge and decentralized control unit.If when nodes exceedes chip nominal parameter on signal transmission distance or circuit, how to ensure that signal accurate transmission is on the line the very important task of communication system.RS485 PORT COM adopts differential signal negative logic, and+2V~+ 6V represents " 0 ", and-6V~-2V represents " 1 ".RS485 has two-wire system and two kinds of wiring of four-wire system, and four-wire system is full duplex communication mode, and two-wire system is half duplex communication mode.In RS485 communication network, general employing is master-slave communication mode, i.e. the multiple slaves of main frame band.
Because RS-485 communication interface standard occurs early, having unavoidably weak point, mainly contain following some:
Cannot automatically detect baud rate and slave station number.Two-wire system port uses an output line and a signal line of return and forms the transmission form on common ground, thisly transmits altogether easy generation common mode disturbances, so a little less than noise immunity.Make like this RS485 PORT COM auto-baud and address detect and cannot accomplish simple universal.
Existing method is to adopt to detect an independent bit time.Be that main frame sends specific character or character string, the data that slave receives according to different baud rates are also different, thereby automatically adjust and the baud rate of host matching, to set up and the writing to each other of main frame.But the method can only detect baud rate, cannot detect the station number of slave, main frame still cannot be realized communication with slave.If disturbed, especially half duplex communication mode, so likely the parsing of slave will make a mistake, and the baud rate obtaining also can be made mistakes.Conventionally repeat to change relevant parameter by manual exploration, could set up writing to each other of slave.So have a strong impact on the use of RS485 PORT COM, adopt RS485 PORT COM to set up slave and write to each other and become comparatively difficulty.Other also have increases special testing circuit, has increased hardware spending and cost.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of RS485 PORT COM auto-baud and address detection method, utilize this method can accurately detect RS485 PORT COM auto-baud and address, conveniently realize writing to each other between slave, remove the overhead of hardware from.Also the error that occurs while having avoided communication to disturb and cause.
For solving the problems of the technologies described above, RS485 PORT COM auto-baud of the present invention and address detection method comprise the steps:
Step 1, in the time that main frame is connected with separate unit slave, main frame sends fixing Handshake Protocol with RS485 PORT COM broadcast mode, every kind of baud rate once, until there is slave response, and establishes a communications link with baud rate and the station number of this slave response;
Step 2, in the time that main frame is connected with many slaves, main frame sends a Handshake Protocol to every slave addresses, each slave starts decoding after receiving Handshake Protocol, in the time being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends and replys to main frame, inform the station number of this slave of main frame, the Handshake Protocol sending as main frame is not this slave of access, and this slave does not response;
If step 3 main frame receives slave and reply, decoding is replied and establishes a communications link, and records current baud rate and station number of communicating by letter with this slave, if main frame do not receive and reply, repeated execution of steps two enters next circulation.
Because RS485 PORT COM auto-baud of the present invention and address detection method have adopted technique scheme, be that this method is worked as main frame while being connected with separate unit slave, main frame sends fixing Handshake Protocol with broadcast mode, and every kind of baud rate once, establishes a communications link until there is slave to respond; In the time that main frame is connected with many slaves, main frame sends a Handshake Protocol to every slave addresses, and slave is decoded and confirmed as is that while sending to the Handshake Protocol of this slave, this slave is replied main frame and provided station number, otherwise this slave does not response; Main frame receives that slave replys, and decodes and establishes a communications link, and baud rate and station number that record is communicated by letter with this slave, as nonreply enters next circulation.This method can accurately detect RS485 PORT COM auto-baud and address, conveniently realizes writing to each other between slave, removes the overhead of hardware from.Also the error that occurs while having avoided communication to disturb and cause.
Brief description of the drawings
Below in conjunction with drawings and embodiments, the present invention is described in further detail:
Fig. 1 is RS485 PORT COM auto-baud of the present invention and address detection method flow chart.
Embodiment
As shown in Figure 1, RS485 PORT COM auto-baud of the present invention and address detection method comprise the steps:
Step 1, in the time that main frame is connected with separate unit slave, main frame sends fixing Handshake Protocol with RS485 PORT COM broadcast mode, every kind of baud rate once, until there is slave response, and establishes a communications link with baud rate and the station number of this slave response;
Step 2, in the time that main frame is connected with many slaves, main frame sends a Handshake Protocol to every slave addresses, each slave starts decoding after receiving Handshake Protocol, in the time being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends and replys to main frame, inform the station number of this slave of main frame, the Handshake Protocol sending as main frame is not this slave of access, and this slave does not response;
If step 3 main frame receives slave and reply, decoding is replied and establishes a communications link, and records current baud rate and station number of communicating by letter with this slave, if main frame do not receive and reply, repeated execution of steps two enters next circulation.
This method adopts and between main frame and slave, sends Handshake Protocol and make respective acknowledgement, thereby set up writing to each other between slave, remove the hardware spending that increases special circuit from, also while having avoided communication, occur to disturb and the error causing and numerous and diverse manual debugging of carrying out for establishing a communications link, save a large amount of time and human resources, increased work efficiency.Due to the characteristic of RS485 communication, in bus, can only there is a side to send data, for avoiding replying conflict, in the time of many slave series connection, main frame need to send Handshake Protocol to the slave of each address, receive that slave replys aft engine and record slave station number and the baud rate that establishes a communications link, so user, without the communications parameter of manual modification slave, just can realize between main frame and slave and set up communication contact.

Claims (1)

1. RS485 PORT COM auto-baud and an address detection method, is characterized in that this method comprises the steps:
Step 1, in the time that main frame is connected with separate unit slave, main frame sends fixing Handshake Protocol with RS485 PORT COM broadcast mode, every kind of baud rate once, until there is slave response, and establishes a communications link with baud rate and the station number of this slave response;
Step 2, in the time that main frame is connected with many slaves, main frame sends a Handshake Protocol to every slave addresses, each slave starts decoding after receiving Handshake Protocol, in the time being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends and replys to main frame, inform the station number of this slave of main frame, the Handshake Protocol sending as main frame is not this slave of access, and this slave does not response;
If step 3 main frame receives slave and reply, decoding is replied and establishes a communications link, and records current baud rate and station number of communicating by letter with this slave, if main frame do not receive and reply, repeated execution of steps two enters next circulation.
CN201310003372.5A 2013-01-06 2013-01-06 RS485 communication interface automatic baud rate and communication address detection method Pending CN103916284A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310003372.5A CN103916284A (en) 2013-01-06 2013-01-06 RS485 communication interface automatic baud rate and communication address detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310003372.5A CN103916284A (en) 2013-01-06 2013-01-06 RS485 communication interface automatic baud rate and communication address detection method

Publications (1)

Publication Number Publication Date
CN103916284A true CN103916284A (en) 2014-07-09

Family

ID=51041702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310003372.5A Pending CN103916284A (en) 2013-01-06 2013-01-06 RS485 communication interface automatic baud rate and communication address detection method

Country Status (1)

Country Link
CN (1) CN103916284A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954211A (en) * 2014-03-27 2015-09-30 江西飞尚科技有限公司 Intelligent accessing device identification system based on RS 485 industrial bus
CN105515615A (en) * 2016-01-12 2016-04-20 浙江共同电子科技有限公司 Power line carrier communication method
CN106055497A (en) * 2016-06-02 2016-10-26 广东盈科电子有限公司 Communication method of circuit board and circuit board
CN106293857A (en) * 2016-08-31 2017-01-04 成都国蓉科技有限公司 A kind of wireless mode carries out the method for software upgrading
CN109374935A (en) * 2018-11-28 2019-02-22 武汉精能电子技术有限公司 A kind of electronic load parallel operation method and system
CN110519136A (en) * 2019-07-10 2019-11-29 大城绿川(深圳)科技有限公司 A kind of RS485 multi-machine communication system of adaptive networking
CN111431668A (en) * 2020-04-22 2020-07-17 珠海格力电器股份有限公司 Baud rate switching method based on multi-node UART communication, air conditioning system and processor
CN112291130A (en) * 2020-12-03 2021-01-29 国创新能源汽车智慧能源装备创新中心(江苏)有限公司 Networking system and method of field bus
CN112422233A (en) * 2020-10-27 2021-02-26 深圳Tcl新技术有限公司 Device communication method, communication device, and computer-readable storage medium
CN113259169A (en) * 2021-06-01 2021-08-13 武汉慧联无限科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114095145A (en) * 2020-07-31 2022-02-25 青岛海尔电冰箱有限公司 Half-duplex communication method for refrigerator and refrigerator
CN114189466A (en) * 2021-01-21 2022-03-15 青岛鼎信通讯股份有限公司 Method for detecting local maintenance interface communication mode of low-voltage power acquisition terminal
CN114978799A (en) * 2022-05-26 2022-08-30 深圳市声天下科技有限公司 Audio system communication control method
WO2024002325A1 (en) * 2022-07-01 2024-01-04 北京比特大陆科技有限公司 Positioning method for faulty chip on computing device, device, and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1342938A (en) * 2000-09-11 2002-04-03 合肥创源智能网络有限责任公司 Plug-and-play method for measuring-controlling module in RS-485 bus type measuring-controlling system and its measuring-controlling module
US6862633B2 (en) * 2002-06-26 2005-03-01 Image Vault Llc N to 1 intelligent multiplexor
CN102566517A (en) * 2010-12-15 2012-07-11 上海电科电器科技有限公司 Detection method capable of automatically identifying state of controlled equipment through photovoltaic data collector

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1342938A (en) * 2000-09-11 2002-04-03 合肥创源智能网络有限责任公司 Plug-and-play method for measuring-controlling module in RS-485 bus type measuring-controlling system and its measuring-controlling module
US6862633B2 (en) * 2002-06-26 2005-03-01 Image Vault Llc N to 1 intelligent multiplexor
CN102566517A (en) * 2010-12-15 2012-07-11 上海电科电器科技有限公司 Detection method capable of automatically identifying state of controlled equipment through photovoltaic data collector

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954211A (en) * 2014-03-27 2015-09-30 江西飞尚科技有限公司 Intelligent accessing device identification system based on RS 485 industrial bus
CN105515615A (en) * 2016-01-12 2016-04-20 浙江共同电子科技有限公司 Power line carrier communication method
CN106055497A (en) * 2016-06-02 2016-10-26 广东盈科电子有限公司 Communication method of circuit board and circuit board
CN106293857A (en) * 2016-08-31 2017-01-04 成都国蓉科技有限公司 A kind of wireless mode carries out the method for software upgrading
CN109374935A (en) * 2018-11-28 2019-02-22 武汉精能电子技术有限公司 A kind of electronic load parallel operation method and system
CN110519136A (en) * 2019-07-10 2019-11-29 大城绿川(深圳)科技有限公司 A kind of RS485 multi-machine communication system of adaptive networking
CN110519136B (en) * 2019-07-10 2021-06-29 大城绿川(深圳)科技有限公司 RS485 multi-machine communication system capable of achieving self-adaptive networking
CN111431668B (en) * 2020-04-22 2021-04-06 珠海格力电器股份有限公司 Baud rate switching method based on multi-node UART communication, air conditioning system and processor
CN111431668A (en) * 2020-04-22 2020-07-17 珠海格力电器股份有限公司 Baud rate switching method based on multi-node UART communication, air conditioning system and processor
CN114095145A (en) * 2020-07-31 2022-02-25 青岛海尔电冰箱有限公司 Half-duplex communication method for refrigerator and refrigerator
CN114095145B (en) * 2020-07-31 2023-07-14 青岛海尔电冰箱有限公司 Half-duplex communication method for refrigerator and refrigerator
CN112422233A (en) * 2020-10-27 2021-02-26 深圳Tcl新技术有限公司 Device communication method, communication device, and computer-readable storage medium
CN112291130A (en) * 2020-12-03 2021-01-29 国创新能源汽车智慧能源装备创新中心(江苏)有限公司 Networking system and method of field bus
CN114189466A (en) * 2021-01-21 2022-03-15 青岛鼎信通讯股份有限公司 Method for detecting local maintenance interface communication mode of low-voltage power acquisition terminal
CN113259169A (en) * 2021-06-01 2021-08-13 武汉慧联无限科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114978799A (en) * 2022-05-26 2022-08-30 深圳市声天下科技有限公司 Audio system communication control method
WO2024002325A1 (en) * 2022-07-01 2024-01-04 北京比特大陆科技有限公司 Positioning method for faulty chip on computing device, device, and storage medium

Similar Documents

Publication Publication Date Title
CN103916284A (en) RS485 communication interface automatic baud rate and communication address detection method
CN104079677A (en) Automatic allocation method of RS485 communication port address
CN102053935A (en) MODBUS serial communication protocol-based communication method
CN103391629A (en) Reference signal configuration method and system
CN109639366A (en) Signal pulsewidth modulation and demodulation method based on dual-wire bus communication
CN102938744B (en) A kind of implementation method of universal serial transceiver
CN1949734B (en) Power supply two-line system real-time bus communication method
CN103186440A (en) Method, device and system for detecting in-place state of sub cards
CN110635982B (en) Double-host communication method and system on communication bus, industrial control gateway and storage medium
CN106452894B (en) Failure connecting detection method and apparatus
CN107288624A (en) A kind of underground high speed data bus device suitable for acoustic logging instrument
CN104763413A (en) Data bus, system and data transmission method for underground logging instruments
CN207968522U (en) A kind of RS485 bus driving circuits for realizing multi-host communication mode
CN107241162A (en) A kind of data transmission method and device
CN104239255A (en) Universal data converter and method for Wiegand bus
CN201867627U (en) System based on CAN bus for detecting breakdown signals of numerical control machine tool
CN203722640U (en) Electric loopback light module
CN201947266U (en) Light module management system and light module
CN204390224U (en) A kind of fault-tolerant master-slave synchronisation serial communication system based on FPGA
CN113992471B (en) Communication system and method for multiple hosts and multiple slaves
CN109802877A (en) A kind of CAN bus based Communication System Design
EP1305922B1 (en) Ground level shift detection in can systems
CN104216854B (en) The path Autonomous adaptation device and method that a kind of UART serial ports is expanded
CN102868583A (en) FlexRay bus joint with fault diagnosis function
CN104572537A (en) Fault-tolerant master-slave synchronization serial communication system based on FPGA

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20140709