CN104079677A - Automatic allocation method of RS485 communication port address - Google Patents

Automatic allocation method of RS485 communication port address Download PDF

Info

Publication number
CN104079677A
CN104079677A CN201310105745.XA CN201310105745A CN104079677A CN 104079677 A CN104079677 A CN 104079677A CN 201310105745 A CN201310105745 A CN 201310105745A CN 104079677 A CN104079677 A CN 104079677A
Authority
CN
China
Prior art keywords
slave
station number
main frame
slaves
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
CN201310105745.XA
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 CN201310105745.XA priority Critical patent/CN104079677A/en
Publication of CN104079677A publication Critical patent/CN104079677A/en
Pending legal-status Critical Current

Links

Landscapes

  • Communication Control (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses an automatic allocation method of an RS485 communication port address. According to the technical scheme, the method comprises the following steps: in a host and a plurality of slaves which are annularly connected in series, locking the rest of slaves except the first slave, and only allowing the first slave to receive and transmit information; transmitting a command to the first slave by the host, decoding and confirming a handshake protocol by the slave, and transmitting unlocking information and an own station number to a next slave; receiving the unlocking information and making a response by the next slave, setting the own station number as the received station number plus 1, and transmitting unlocking information and the own station number to a slave after the next slave; repeatedly transmitting the unlocking information and the station numbers of the slaves till the last slave; receiving the information about the last slave by the host, determining the quantity of online slaves and automatically allocating a communication address to each slave in order to finish address allocation of the RS485 communication port of each slave. By adopting the method, the communication port address can be allocated accurately and rapidly, extra overheads of hardware and software are avoided, and the reliability and rate of communication are ensured.

Description

The auto-allocation method of RS485 communication port address
Technical field
The present invention relates to a kind of auto-allocation method of RS485 communication port address.
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 surpasses chip nominal parameter on signal transmission distance or circuit, how to guarantee 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. a plurality of slaves of main frame band.
When RS485 communication network adopts half-duplex load mode, at a time can only there is a side to take bus, terminal A can only send information a certain moment, and terminal B can only receive information.In the identical situation of the station number of slave, main frame is difficult to the address of each slave of identification, and the information that main frame sends has many slave responses at synchronization, thereby has run counter to the communications protocol of RS485.
Solution to the problems described above has four kinds at present:
1), each slave arranges toggle switch and sets address;
2), by keyboard or man-machine interface, each slave addresses is set;
3), by computer serial ports software, each slave addresses is set one by one;
4), by slave, inquire about the state of bus, constantly wait for idle condition and host communication, if there is station number to conflict, deallocation.
Obviously first three methods labor intensive arranges, and is not easy to on-the-spot operation, and the 4th kind of method is consuming time serious, has a strong impact on the communication speed of RS485 PORT COM.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of auto-allocation method of RS485 communication port address, utilize this method can distribute quickly and accurately RS485 communication port address, conveniently realize writing to each other between slave, remove the overhead of software and hardware from, the error of occur disturbing while avoiding communication and causing, has guaranteed reliability and the speed of communication.
For solving the problems of the technologies described above, the method that RS485 communication port address of the present invention distributes automatically comprises the steps:
The communication topological structure that step 1, main frame are connected for annular with many slaves, except the First slave close with main frame, all the other slaves all adopt electronic lock to lock, and only First slave can receive and transmission information, and all the other slaves neither can receive and transmission information;
Step 2, main frame send order to First slave, First slave starts decoding after receiving main frame Handshake Protocol, when being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends electronic lock release information to next slave, and the station number of oneself is sent to next slave;
Step 3, next slave receive release information and also reply, and decoding is simultaneously replied and station number that this station number is set to receive adds 1, and this slave sends electronic lock release information to next slave again, and the station number of oneself is sent to next slave again;
Step 4, repeated execution of steps three are until last slave of annular series connection, and last slave is received after the station number of a slave, and the station number of a upper slave is added to 1 station number as oneself, and the station number of oneself is sent to main frame;
After the station number of last slave of step 5, the series connection of main frame reception annular, can determine at net slave number, to each slave, automatically distribute address, complete the address assignment of each slave RS485 PORT COM simultaneously.
Because the auto-allocation method of RS485 communication port address of the present invention has adopted technique scheme,, in the main frame and many slaves of the series connection of this method annular, except First slave, all the other slaves all lock, and only First slave can receive and transmission information; Main frame sends order to First slave, and First slave is decoded and confirmed Handshake Protocol, and sends release information and the station number of oneself is sent to next slave to next slave; Next slave receives release information and also replys, and the station number that this station number is set to receive adds 1, sends release information, and the station number of oneself is sent to next slave again to next slave again; Repeat to transmit release information and this slave station number until last slave; Main frame receives last to be determined at net slave number and to each slave and automatically distributes address from machine information, completes the address assignment of each slave RS485 PORT COM.This method can be distributed RS485 communication port address quickly and accurately, conveniently realizes writing to each other between slave, removes the overhead of software and hardware from, occur to disturb and the error that causes while avoiding communication, has guaranteed reliability and the speed of communication.
Accompanying drawing explanation
Below in conjunction with drawings and embodiments, the present invention is described in further detail:
Fig. 1 is the auto-allocation method theory diagram of RS485 communication port address of the present invention.
Embodiment
As shown in Figure 1, the method that RS485 communication port address of the present invention distributes automatically comprises the steps:
The communication topological structure that step 1, main frame are connected for annular with many slaves, except the First slave close with main frame, all the other slaves all adopt electronic lock to lock, and only First slave can receive and transmission information, and all the other slaves neither can receive and transmission information;
Step 2, main frame send order to First slave, First slave starts decoding after receiving main frame Handshake Protocol, when being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends electronic lock release information to next slave, and the station number of oneself is sent to next slave;
Step 3, next slave receive release information and also reply, and decoding is simultaneously replied and station number that this station number is set to receive adds 1, and this slave sends electronic lock release information to next slave again, and the station number of oneself is sent to next slave again;
Step 4, repeated execution of steps three are until last slave of annular series connection, and last slave is received after the station number of a slave, and the station number of a upper slave is added to 1 station number as oneself, and the station number of oneself is sent to main frame;
After the station number of last slave of step 5, the series connection of main frame reception annular, can determine at net slave number, to each slave, automatically distribute address, complete the address assignment of each slave RS485 PORT COM simultaneously.
This method is simple, easy operating, the slave of many annular series connection successively release and this station number is added to 1 after transfer to next slave, last slave transfers to main frame by this station number, main frame is determined at net slave number and is automatically distributed each slave RS485 communication port address by last slave station number, thereby realizing the automatic distribution of RS485 communication port address.
This method has overcome the defect that traditional RS485 communication port address distributes, the error that occurs while having avoided communication between slave to disturb and cause and reply conflict, remove the overhead of software and hardware in address assignment from, guaranteed reliability and the speed of communication between RS485 PORT COM.

