[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN105759691A - Master-slave switching communication method and system implemented through 485 port - Google Patents

Master-slave switching communication method and system implemented through 485 port Download PDF

Info

Publication number
CN105759691A
CN105759691A CN201610242731.6A CN201610242731A CN105759691A CN 105759691 A CN105759691 A CN 105759691A CN 201610242731 A CN201610242731 A CN 201610242731A CN 105759691 A CN105759691 A CN 105759691A
Authority
CN
China
Prior art keywords
master controller
master
wifi module
instruction
main frame
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.)
Granted
Application number
CN201610242731.6A
Other languages
Chinese (zh)
Other versions
CN105759691B (en
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.)
Guangdong PHNIX Eco Energy Solution Ltd
Original Assignee
Guangdong PHNIX Eco Energy Solution 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 Guangdong PHNIX Eco Energy Solution Ltd filed Critical Guangdong PHNIX Eco Energy Solution Ltd
Priority to CN201610242731.6A priority Critical patent/CN105759691B/en
Publication of CN105759691A publication Critical patent/CN105759691A/en
Application granted granted Critical
Publication of CN105759691B publication Critical patent/CN105759691B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • 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/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4022Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Small-Scale Networks (AREA)
  • Computer And Data Communications (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Selective Calling Equipment (AREA)

Abstract

The invention discloses a master-slave switching communication method and system implemented through a 485 port. The method includes the steps: connecting a master controller with an external device and a wifi module at the same time through one 485 port; setting the master controller as a host computer and the external devices as a slave computer, and controlling the master controller to send a command to the external device at specific intervals; switching the master controller as the salve computer, switching the wifi module as the master computer, and controlling the wifi module to send a command to the master controller; and according to the received command, communicating between the master controller and the wifi module. The system comprises a connection unit, a setting unit, a switching unit and a command response unit. The master-slave switching communication method and system implemented through a 485 port only require one 485 port to realize two master-slave modes after performing master-slave switching so as to reduce the price of the master controller and reduce the size of the master controller at the same time. And the wifi module can directly communicate with the host computer after the external device gives a response, so that the speed for data synchronization is greatly improved. The master-slave switching communication method and system implemented through a 485 port can be widely applied to the heat pump field.

Description

A kind of master-slave swap communication means existing by 485 causes for gossip and system
Technical field
The present invention relates to communication technical field, particularly relate to a kind of master-slave swap communication means existing by 485 causes for gossip and system.
Background technology
In heat pump product, for realizing communicating reliably under relatively remote with master controller, generally integrated 485 chips on master controller, realize 485 communications with this;And in conventional heat pump product, generally there are two kinds of master slave systems:
Mode 1: master controller is as main frame, and external color screen is as from machine, and color screen waits master controller commands and replys;
Mode 2: master controller is as from machine, and external Centralized Controller is as main frame, and master controller waits centralized control command and replys.
Above two mode, traditional method must lay respectively in 485 different ports, as: No. 1 485 ports adopt mode 1, No. 2 485 ports adopt mode 2, because of in 485 buses, can only there is a main frame in regulation, otherwise will cause communication abnormality simultaneously, so 485 port cannot realize the switching of master slave mode.
Summary of the invention
In order to solve above-mentioned technical problem, it is an object of the invention to provide one and can save port, and accelerate a kind of existing by 485 causes for gossip master-slave swap communication means and the system of synchronizing speed.
The technical solution used in the present invention is:
A kind of master-slave swap communication means existing by 485 causes for gossip, comprises the following steps:
A, master controller is simultaneously connected with external equipment and wifi module by 485 ports;
B, master controller being set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
C, being switched to by master controller from machine, wifi module switches to main frame, and controls wifi module and send a command to master controller;
D, master controller communicate according to the instruction received and wifi module.
As the further improvement of described a kind of existing by 485 causes for gossip master-slave swap communication means, described step C includes:
C1, master controller switch to from machine after sending instruction, and poll waits the instruction of wifi module;
Whether C2, detection external equipment have responded and have terminated, and if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then step C2 is re-executed.
As the further improvement of described a kind of existing by 485 causes for gossip master-slave swap communication means, described step D includes:
Whether D1, detection master controller receive the wifi instruction sended over, and are if so, then switched to main frame;Otherwise, then step D1 is re-executed;
Wifi module is sent corresponding instruction according to the instruction received and communicates by D2, master controller.
Of the present invention another solution is that
A kind of master-slave swap communication system existing by 485 causes for gossip, including:
Connect unit, for master controller is simultaneously connected with external equipment and wifi module by 485 ports;
Arranging unit, for master controller is set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
Switch unit, for switching to from machine by master controller, wifi module switches to main frame, and controls wifi module and send a command to master controller;
Instruction response unit, communicates according to the instruction received and wifi module for master controller.
As the further improvement of described a kind of existing by 485 causes for gossip master-slave swap communication system, described switch unit includes:
Poll units, switches to from machine for master controller after sending instruction, and poll waits the instruction of wifi module;
Whether response detection unit, be used for detecting external equipment and responded and terminate, if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then response detection unit is re-executed.
As the further improvement of described a kind of existing by 485 causes for gossip master-slave swap communication system, described instruction response unit includes:
Instruction detection unit, for detecting whether master controller receives the wifi instruction sended over, is if so, then switched to main frame;Otherwise, then instruction detection unit is re-executed;
Communication unit, sends corresponding instruction according to the instruction received to wifi module for master controller and communicates.
The invention has the beneficial effects as follows:
A kind of master-slave swap communication means existing by 485 causes for gossip of the present invention and system are by carrying out master-slave swap to master controller, have only to 485 ports, two kinds of master slave modes can be realized such that it is able to reduce the use of 485 chips, reduce master controller size reducing master controller price simultaneously.And the present invention by using wifi module as main frame, when exist data update need to carry out data syn-chronization with master controller time, wifi module, after waiting the response of current external equipment, just directly and main-machine communication, can be greatly improved the speed of data syn-chronization.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described further:
Fig. 1 is the flow chart of steps of a kind of master-slave swap communication means existing by 485 causes for gossip of the present invention;
Fig. 2 is the flow chart of steps of a kind of master-slave swap communication means step C existing by 485 causes for gossip of the present invention;
Fig. 3 is the flow chart of steps of a kind of master-slave swap communication means step D existing by 485 causes for gossip of the present invention;
Fig. 4 is the block diagram of a kind of master-slave swap communication system existing by 485 causes for gossip of the present invention.
Detailed description of the invention
With reference to Fig. 1, a kind of master-slave swap communication means existing by 485 causes for gossip of the present invention, comprise the following steps:
A, master controller is simultaneously connected with external equipment and wifi module by 485 ports;
B, master controller being set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
C, being switched to by master controller from machine, wifi module switches to main frame, and controls wifi module and send a command to master controller;
D, master controller communicate according to the instruction received and wifi module.
With reference to Fig. 2, being further used as preferred embodiment, described step C includes:
C1, master controller switch to from machine after sending instruction, and poll waits the instruction of wifi module;
Whether C2, detection external equipment have responded and have terminated, and if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then step C2 is re-executed.
Wherein, the responsive state whether having responded end by detecting external equipment can effectively prevent communication contention aware, improves the reliability of communication.
With reference to Fig. 3, being further used as preferred embodiment, described step D includes:
Whether D1, detection master controller receive the wifi instruction sended over, and are if so, then switched to main frame;Otherwise, then step D1 is re-executed;
Wifi module is sent corresponding instruction according to the instruction received and communicates by D2, master controller.
In the specific embodiment of the invention, hardware still uses 485 chip ports being integrated on master controller, software uses the ModBus agreement of industrial standard, described external equipment adopts color screen, master controller is simultaneously connected with a color screen and a wifi module on 485 ports, it is achieved switch the communication mode of master slave mode in communication process.
The present embodiment is specific as follows:
S1, master controller are as main frame, and color screen is as from machine.Every the specific time, master controller sends instructions to color screen, communicates;Wherein, in the present embodiment, special time is 360ms;
S2, first time color screen respond after, to second time master controller send instructions to color screen, there is one section of specific interval----360ms, utilization carry out master-slave swap during this period of time.
After S3, master controller have sent instruction, switching to slave mode immediately, poll waits wifi module instruction;
S4, wifi module detection color screen responsive state, response switches to main frame after terminating, and sends instructions to master controller;
S5, at master controller as, after receiving host command from machine, not carrying out instruction response;Wherein, have modified inquiry--the response mechanism of tradition ModBus agreement here, but instruction wifi module sended over is as trigger mechanism, after receiving instruction, master controller switches to main frame at once again.
After S6, master controller switch to main frame, carry out instruction transmission accordingly according to the instruction received in slave mode;As, under slave mode, receiving 03 instruction of wifi module, then send 10 instructions to wifi module immediately after switching to main frame, read operation, wifi module responds;
In the present embodiment, 03 instruction is reading instruction, represents main frame and inquires about from machine, replys relevant information from machine response;10 instructions are write command, represent main frame and write from machine, accept relevant information from machine.
After S7, master controller and wifi module sign off, wait that 360ms terminates, continue and color screen communication, enter second time circulation.
Reference Fig. 4, a kind of master-slave swap communication system existing by 485 causes for gossip of the present invention, including:
Connect unit, for master controller is simultaneously connected with external equipment and wifi module by 485 ports;
Arranging unit, for master controller is set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
Switch unit, for switching to from machine by master controller, wifi module switches to main frame, and controls wifi module and send a command to master controller;
Instruction response unit, communicates according to the instruction received and wifi module for master controller.
Being further used as preferred embodiment, described switch unit includes:
Poll units, switches to from machine for master controller after sending instruction, and poll waits the instruction of wifi module;
Whether response detection unit, be used for detecting external equipment and responded and terminate, if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then response detection unit is re-executed.
Being further used as preferred embodiment, described instruction response unit includes:
Instruction detection unit, for detecting whether master controller receives the wifi instruction sended over, is if so, then switched to main frame;Otherwise, then instruction detection unit is re-executed;
Communication unit, sends corresponding instruction according to the instruction received to wifi module for master controller and communicates.
From the foregoing it can be that a kind of master-slave swap communication means existing by 485 causes for gossip of the present invention and system are by carrying out master-slave swap to master controller, solve the problem that in traditional mode, 485 ports can only exist a kind of master slave mode.Have only to 485 ports, two kinds of master slave modes can be realized such that it is able to reduce the use of 485 chips, reduce master controller size reducing master controller price simultaneously.And the present invention by using wifi module as main frame, when exist data update need to carry out data syn-chronization with master controller time, wifi module, after waiting the response of current external equipment, just directly and main-machine communication, can be greatly improved the speed of data syn-chronization.
It is above the preferably enforcement of the present invention has been illustrated, but the invention is not limited to described embodiment, those of ordinary skill in the art also can make all equivalent variations or replacement under the premise without prejudice to spirit of the present invention, and these equivalent deformation or replacement are all contained in the application claim limited range.

Claims (6)

1. one kind is passed through the master-slave swap communication means that 485 causes for gossip are existing, it is characterised in that comprise the following steps:
A, master controller is simultaneously connected with external equipment and wifi module by 485 ports;
B, master controller being set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
C, being switched to by master controller from machine, wifi module switches to main frame, and controls wifi module and send a command to master controller;
D, master controller communicate according to the instruction received and wifi module.
2. a kind of master-slave swap communication means existing by 485 causes for gossip according to claim 1, it is characterised in that: described step C includes:
C1, master controller switch to from machine after sending instruction, and poll waits the instruction of wifi module;
Whether C2, detection external equipment have responded and have terminated, and if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then step C2 is re-executed.
3. a kind of master-slave swap communication means existing by 485 causes for gossip according to claim 1, it is characterised in that: described step D includes:
Whether D1, detection master controller receive the wifi instruction sended over, and are if so, then switched to main frame;Otherwise, then step D1 is re-executed;
Wifi module is sent corresponding instruction according to the instruction received and communicates by D2, master controller.
4. one kind is passed through the master-slave swap communication system that 485 causes for gossip are existing, it is characterised in that including:
Connect unit, for master controller is simultaneously connected with external equipment and wifi module by 485 ports;
Arranging unit, for master controller is set to main frame, external equipment is set to from machine, then controls master controller every special time and sends a command to external equipment;
Switch unit, for switching to from machine by master controller, wifi module switches to main frame, and controls wifi module and send a command to master controller;
Instruction response unit, communicates according to the instruction received and wifi module for master controller.
5. a kind of master-slave swap communication system existing by 485 causes for gossip according to claim 4, it is characterised in that: described switch unit includes:
Poll units, switches to from machine for master controller after sending instruction, and poll waits the instruction of wifi module;
Whether response detection unit, be used for detecting external equipment and responded and terminate, if so, wifi module then switches to main frame, and sends a command to master controller;Otherwise, then response detection unit is re-executed.
6. a kind of master-slave swap communication system existing by 485 causes for gossip according to claim 4, it is characterised in that: described instruction response unit includes:
Instruction detection unit, for detecting whether master controller receives the wifi instruction sended over, is if so, then switched to main frame;Otherwise, then instruction detection unit is re-executed;
Communication unit, sends corresponding instruction according to the instruction received to wifi module for master controller and communicates.
CN201610242731.6A 2016-04-18 2016-04-18 A kind of the master-slave swap communication means and system existing by 485 causes for gossip Active CN105759691B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610242731.6A CN105759691B (en) 2016-04-18 2016-04-18 A kind of the master-slave swap communication means and system existing by 485 causes for gossip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610242731.6A CN105759691B (en) 2016-04-18 2016-04-18 A kind of the master-slave swap communication means and system existing by 485 causes for gossip

Publications (2)

Publication Number Publication Date
CN105759691A true CN105759691A (en) 2016-07-13
CN105759691B CN105759691B (en) 2018-11-20

Family

ID=56334081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610242731.6A Active CN105759691B (en) 2016-04-18 2016-04-18 A kind of the master-slave swap communication means and system existing by 485 causes for gossip

Country Status (1)

Country Link
CN (1) CN105759691B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294236A (en) * 2016-08-25 2017-01-04 广东迪奥技术有限公司 A kind of communication means based on RS485, device and communication system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556608A (en) * 2004-01-05 2004-12-22 中兴通讯股份有限公司 Method of realizing RS485 master slave multi machine communication using universal asynchronous recerver transmitter
US20040267991A1 (en) * 2003-06-30 2004-12-30 Delaney William P. Transparent switch
CN2814220Y (en) * 2005-07-13 2006-09-06 广州邦讯信息系统有限公司 Inter-double main machines switching communicating device with inter secondary machines in data communication
CN101083559A (en) * 2007-06-22 2007-12-05 中兴通讯股份有限公司 Method and system for switching master control module and slave control module

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040267991A1 (en) * 2003-06-30 2004-12-30 Delaney William P. Transparent switch
CN1556608A (en) * 2004-01-05 2004-12-22 中兴通讯股份有限公司 Method of realizing RS485 master slave multi machine communication using universal asynchronous recerver transmitter
CN2814220Y (en) * 2005-07-13 2006-09-06 广州邦讯信息系统有限公司 Inter-double main machines switching communicating device with inter secondary machines in data communication
CN101083559A (en) * 2007-06-22 2007-12-05 中兴通讯股份有限公司 Method and system for switching master control module and slave control module

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294236A (en) * 2016-08-25 2017-01-04 广东迪奥技术有限公司 A kind of communication means based on RS485, device and communication system
CN106294236B (en) * 2016-08-25 2018-12-04 广东迪奥技术有限公司 A kind of communication means based on RS485, device and communication system

Also Published As

Publication number Publication date
CN105759691B (en) 2018-11-20

Similar Documents

Publication Publication Date Title
EP3098678B1 (en) Method and system for interacting master and slave information in real time
US20110239022A1 (en) Communication apparatus and method of controlling the same
CN107391419A (en) Support the universal serial bus hub equipment of more main frames and automobile-used main frame
CN110419035B (en) USB host-to-host automatic switching
CN104009976A (en) Real-time communication method and equipment used among multiple main station systems
CN110896372B (en) I2C link switching method, terminal and storage medium
CN108873798B (en) Programmable logic controller
CN115941102B (en) Method for synchronous communication between controllers connected with MCU and FPGA by SPI
CN101751012B (en) Device and method for realizing communication of direct current cabinet and host computer based on communication supervisor
CN110138761B (en) MIPI (Mobile industry processor interface) protocol-based inter-device communication method and equipment topological structure
CN101154209A (en) Principal controller pin multiplex circuit and control method thereof
CN105759691A (en) Master-slave switching communication method and system implemented through 485 port
US20160357194A1 (en) Method of controlling inverters
US20230205870A1 (en) Control instruction processing method, apparatus and device, and computer storage medium
CN201335976Y (en) Device for realizing communication between direct current panel and host computer based on communication manager
CN212324117U (en) RS485 bus multi-host competition switching system
CN101908025A (en) Serial use-right control device and method
CN209029000U (en) Engineering machinery display screen, engineering machinery and project monitor and control system
CN210986125U (en) Embedded industrial control all-in-one machine
CN110445642B (en) Communication method for maintaining flight parameter system across buses
CN110995613B (en) System and method for eliminating EtherCAT communication period jitter
CN216562331U (en) Double-sided screen control system based on BS framework
JP2001320390A (en) Device and method for controlling serial bus
CN112659128A (en) Robot brain and human-computer cooperative control brain parallel cooperative control method
CN115794719A (en) Backboard bus system, control method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant