CN107193697A - A kind of method for realizing the nonpolarity connections of RS485 - Google Patents

A kind of method for realizing the nonpolarity connections of RS485 Download PDF

Info

Publication number
CN107193697A
CN107193697A CN201710310249.6A CN201710310249A CN107193697A CN 107193697 A CN107193697 A CN 107193697A CN 201710310249 A CN201710310249 A CN 201710310249A CN 107193697 A CN107193697 A CN 107193697A
Authority
CN
China
Prior art keywords
chips
polarity
nonpolarity
com1
com2
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
CN201710310249.6A
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.)
Xian Electronic Engineering Research Institute
Original Assignee
Xian Electronic Engineering Research Institute
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 Xian Electronic Engineering Research Institute filed Critical Xian Electronic Engineering Research Institute
Priority to CN201710310249.6A priority Critical patent/CN107193697A/en
Publication of CN107193697A publication Critical patent/CN107193697A/en
Pending legal-status Critical Current

Links

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/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
    • G06F13/4286Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a handshaking protocol, e.g. RS232C link
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test buses, lines or interfaces, e.g. stuck-at or open line faults
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C29/08Functional testing, e.g. testing during refresh, power-on self testing [POST] or distributed testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Communication Control (AREA)

Abstract

The present invention relates to a kind of nonpolarity connection method of RS485 serial communications, hardware aspect only need to increase a piece of corresponding RS485 chips in receiving terminal, to reach that two chips of identical RS 485 are received simultaneously, it is connected on signal transmssion line the differential received end opposite polarity of two chips, hardware design is simple, with low cost;Increase corresponding software in slave, polarity is not only performed to judge that automatic polarity switch can also be carried out, if in data proper communication, exist main frame restart, the communication abnormality situation such as order wire reclosing when, software reset can also be made by house dog, rejudge polarity, new state is adapted to automatically, without manual intervention, the operating efficiency and reliability of system are improved.

Description