Claims (1)

1. an auto-allocation method for RS485 communication port address, is characterized in that this method comprises the steps:
The communication topological structure that step 1, main frame are connected for annular with many slaves, except the First slave close with main frame, all the other slaves all adopt electronic lock to lock, and only First slave can receive and transmission information, and all the other slaves neither can receive and transmission information;
Step 2, main frame send order to First slave, First slave starts decoding after receiving main frame Handshake Protocol, when being confirmed to be main frame and sending to the Handshake Protocol of this slave, this slave sends electronic lock release information to next slave, and the station number of oneself is sent to next slave;
Step 3, next slave receive release information and also reply, and decoding is simultaneously replied and station number that this station number is set to receive adds 1, and this slave sends electronic lock release information to next slave again, and the station number of oneself is sent to next slave again;
Step 4, repeated execution of steps three are until last slave of annular series connection, and last slave is received after the station number of a slave, and the station number of a upper slave is added to 1 station number as oneself, and the station number of oneself is sent to main frame;
After the station number of last slave of step 5, the series connection of main frame reception annular, can determine at net slave number, to each slave, automatically distribute address, complete the address assignment of each slave RS485 PORT COM simultaneously.
CN201310105745.XA 2013-03-29 2013-03-29 Automatic allocation method of RS485 communication port address Pending CN104079677A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310105745.XA CN104079677A (en) 2013-03-29 2013-03-29 Automatic allocation method of RS485 communication port address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310105745.XA CN104079677A (en) 2013-03-29 2013-03-29 Automatic allocation method of RS485 communication port address