A kind of method for realizing the nonpolarity connections of RS485
Technical field
The invention belongs to product design and detection method, it is related to a kind of method for realizing the nonpolarity connections of RS485.
Background technology
RS -485 is passed as international serial communication standard with its simple in construction, cheap, communication distance and data The features such as defeated speed is appropriate, is widely applied in many TT&C systems.RS-485 is using two data lines using flat The mode that weighing apparatus formula is sent, differential type is received realizes communication, and two data lines are polarized differences in connection, if reversed, It will result in system work abnormal.Current RS485 nonpolarity connection solution mainly has three kinds, and one kind is that hardware judges Artificial correction method, this method uses in the transmitting terminal and ground of module, adds LED light between receiving terminal and ground, passes through LED instruction distinguishes polarity and changes line by artificial toggle switch, and this solution has the following disadvantages:Not only need Technical staff participates in debugging and corrected, construction inconvenience, and sending module can not send data in adjustment;Second is that software is sentenced Break automatic revised law, and this mode is to send a test signal by main frame, if not receiving slave in setting time Response, just illustrates false circuit connection, so-called automatic amendment is exactly that main frame changes connecting line polarity tested RQ signal, and is changed Connecting line polarity is to change the side of a double-point double-throw switch by methods such as relay, solid state analogue switches or electronic switches To this solution has the following disadvantages:Need to increase the hardware circuit such as relay or switch, also increase software control Complexity;The third is to use Manchester's code method, i.e., carry out signal achievable nonpolarity after Differential Manchester Encoding Connection, it can be seen from Differential Manchester Encoding principle, wiring error becomes after anti-phase waveform signal, can still demodulate original Beginning data-signal, this solution has the following disadvantages:Need to add coding circuit reconciliation between UART and RS485 chips Code circuit, while needing synchronous clock signal.From described above, though three kinds of methods can realize that RS485's is nonpolarity Connection, but all come with some shortcomings.
The content of the invention
The technical problem to be solved
In order to avoid the shortcomings of the prior art, the present invention proposes a kind of nonpolarity connection side of RS485 serial communications Method, this method is taken increases a corresponding RS485 chip in receiving terminal, increases corresponding polarity judgement in slave and switches soft Part, so as to realize the nonpolarity connection of RS485 wiring, if while in data proper communication, exist main frame restart, order wire During the communication abnormality situation such as reclosing, software can also rejudge polarity automatically, adapt to new state, it is not necessary to manual intervention, Improve the operating efficiency and reliability of system.
Technical scheme
A kind of method for realizing the nonpolarity connections of RS485, it is characterised in that the RS-485 chips D1 of transmitting terminal is constant, is connecing Receiving end is received simultaneously using two identical RS-485 chips D2 and D3, is connected to the differential received end opposite polarity of two chips On signal transmssion line, i.e., D2 A ends are connected with D3 B ends, D2 B ends are connected with D3 A ends;The D1 of transmitting terminal and control are System constitutes main frame, and the D2 and D3 and control system of receiving terminal constitute slave;Step is as follows:
Step 1:Main frame actively sends synchronization character, as the D2 and D3 of receiving terminal Enable Pin/RE=0, during DE=0, receives Enable effectively, now slave receives serial data from data wire, and receiving terminal two 485 serial port chips D2 and D3 are defined here Serial ports is respectively COM1 and COM2;
Step 2:Slave presets COM port or COM device or COM1 work first, and COM2 mouthfuls leave unused;COM port or COM device or COM1 data are read, to the synchronization character received Judged, to synchronous word count in fixed duration, if count value meets sets requirement, judging the connection of hardware polarity just Often, i.e., corresponding 485 chip of COM port or COM device or COM1 is in normal operating conditions, at this moment carries out data and collects, handles;If at one Enough synchronization character information can not be detected in detection cycle, then it is assumed that serial data polarity is wrong, active switch polarity is arrived COM2 mouthfuls, equally to synchronous word count in fixed duration, differentiate whether COM2 mouthfuls of corresponding 485 chips are in normal work shape State;
Step 4:Alternately test and judge between COM1 and COM2, require then to be transferred to normal work shape until meeting State.
Fixation duration in step 2 is set to 3s.
The sets requirement of count value in step 2 is 55.
Described control system is computer or single-chip microcomputer.
Beneficial effect
A kind of nonpolarity connection method of RS485 serial communications proposed by the present invention, makes only increase few in this way Perhaps software and hardware is achieved that non-polar connection, and system has the function that auto polarity judges and serial ports switches, it is not necessary to adopt It is attached with the twisted-pair feeder for having mark, it is not necessary to increase the higher hardware circuit of the costs such as relay, it is not required that technology people Member participates in debugging and corrected, and drastically increases stability, reliability and the efficiency of system work.
Brief description of the drawings
Fig. 1 RS -485 routine connected modes
Connected mode that Fig. 2 RS -485 are nonpolarity
Fig. 3 serial communication systems composition figure
Fig. 4 softwares polarity judges and switching flow figure
Embodiment
The problem of solving as needed, realizes that this method needs hardware and software to coordinate completion.Hardware is increased in slave Plus a corresponding RS485 chip, complete the connection with serial port of host computer;Software complete the connection of RS485 interfaces polarity discriminating and Automatic amendment.
The data-signal of RS -485 standards uses differential transfer mode, also referred to as balance transmission, and it uses a pair of twisted-pair feeders, A wherein line is defined as A, another line is defined as B, it is generally the case that transmitting terminal and receiving terminal by balancing twisted-pair line by A-A, B-B correspondences are connected, as shown in Figure 1.When there is level (the i.e. V more than+200mV between receiving terminal A-BA-VB>=200Mv) when, it is defeated Go out for positive logic level " 0 ";(V during less than -200mVA-VB≤ -200Mv), be output as negative logic level " 1 ", when 200Mv >= VA-VBDuring >=-200Mv, indeterminate state is output as.
Nonpolarity connection is solved, transmitting terminal is constant, is received simultaneously using two identical RS-485 chips in receiving terminal, two It is connected on signal transmssion line, i.e., by the A ends of a chip and the B of another chip the differential received end opposite polarity of chip End is connected, and B ends are connected with another A ends, as shown in Figure 2.
The software aspects present invention point slave network structure, main frame actively sends synchronization character with fixed frequency, and slave is certainly Data are received on data wire, if enough synchronization character information can not be detected in a detection cycle, then it is assumed that serial ports Data polarity is wrong, active switch polarity, continues to intercept.
If in data proper communication, exist main frame restart, the communication abnormality situation such as order wire reclosing when, slave To make software reset by house dog, polarity is rejudged, new state is adapted to automatically.
As a kind of conventional communication interface chip, many semiconductor companies are all in production, and pin is completely compatible, together When compatible industry standard specifications.So, the product of which producer is not limited to here, is uniformly called RS485 chips, is done versatility Description.In addition, because RS485 is transmitted in both directions, transmitting terminal is also simultaneously receiving terminal, and our this serial communications is nonpolarity Connection method simply takes measures in slave, so only doing unicity description here.Transmitted in both directions is similarly.
In conjunction with embodiment, accompanying drawing, the invention will be further described:
Fig. 3 is that serial communication system constitutes figure.Reference picture 3, receiving terminal is by the Differential Input interconnection of two panels 485 one Rise, i.e., D2 A ends are connected with D3 B ends, D2 B ends are connected with D3 A ends, RS485 input DI and control end/RE, Control end DE, and system output RO are connected with control system.Control system can be that single-chip microcomputer, computer etc. can be to controls End/RE, DE carries out transmitting-receiving control, can send data and the system for receiving data.Resistance R1, R2 are to prevent remote biography Reflection and interference when defeated in transmission line, are typically added in the build-out resistor between signal wire AB.
Software aspects, main frame (RS485 for including control system and transmitting terminal) actively sends synchronization character, when receiver (connects 2 RS485 of receiving end) Enable Pin/RE=0, during DE=0, receive and enable effective, now slave (including control system and reception The RS485 at end) serial data is received from data wire, two 485 serial port chips (Fig. 3) D2 and D3 of receiving terminal string is defined here Mouth is respectively COM1 and COM2.Slave presets COM port or COM device or COM1 work first, and COM2 mouthfuls leave unused.COM port or COM device or COM1 data are read, to what is received Synchronization character judged, in fixed duration (such as 3s) to synchronous word count, if count value meets sets requirement (such as 55) it may determine that the connection of hardware polarity is normal, i.e., corresponding 485 chip of COM port or COM device or COM1 is in normal operating conditions, at this moment enters line number According to collecting, handle;If enough synchronization character information can not be detected in a detection cycle, then it is assumed that serial ports number Wrong according to polarity, active switch polarity is to COM2 mouthfuls, and equally (such as 3s), to synchronous word count, differentiates COM2 in fixed duration Whether corresponding 485 chip of mouth is in normal operating conditions.Alternately test and judge, Zhi Daoman between COM1 and COM2 Foot requires then to be transferred to normal operating conditions.
Software polarity judges that flow is as shown in Figure 4.