Publications (1)

Publication Number Publication Date
CN104079677A true CN104079677A (en) 2014-10-01

Family

ID=51600717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310105745.XA Pending CN104079677A (en) 2013-03-29 2013-03-29 Automatic allocation method of RS485 communication port address

Country Status (1)

Country Link
CN (1) CN104079677A (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834618A (en) * 2015-04-03 2015-08-12 深圳市美贝壳科技有限公司 Multi-equipment scanning method based on RS485 bus communication and power electronic system
CN104899174A (en) * 2015-04-10 2015-09-09 上海兆能电力电子技术有限公司 Method for automatically assigning addresses after plurality of photovoltaic inverters are connected in series
CN105260337A (en) * 2015-11-02 2016-01-20 深圳市共济科技有限公司 Automatic addressing method and system of single-chip microcomputers
CN105991788A (en) * 2015-03-04 2016-10-05 上海开通数控有限公司 Method for realizing slave network address assignment based on NFC communication
CN106873513A (en) * 2017-03-01 2017-06-20 深圳市亿维自动化技术有限公司 A kind of PLC system and its principal and subordinate link structure
CN107911493A (en) * 2017-10-31 2018-04-13 山东智造时代电气有限公司 Realize the method that the address of 485 equipment is distributed automatically in backstage
CN109374935A (en) * 2018-11-28 2019-02-22 武汉精能电子技术有限公司 A kind of electronic load parallel operation method and system
CN109756588A (en) * 2018-12-05 2019-05-14 国家电网有限公司 A kind of automatic distribution address system and method for RS485 communication
CN109993958A (en) * 2019-05-08 2019-07-09 深圳市共济科技股份有限公司 A kind of data collection system and method for RS485 bus
CN110267220A (en) * 2019-04-30 2019-09-20 泉州维盾电气有限公司 A kind of system and method for single host wireless device series connection networking data communication
CN110519136A (en) * 2019-07-10 2019-11-29 大城绿川(深圳)科技有限公司 A kind of RS485 multi-machine communication system of adaptive networking
CN110535980A (en) * 2019-08-30 2019-12-03 福州福沃垦电子科技有限公司 A kind of distribution method and system of terminal address
CN110534824A (en) * 2019-07-22 2019-12-03 大城绿川(深圳)科技有限公司 A kind of lead-acid accumulator on-line intelligence maintenance system of the RS485 communication based on adaptive networking
CN110774307A (en) * 2019-12-31 2020-02-11 汇网电气有限公司 Inflatable cabinet bending production line based on modular mechanical arm and module linkage method
CN111030906A (en) * 2019-12-12 2020-04-17 山东鼎维数字技术有限公司 Method for automatically addressing slave station address based on RS485 bus cascade
CN111147612A (en) * 2019-12-02 2020-05-12 杭州顿力电器有限公司 Fan group control address automatic allocation method based on position information
CN111835877A (en) * 2019-04-15 2020-10-27 町洋企业股份有限公司 Control system with multiple function modules and function module addressing method thereof
CN112055096A (en) * 2020-08-07 2020-12-08 深圳市克莱沃电子有限公司 Method and device for automatically setting communication address of equipment
CN113079075A (en) * 2021-04-16 2021-07-06 威胜集团有限公司 Cascade communication circuit, system and cascade communication automatic addressing method
CN113271244A (en) * 2021-04-09 2021-08-17 电子科技大学 RS485 bus ad hoc network full-duplex communication system and automatic address addressing method thereof
CN113286015A (en) * 2021-06-10 2021-08-20 北京华威创联科技有限公司 Method for automatically allocating address

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060282549A1 (en) * 2002-12-20 2006-12-14 Thomas Vinnemann Automatic addressing on bus systems
CN102347879A (en) * 2011-05-23 2012-02-08 大连理工计算机控制工程有限公司 D-BUS high-speed bus technology based on ring type Ethernet and auxiliary network
CN102354181A (en) * 2011-08-03 2012-02-15 韦自力 Control system based on field bus and method for addressing addresses for bus equipment
CN102868780A (en) * 2012-09-07 2013-01-09 深圳睿立方智能科技有限公司 RS-485 slave computer addressing network system and addressing method thereof
CN103001836A (en) * 2011-09-09 2013-03-27 施耐德电器工业公司 Serial communication method and serial communication system free of address allocation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060282549A1 (en) * 2002-12-20 2006-12-14 Thomas Vinnemann Automatic addressing on bus systems
CN102347879A (en) * 2011-05-23 2012-02-08 大连理工计算机控制工程有限公司 D-BUS high-speed bus technology based on ring type Ethernet and auxiliary network
CN102354181A (en) * 2011-08-03 2012-02-15 韦自力 Control system based on field bus and method for addressing addresses for bus equipment
CN103001836A (en) * 2011-09-09 2013-03-27 施耐德电器工业公司 Serial communication method and serial communication system free of address allocation
CN102868780A (en) * 2012-09-07 2013-01-09 深圳睿立方智能科技有限公司 RS-485 slave computer addressing network system and addressing method thereof

Cited By (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105991788A (en) * 2015-03-04 2016-10-05 上海开通数控有限公司 Method for realizing slave network address assignment based on NFC communication
CN104834618A (en) * 2015-04-03 2015-08-12 深圳市美贝壳科技有限公司 Multi-equipment scanning method based on RS485 bus communication and power electronic system
CN104834618B (en) * 2015-04-03 2018-03-13 深圳市美贝壳科技有限公司 A kind of more apparatus scanning methods and power electronic system based on RS485 bus communications
CN104899174A (en) * 2015-04-10 2015-09-09 上海兆能电力电子技术有限公司 Method for automatically assigning addresses after plurality of photovoltaic inverters are connected in series
CN104899174B (en) * 2015-04-10 2017-08-22 上海兆能电力电子技术有限公司 The method of the automatic distribution address of many series connection of photovoltaic DC-to-AC converter
CN105260337A (en) * 2015-11-02 2016-01-20 深圳市共济科技有限公司 Automatic addressing method and system of single-chip microcomputers
CN105260337B (en) * 2015-11-02 2018-03-02 深圳市共济科技股份有限公司 A kind of automatic addressing method and system of single-chip microcomputer
CN106873513A (en) * 2017-03-01 2017-06-20 深圳市亿维自动化技术有限公司 A kind of PLC system and its principal and subordinate link structure
CN107911493A (en) * 2017-10-31 2018-04-13 山东智造时代电气有限公司 Realize the method that the address of 485 equipment is distributed automatically in backstage
CN109374935A (en) * 2018-11-28 2019-02-22 武汉精能电子技术有限公司 A kind of electronic load parallel operation method and system
CN109756588A (en) * 2018-12-05 2019-05-14 国家电网有限公司 A kind of automatic distribution address system and method for RS485 communication
CN111835877A (en) * 2019-04-15 2020-10-27 町洋企业股份有限公司 Control system with multiple function modules and function module addressing method thereof
CN111835877B (en) * 2019-04-15 2023-08-15 町洋企业股份有限公司 Control system comprising a plurality of functional modules and method for addressing functional modules
CN110267220A (en) * 2019-04-30 2019-09-20 泉州维盾电气有限公司 A kind of system and method for single host wireless device series connection networking data communication
CN110267220B (en) * 2019-04-30 2021-11-02 泉州维盾电气有限公司 System and method for serial networking data communication of single-host wireless equipment
CN109993958A (en) * 2019-05-08 2019-07-09 深圳市共济科技股份有限公司 A kind of data collection system and method for RS485 bus
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
CN110534824A (en) * 2019-07-22 2019-12-03 大城绿川(深圳)科技有限公司 A kind of lead-acid accumulator on-line intelligence maintenance system of the RS485 communication based on adaptive networking
CN110534824B (en) * 2019-07-22 2022-10-21 大城绿川(深圳)科技有限公司 RS485 communication lead-acid storage battery online intelligent maintenance system based on self-adaptive networking
CN110535980A (en) * 2019-08-30 2019-12-03 福州福沃垦电子科技有限公司 A kind of distribution method and system of terminal address
CN111147612A (en) * 2019-12-02 2020-05-12 杭州顿力电器有限公司 Fan group control address automatic allocation method based on position information
CN111030906A (en) * 2019-12-12 2020-04-17 山东鼎维数字技术有限公司 Method for automatically addressing slave station address based on RS485 bus cascade
CN110774307B (en) * 2019-12-31 2020-04-28 汇网电气有限公司 Inflatable cabinet bending production line based on modular mechanical arm and module linkage method
CN110774307A (en) * 2019-12-31 2020-02-11 汇网电气有限公司 Inflatable cabinet bending production line based on modular mechanical arm and module linkage method
CN112055096A (en) * 2020-08-07 2020-12-08 深圳市克莱沃电子有限公司 Method and device for automatically setting communication address of equipment
CN112055096B (en) * 2020-08-07 2023-11-17 深圳市克莱沃电子有限公司 Method and device for automatically setting communication address of equipment
CN113271244A (en) * 2021-04-09 2021-08-17 电子科技大学 RS485 bus ad hoc network full-duplex communication system and automatic address addressing method thereof
CN113079075A (en) * 2021-04-16 2021-07-06 威胜集团有限公司 Cascade communication circuit, system and cascade communication automatic addressing method
CN113079075B (en) * 2021-04-16 2023-08-15 威胜集团有限公司 Cascade communication circuit, cascade communication system and cascade communication automatic addressing method
CN113286015A (en) * 2021-06-10 2021-08-20 北京华威创联科技有限公司 Method for automatically allocating address

Similar Documents

Publication Publication Date Title
CN104079677A (en) Automatic allocation method of RS485 communication port address
CN105743757B (en) The method of the free networking of RS485 communicating terminals
CN108733604B (en) 485 bus intelligent expansion method and device based on modbus communication protocol
CN104317765B (en) A kind of one-to-many communication system and implementation method based on serial communication
WO2018218885A1 (en) Rs485 communication system and method capable of avoiding conflict between master device and slave device
CN109756588A (en) A kind of automatic distribution address system and method for RS485 communication
CN102684923A (en) Self-healing networking method for half-duplex asynchronous communication
CN103716092A (en) Networking system and communication method for bidirectional optical fiber communication in bus network
CN103986610A (en) Communication interface matching method, device and controller
CN102740501A (en) wireless network access point sharing method
KR101850175B1 (en) Expansion Module for Programmable Logic Controller using USB Communication
CN207968522U (en) A kind of RS485 bus driving circuits for realizing multi-host communication mode
CN106874228A (en) Based on I2Communication means between the controller and communication means, multi-controller of C buses
CN104102607A (en) CAN (controlled area network) bus driving method and system based on VxWorks operating system environment
CN105991788A (en) Method for realizing slave network address assignment based on NFC communication
CN110456705B (en) Network control device capable of dynamically expanding interface and building automatic control system
CN104683209A (en) Coupling equipment between EtherCAT network main stations and EtherCAT network coupling system
CN110995889A (en) Address allocation system and method
CN101281510B (en) Double-I2C bus setting method and double I2C bus system
CN101902436A (en) Interplate communication method, device and system
CN102638589A (en) Determining method of corresponding connection relation of channels, as well as related connecting ends and system
CN102609388B (en) Slave node circuit, communication method and communication device
CN201820120U (en) Self-adapting multibus execution mechanism controller
CN209860929U (en) Communication bus structure
KR101857088B1 (en) Remote Input/output apparatus having return circuit and method for interfacing internal bus thereof

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: 20141001