Claims (4)

1. a kind of method for realizing the nonpolarity connections of RS485, it is characterised in that the RS-485 chips D1 of transmitting terminal is constant, is being received End is received simultaneously using two identical RS-485 chips D2 and D3, is connected to letter the differential received end opposite polarity of two chips On number transmission line, i.e., D2 A ends are connected with D3 B ends, D2 B ends are connected with D3 A ends;The D1 and control system of transmitting terminal Main frame is constituted, the D2 and D3 and control system of receiving terminal constitute slave;Step is as follows:
Step 1:Main frame actively sends synchronization character, as the D2 and D3 of receiving terminal Enable Pin/RE=0, during DE=0, receives and enables Effectively, now slave receives serial data from data wire, and two 485 serial port chips D2 and D3 of receiving terminal serial ports are defined here Respectively COM1 and COM2;
Step 2:Slave presets COM port or COM device or COM1 work first, and COM2 mouthfuls leave unused;COM port or COM device or COM1 data are read, the synchronization character received is carried out Judge, to synchronous word count in fixed duration, if count value meets sets requirement, judge that the connection of hardware polarity is normal, i.e., Corresponding 485 chip of COM port or COM device or COM1 is in normal operating conditions, at this moment carries out data and collects, handles;If in a detection Enough synchronization character information can not be detected in cycle, then it is assumed that serial data polarity is wrong, active switch polarity to COM2 Mouthful, equally to synchronous word count in fixed duration, differentiate whether COM2 mouthfuls of corresponding 485 chips are in normal operating conditions;
Step 4:Alternately test and judge between COM1 and COM2, require then to be transferred to normal operating conditions until meeting.
2. a kind of method for realizing the nonpolarity connections of RS485 according to claim 1, it is characterised in that consolidating in step 2 Timing length is set to 3s.
3. a kind of method for realizing the nonpolarity connections of RS485 according to claim 1, it is characterised in that the meter in step 2 The sets requirement of numerical value is 55.
4. a kind of method for realizing the nonpolarity connections of RS485 according to claim 1, it is characterised in that described control system Unite as computer or single-chip microcomputer.
CN201710310249.6A 2017-05-05 2017-05-05 A kind of method for realizing the nonpolarity connections of RS485 Pending CN107193697A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710310249.6A CN107193697A (en) 2017-05-05 2017-05-05 A kind of method for realizing the nonpolarity connections of RS485

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710310249.6A CN107193697A (en) 2017-05-05 2017-05-05 A kind of method for realizing the nonpolarity connections of RS485

Publications (1)

Publication Number Publication Date
CN107193697A true CN107193697A (en) 2017-09-22

Family

ID=59873159

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710310249.6A Pending CN107193697A (en) 2017-05-05 2017-05-05 A kind of method for realizing the nonpolarity connections of RS485

Country Status (1)

Country Link
CN (1) CN107193697A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101362A (en) * 2018-06-28 2018-12-28 广州视源电子科技股份有限公司 Communication correction method, device, readable storage medium and slave
CN110069437A (en) * 2019-04-24 2019-07-30 大连理工大学 RS-485 polarity of bus adaptive approach based on response frame validity
CN110196828A (en) * 2019-05-28 2019-09-03 深圳市雷赛软件技术有限公司 Support the communicating circuit and the means of communication of RS485 half-duplex protocol
CN110247833A (en) * 2019-05-24 2019-09-17 珠海格力电器股份有限公司 Communication control method, device, sub-equipment and communication system
CN111835598A (en) * 2020-07-30 2020-10-27 贵州电网有限责任公司 Testing method and system compatible with non-polar 485 networking simulation
CN116126608A (en) * 2023-01-12 2023-05-16 北京众谊越泰科技有限公司 Test fixture system and method for multi-serial port monitoring host

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1962199A2 (en) * 2007-01-08 2008-08-27 O.Y.L. Research & Development Centre Sdn Bhd A communication apparatus
CN102394734A (en) * 2011-07-29 2012-03-28 四川长虹电器股份有限公司 RS 485 communication system with nonpolarized connection and control method thereof
CN203326979U (en) * 2013-07-09 2013-12-04 南京三能电力仪表有限公司 Non-polar-connection RS485 circuit

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1962199A2 (en) * 2007-01-08 2008-08-27 O.Y.L. Research & Development Centre Sdn Bhd A communication apparatus
CN102394734A (en) * 2011-07-29 2012-03-28 四川长虹电器股份有限公司 RS 485 communication system with nonpolarized connection and control method thereof
CN203326979U (en) * 2013-07-09 2013-12-04 南京三能电力仪表有限公司 Non-polar-connection RS485 circuit

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101362A (en) * 2018-06-28 2018-12-28 广州视源电子科技股份有限公司 Communication correction method, device, readable storage medium and slave
CN110069437A (en) * 2019-04-24 2019-07-30 大连理工大学 RS-485 polarity of bus adaptive approach based on response frame validity
CN110247833A (en) * 2019-05-24 2019-09-17 珠海格力电器股份有限公司 Communication control method, device, sub-equipment and communication system
CN110196828A (en) * 2019-05-28 2019-09-03 深圳市雷赛软件技术有限公司 Support the communicating circuit and the means of communication of RS485 half-duplex protocol
CN111835598A (en) * 2020-07-30 2020-10-27 贵州电网有限责任公司 Testing method and system compatible with non-polar 485 networking simulation
CN111835598B (en) * 2020-07-30 2023-08-22 贵州电网有限责任公司 Test method and system compatible with polarity 485 networking simulation
CN116126608A (en) * 2023-01-12 2023-05-16 北京众谊越泰科技有限公司 Test fixture system and method for multi-serial port monitoring host
CN116126608B (en) * 2023-01-12 2024-01-26 北京众谊越泰科技有限公司 Test fixture system and method for multi-serial port monitoring host

Similar Documents

Publication Publication Date Title
CN107193697A (en) A kind of method for realizing the nonpolarity connections of RS485
CN106453383B (en) UART-based master-slave multi-machine communication system and method
CN216596246U (en) Self-adaptive circuit compatible with multi-serial port protocol and communication equipment
CN202372976U (en) Switching circuit of time-share multiplexing serial port
CN106569976A (en) Serial port communication system and communication method
CN104317762A (en) Method for adaptively controlling transmitting and receiving directions of RS485 chip by aid of FPGA (field programmable gate array)
CN105159194A (en) Switching circuit and switching method for switching data receiving/sending operation of RS-485 serial port
CN114301732B (en) Circuit for realizing bus communication, bus communication system and power supply energy storage device
CN102882508A (en) Simple circuit for switching polarity of RS485 interface
CN210469301U (en) Serial port selection processing expansion system
KR101084060B1 (en) The data-transmittable non-polarity RS-485 communication device of BMS controller by automatic polarity discrimination
CN101882124B (en) RS422/485 double-use signal converter capable of automatically judging connector
CN101345681B (en) Operation method for connecting main unit of intelligent electric appliance through serial bus
CN101217523B (en) A serial communication signal repairing device and the corresponding method
CN107070547B (en) A kind of CPCI type gigabit Ethernet device with failure monitoring ability
CN201820120U (en) Self-adapting multibus execution mechanism controller
US6466989B1 (en) Automatic network connection device for wiring to network cable
CN209118135U (en) A kind of automobile-used CAN bus telecommunication circuit of electrical salf-walking
CN201114493Y (en) Interface circuit and TV set with this circuit
CN114839897A (en) Multi-interface, input and output configurable wiegand communication expansion board
CN112988642A (en) Reverse connection preventing method for serial port signals and switch switching circuit
CN1708027A (en) Method for transmitting Ethernet equipment duplex mode information
US11630795B2 (en) RS-485 circuit and communication system
CN221631961U (en) Intelligent switching circuit and industrial control equipment
CN112838972B (en) Enabling control method, device and equipment based on RS-485 transceiver and storage medium

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170922

WD01 Invention patent application deemed withdrawn after publication