CN112765075B - One-to-many communication method and system based on serial port - Google Patents
One-to-many communication method and system based on serial port Download PDFInfo
- Publication number
- CN112765075B CN112765075B CN202011630574.9A CN202011630574A CN112765075B CN 112765075 B CN112765075 B CN 112765075B CN 202011630574 A CN202011630574 A CN 202011630574A CN 112765075 B CN112765075 B CN 112765075B
- Authority
- CN
- China
- Prior art keywords
- host
- serial port
- slave
- communication
- polling
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2803—Home automation networks
- H04L12/2816—Controlling appliance services of a home automation network by calling their functionalities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2803—Home automation networks
- H04L12/2838—Distribution of signals within a home automation network, e.g. involving splitting/multiplexing signals to/from different paths
Landscapes
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Small-Scale Networks (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及一种基于串口的一对多通信方法及系统,属于串口通信技术领域。The invention relates to a one-to-many communication method and system based on a serial port, belonging to the technical field of serial port communication.
背景技术Background Art
通常多设备通信方式有:串口通信,例如RS-232口、串口、异步口或一个COM(通信)口;或者485通信。RS232接口的特点:只能点对点通信,不支持多点通信;RS485通信特点:具有多站通信能力,可以利用单一的RS485接口方便地建立起设备网络。Common multi-device communication methods include: serial communication, such as RS-232 port, serial port, asynchronous port or a COM (communication) port; or 485 communication. Characteristics of RS232 interface: only point-to-point communication, not supporting multi-point communication; Characteristics of RS485 communication: with multi-station communication capability, a single RS485 interface can be used to easily establish a device network.
在具体的应用领域,如何通过串口通信实现一个控制端、多个受控端的通信需求,是一需要解决的技术问题。例如授权公告号为CN 206441155 U的中国实用新型专利,公开了一种能够实现RS232一对多通信的控制电路,具体包括,RXD接收数据端包括接口驱动电路(SN75174的接口驱动芯片)和数据选择电路(CD4051开关电路);TXD发送数据端包括接收主控设备数据信息的接口缓冲器(SN75175的集成芯片)和数据分配器(74HCT245集成芯片);采用时分复用的方式,提高波特率,将多个受控端的RXD数据整合到一个RXD上送至控制端,再通过一个逆过程解出各个RXD数据信息,完成在多个控制端和多个受控端的情况下的RS232接口传输。In specific application fields, how to realize the communication needs of one control end and multiple controlled ends through serial communication is a technical problem that needs to be solved. For example, the Chinese utility model patent with the authorization announcement number CN 206441155 U discloses a control circuit that can realize RS232 one-to-many communication, specifically including: the RXD receiving data end includes an interface driver circuit (SN75174 interface driver chip) and a data selection circuit (CD4051 switch circuit); the TXD sending data end includes an interface buffer (SN75175 integrated chip) and a data distributor (74HCT245 integrated chip) for receiving data information of the master control device; the baud rate is increased by time division multiplexing, and the RXD data of multiple controlled ends are integrated into one RXD and sent to the control end, and then the data information of each RXD is decoded through an inverse process to complete the RS232 interface transmission in the case of multiple control ends and multiple controlled ends.
例如在智能家居领域,如何通过串口满足一个控制端、多个受控端的通信需求,也是亟需解决的技术问题。比如集成控制的多联面板(面板集成了开关、场景、窗帘、温控器等不同功能的控制器86单元,是一种最终以多功能控制、组合呈现的智能家居面板产品),其主控电路通常使用单片机作为主控芯片来控制,那么则需要设置多个串口分别与不同类型的控制器模块(开关、场景、温控器等86单元)通信,实现一个主控电路通过多个串口或者485芯片分别控制多个设备的通信方式。For example, in the field of smart home, how to meet the communication needs of one control end and multiple controlled ends through serial ports is also a technical problem that needs to be solved urgently. For example, the integrated control multi-link panel (the panel integrates 86 controller units with different functions such as switches, scenes, curtains, thermostats, etc., and is a smart home panel product that is ultimately presented with multi-function control and combination), its main control circuit usually uses a single-chip microcomputer as the main control chip to control, then it is necessary to set up multiple serial ports to communicate with different types of controller modules (86 units such as switches, scenes, thermostats, etc.), so as to realize the communication method of one main control circuit controlling multiple devices through multiple serial ports or 485 chips.
而在实际情况下,如果采用485通信方式满足一对多控制,会造成造价高,因为集成面板采用的单片机上无485通信,需要新增485芯片;如果采用串口通信,由于单片机上的串口有限,如果一个设备与多个设备通信,则需要采用串口数量多的单片机,成本也增加。In actual situations, if 485 communication is used to meet one-to-many control, it will result in high costs, because the microcontroller used in the integrated panel does not have 485 communication, and a new 485 chip needs to be added; if serial communication is used, due to the limited serial ports on the microcontroller, if one device communicates with multiple devices, a microcontroller with a large number of serial ports is required, which also increases the cost.
此外,在智能家居领域,上述集成控制的多联面板设计中,还存在以下问题:In addition, in the field of smart home, the above-mentioned integrated control multi-panel design still has the following problems:
不同场合使用的多联面板相应的定制需求差异较大,差异方面涉及:每个多联面板所包含的86单元类型不同(如开关、场景、插座、窗帘、温控器等)、86单元的排序不同、每个86单元的负载路数不同(如单开/双开/三开/四开)。The corresponding customization requirements of multi-gang panels used in different occasions vary greatly. The differences involve: the types of 86 units contained in each multi-gang panel are different (such as switches, scenes, sockets, curtains, thermostats, etc.), the order of the 86 units is different, and the number of load paths of each 86 unit is different (such as single-open/double-open/triple-open/quadruple-open).
硬件上不同设备(86单元)不能随意组合,每次增加新的86单元组合需要重新设计软件和硬件,耗费人力,增加成本且周期较长。Different devices (86 units) cannot be combined arbitrarily in hardware. Every time a new 86-unit combination is added, the software and hardware need to be redesigned, which consumes manpower, increases costs and takes a long time.
发明内容Summary of the invention
本发明的目的是提供一种基于串口的一对多通信方法及系统,用以解决现有一个控制端对多个受控端中实现一对多通信成本高的问题。The purpose of the present invention is to provide a one-to-many communication method and system based on a serial port, so as to solve the problem of high cost in realizing one-to-many communication between one control terminal and multiple controlled terminals.
为实现上述目的,本发明的方案包括:To achieve the above object, the solution of the present invention includes:
本发明的一种基于串口的一对多通信系统,包括主机和若干个从机以及收发线路;所述收发线路包括连接主机串口输出接口的输出线和连接主机串口输入接口的输入线;从机串口的输入接口连接所述输出线,从机串口的输出接口连接所述输入线;A one-to-many communication system based on a serial port of the present invention comprises a host, a plurality of slaves and a transceiver circuit; the transceiver circuit comprises an output line connected to an output interface of a serial port of the host and an input line connected to an input interface of a serial port of the host; an input interface of a serial port of a slave is connected to the output line, and an output interface of a serial port of a slave is connected to the input line;
所述主机和从机通过如下串口通信方法实现主机对若干个从机的通信:The host and the slaves realize the communication between the host and several slaves through the following serial communication method:
所述主机通过收发线路间隔轮询各个从机状态,从机响应主机轮询的回复时间小于主机轮询的间隔时间。The host polls the status of each slave at intervals through the transceiver line, and the reply time of the slave in response to the host polling is less than the interval time of the host polling.
本发明提出了一种实现控制端单串口、多个受控端的串行通信方法,有效解决了一对多通信的成本问题,避免了一对多串口通信轮询进行状态更新中存在的通信冲突、通信阻塞问题。The present invention proposes a serial communication method for realizing a single serial port of a control end and multiple controlled ends, which effectively solves the cost problem of one-to-many communication and avoids the communication conflict and communication blocking problems existing in one-to-many serial port communication polling for status update.
进一步的,所述主机轮询各个从机状态的方法为,通过输出线发出轮询指令,所述轮询指令中包括当前被轮询从机的地址。Furthermore, the method for the host to poll the status of each slave is to send a polling instruction through an output line, and the polling instruction includes the address of the currently polled slave.
进一步的,所述从机响应主机轮询的方法为,从机解析轮询指令,当轮询指令中的地址与本机地址不符合,则不响应;若符合,则上报本机状态。Furthermore, the method for the slave to respond to the host polling is that the slave parses the polling instruction, and when the address in the polling instruction does not match the local address, the slave does not respond; if the address matches, the slave reports the local status.
主机轮询过程中,通过指令群发,接收端判断指令目标的方式,实现串行通信资源的分时复用。谁作为指令目标,谁当前占用串行线路上报状态,且占用时间不得超过轮询间隔时间,防止干扰下个从机的状态查询。且通信过程高效快速,无需主机额外进行通信资源的预分配,或者额外设立通信优先级机制。During the host polling process, the time-sharing multiplexing of serial communication resources is realized by sending commands in batches and the receiving end judging the command target. Whoever is the command target currently occupies the serial line to report the status, and the occupation time must not exceed the polling interval to prevent interference with the status query of the next slave. The communication process is efficient and fast, and the host does not need to pre-allocate communication resources or set up an additional communication priority mechanism.
进一步的,串口通信方法还包括:所述主机通过收发线路下发控制指令,所述控制指令中包括控制内容和需响应该控制的从机的地址。Furthermore, the serial communication method also includes: the host sends a control instruction through a transceiver line, and the control instruction includes a control content and an address of a slave that needs to respond to the control.
进一步的,所述从机解析控制指令,当控制指令中的地址与本机地址不符合,则不响应;若符合,则响应控制内容。Furthermore, the slave machine parses the control instruction, and does not respond when the address in the control instruction does not match the local address; if the address matches, it responds to the control content.
主机控制指令下发过程中,通过指令群发,接收端判断指令目标的方式,实现串行通信资源的分时复用。谁作为指令目标,谁响应控制命令。通信过程高效快速,无需主机额外进行通信资源的预分配,或者额外设立通信优先级机制。During the process of sending the host control command, the time-sharing multiplexing of serial communication resources is realized by sending commands in batches and the receiving end judging the command target. Whoever serves as the command target responds to the control command. The communication process is efficient and fast, and the host does not need to pre-allocate communication resources or set up an additional communication priority mechanism.
进一步的,串口通信方法还包括:从机不向外发送数据时,该从机串口的输出接口配置为浮空模式。Furthermore, the serial port communication method also includes: when the slave does not send data externally, the output interface of the slave serial port is configured as a floating mode.
不进行通信的从机输出接口置于浮空状态,防止拉底主机输出接口电平,干扰主机和其他从机的通信。The output interface of the slave device that is not communicating is placed in a floating state to prevent the output interface level of the host device from being pulled down and interfering with the communication between the host and other slave devices.
进一步的,串口通信方法还包括:串口通信波特率设置为115200。Furthermore, the serial port communication method also includes: setting the serial port communication baud rate to 115200.
115200为实际实施时最佳的波特率设置,实现了较高的传输效率。115200 is the best baud rate setting in actual implementation, achieving higher transmission efficiency.
进一步的,串口通信方法还包括:从机与从机之间不进行通信,从机不主动与主机通信。Furthermore, the serial port communication method also includes: the slaves do not communicate with each other, and the slaves do not actively communicate with the host.
从机不主动进行通信,进一步防止通信冲突或者通信阻塞。The slave does not actively communicate, further preventing communication conflicts or communication blockages.
本发明的一种基于串口的一对多通信方法,采用如上所述的基于串口的一对多通信系统中的串口通信方法实现主机对若干个从机的通信。The one-to-many communication method based on a serial port of the present invention adopts the serial port communication method in the one-to-many communication system based on a serial port as described above to realize the communication between the host and several slaves.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本发明的基于串口的一对多通信系统电路原理图。FIG. 1 is a circuit diagram of a one-to-many communication system based on a serial port according to the present invention.
具体实施方式DETAILED DESCRIPTION
下面结合附图对本发明做进一步详细的说明。The present invention will be further described in detail below in conjunction with the accompanying drawings.
系统实施例:System Example:
串口通常只包括两个常规输入接口RX和输出接口TX,一般串口通信都是主机与从机一对一的,即一对一单向传输通信。若想基于串口实现主机对从机一对多通信的话,与之俱来的问题是一个主机与多个从机之间通信阻塞问题,多个RX信号相互干扰,造成控制端(主机)无法正常接收受控端(从机)的信息。The serial port usually only includes two conventional input interfaces RX and output interfaces TX. Generally, serial port communication is one-to-one between the host and the slave, that is, one-to-one unidirectional transmission communication. If you want to realize one-to-many communication between the host and the slaves based on the serial port, the problem that comes with it is the communication blockage between a host and multiple slaves. Multiple RX signals interfere with each other, causing the control end (host) to be unable to receive the information of the controlled end (slave) normally.
本方案的硬件电路如图1所示,核心板作为主控主机,通过一个串口控制集成的多个作为从机的86单元。各86功能模块与核心板之间采用UART连接,具体的,收发线路包括TX线、RX线和GND线,TX线、RX线和GND线分别连接核心板串口的TX口、RX口和GND口,各个86单元挂接在收发线路上,86单元串口的TX口连接RX线、RX口连接TX线、GND口连接GND线。即用GND线、TX线、RX线及VCC线将所有模块连接,核心板作为主机,各86组合单元作为从机,主机可以和各从机通信,各从机之间彼此不能通信。在智能家居领域,智能家居系统包括智能家居设备和智能家居中控网关,智能家居中控网关是用于集控各个智能家居设备的中控设备;多联控制面板作为一个智能家居设备与智能家居中控网关建立通信连接,多联控制面板的核心板作为本发明中的通信主机可以接收智能家居中控网关的控制指令。多联控制面板的核心板(通信主机),基于本发明串口一对多通讯方法,将从智能家居中控网关等处接收的控制指令下发到对应的86单元(通信从机),即通过串行通信向对应受控的86功能模块(开关、场景、插座、温控器、窗帘等)下达控制指令,实现相应的功能。从机本身能够实现本地功能,以开关及温控器为例,人机交互部分及继电器控制直接由86组合单元实现;同时当通过串口收到下发的控制指令后,对指令进行解析、实现;还能在中控网关查询时对本地需要同步给中控网关的状态通过串口及核心板打包上报给中控网关。The hardware circuit of this solution is shown in Figure 1. The core board serves as the main control host, and controls multiple 86 units integrated as slaves through a serial port. Each 86 functional module is connected to the core board using UART. Specifically, the transceiver line includes a TX line, an RX line, and a GND line. The TX line, the RX line, and the GND line are respectively connected to the TX port, the RX port, and the GND port of the core board serial port. Each 86 unit is hung on the transceiver line. The TX port of the 86 unit serial port is connected to the RX line, the RX port is connected to the TX line, and the GND port is connected to the GND line. That is, all modules are connected with the GND line, the TX line, the RX line, and the VCC line. The core board serves as the host, and each 86 combination unit serves as a slave. The host can communicate with each slave, but the slaves cannot communicate with each other. In the field of smart home, the smart home system includes smart home devices and smart home central control gateways. The smart home central control gateway is a central control device for centralized control of various smart home devices; the multi-link control panel is a smart home device that establishes a communication connection with the smart home central control gateway. The core board of the multi-link control panel, as a communication host in the present invention, can receive control instructions from the smart home central control gateway. The core board (communication host) of the multi-link control panel, based on the serial port one-to-many communication method of the present invention, sends the control instructions received from the smart home central control gateway to the corresponding 86 units (communication slaves), that is, through serial communication, the control instructions are issued to the corresponding controlled 86 functional modules (switches, scenes, sockets, thermostats, curtains, etc.) to achieve the corresponding functions. The slave itself can realize local functions. Taking switches and thermostats as examples, the human-computer interaction part and relay control are directly realized by the 86 combination units; at the same time, when the control instructions issued are received through the serial port, the instructions are parsed and realized; when the central control gateway queries, the local state that needs to be synchronized to the central control gateway can be packaged and reported to the central control gateway through the serial port and the core board.
为实现基于串口的一对多通信,解决一对多通信的通信阻塞问题,采用如下串口通信方法。In order to realize one-to-many communication based on serial port and solve the communication blocking problem of one-to-many communication, the following serial port communication method is adopted.
首先,各86组合单元(从机)出厂必须根据组合要求配置地址,且地址需要唯一。组网时,核心板(主机)掌握入网从机的地址。同时主机包括按键入网功能,入网后上报其所包含的86单元组合种类及组合顺序。First, each 86-unit combination unit (slave) must be configured with an address according to the combination requirements before leaving the factory, and the address must be unique. When networking, the core board (host) knows the address of the slave connected to the network. At the same time, the host includes a key network access function, and after accessing the network, it reports the type and order of the 86-unit combination it contains.
本发明的串口通信方法包括如下两种通信过程:The serial communication method of the present invention includes the following two communication processes:
1)主机轮询过程。1) Host polling process.
主机轮询过程是主机对各从机状态的定时查询过程,用于主机掌握和定时更新从机的状态。主机需要一直轮询采集各个86组合单元的状态,当检测到有状态变化时,就上报上位机,以达到本地86组合单元状态与上位机的同步。The host polling process is a process in which the host periodically queries the status of each slave, which is used for the host to master and periodically update the status of the slave. The host needs to poll and collect the status of each 86 combination unit. When a status change is detected, it will report to the host computer to achieve synchronization between the local 86 combination unit status and the host computer.
主机轮询过程中,主机通过TX口按一定轮询周期发出状态查询指令,每轮状态查询指令针对一个从机,状态查询指令中包含当前周期查询的对应从机地址,和状态查询标识。状态查询指令发出后,通过收发线路TX线被各个组网的从机通过各自串口的RX口接收,各从机接收到主机下发的指令后,对收到的每条指令进行地址配置,当不属于自己的指令时直接抛弃,不对该指令响应。当解析指令得到指令中的地址并与自身地址匹配时,继续解析指令内容,在得到主机的状态查询标识后,计时器开始计时,保证对主机进行回复时,主机接收完成时间不大于主机轮询周期(主机轮询的间隔时间)。例如主机轮询间隔时间为100ms,若当前接收完成时间大于80ms,则对该指令不做回复,以解决可能因为从机程序阻塞回复造成总线冲突问题。During the host polling process, the host sends a status query instruction through the TX port according to a certain polling cycle. Each round of status query instructions is for a slave. The status query instruction contains the corresponding slave address queried in the current cycle and the status query identifier. After the status query instruction is issued, it is received by each networked slave through the RX port of its own serial port through the transceiver line TX line. After each slave receives the instruction issued by the host, it configures the address of each instruction received. When the instruction does not belong to itself, it directly discards it and does not respond to the instruction. When the address in the instruction is obtained by parsing the instruction and matches its own address, the instruction content continues to be parsed. After obtaining the status query identifier of the host, the timer starts timing to ensure that when replying to the host, the host reception completion time is not greater than the host polling cycle (the interval time of the host polling). For example, if the host polling interval is 100ms, if the current reception completion time is greater than 80ms, no reply will be made to the instruction to solve the bus conflict problem that may be caused by the slave program blocking the reply.
即设置主机间隔轮询周期T,设置从机对主机的回复完成周期t,该回复完成周期t需小于主机间隔轮询周期T。That is, set the host interval polling cycle T, and set the slave's reply completion cycle t to the host. The reply completion cycle t must be smaller than the host interval polling cycle T.
在满足回复完成周期小于主机轮询间隔周期时,对应从机将本地需要同步给主机的状态打包上报。主机在轮询间隔时间后,继续发出包含下一个从机地址的状态查询指令。When the reply completion cycle is less than the host polling interval, the corresponding slave will package and report the local status that needs to be synchronized to the host. After the polling interval, the host continues to issue a status query instruction containing the next slave address.
2)控制指令的转发及解析。2) Forwarding and parsing of control instructions.
当主机收到多联控制面板的本地操作(如语音、按键、触摸控制等)、或者上位机(如智能家居中控网关)发来的控制命令时(例如对温控器的调整,指令需要增加下发的86组合单元编号),通过TX口发出控制指令,控制指令包括主机根据编号找到的对应86组合单元(从机)的地址,以及控制内容(例如对温控器设定的具体温度)。控制指令发出后,通过收发线路TX线被各个组网的从机通过各自串口的RX口接收,各从机接收到主机下发的指令后,对收到的每条指令进行地址配置,当不属于自己的指令时直接抛弃,不对该指令响应。当解析指令得到指令中的地址并与自身地址匹配时,继续解析指令内容,得到对应的控制内容后响应该控制,按照控制内容进行相应的控制(例如温控器完成具体温度的设置)。When the host receives a local operation of the multi-link control panel (such as voice, button, touch control, etc.) or a control command from the host computer (such as the smart home central control gateway) (for example, to adjust the thermostat, the instruction needs to increase the 86 combination unit number issued), the control instruction is issued through the TX port. The control instruction includes the address of the corresponding 86 combination unit (slave) found by the host according to the number, and the control content (such as the specific temperature set for the thermostat). After the control instruction is issued, it is received by each networked slave through the RX port of its own serial port through the transceiver line TX line. After each slave receives the instruction issued by the host, it configures the address of each instruction received. When the instruction does not belong to itself, it directly discards it and does not respond to the instruction. When the address in the instruction is obtained by parsing the instruction and matches its own address, it continues to parse the instruction content, responds to the control after obtaining the corresponding control content, and performs corresponding control according to the control content (for example, the thermostat completes the setting of the specific temperature).
此外,各从机不允许主动上报数据,而且不发送数据时各从机的输出接口TX必须配置为浮空输入模式;不发送数据时从机的输出接口TX设置为浮空模式,避免对其他从机通信的影响,通常状态主机的输入接口RX需为浮空输入模式,从机的输出接口TX不设置为浮空输入模式,会拉高主机输入接口RX的电平。In addition, each slave is not allowed to actively report data, and the output interface TX of each slave must be configured as a floating input mode when no data is sent; the output interface TX of the slave is set to a floating mode when no data is sent to avoid affecting the communication of other slaves. Normally, the input interface RX of the host needs to be in a floating input mode. If the output interface TX of the slave is not set to a floating input mode, the level of the input interface RX of the host will be raised.
较佳地,串口通信波特率需要采用115200,加快总线传输效率;这是实施时最佳的波特率设置,实际还可以根据方案配置合适的波特率区间,实现较高的传输效率。Preferably, the serial communication baud rate needs to be 115200 to speed up bus transmission efficiency; this is the best baud rate setting during implementation, and in practice, a suitable baud rate range can be configured according to the solution to achieve higher transmission efficiency.
本发明的一种基于串口的一对多通信装置,具有如下特点,1)各从机不允许主动上报数据;2)不发送数据时各从机的TX口必须配置为浮空输入模式;3)设置从机对主机的回复完成周期,小于主机间隔轮询周期;4)各86组合单元出厂必须根据组合要求配置地址,且地址需要唯一,核心板发指令包含地址,从机对收到的每条指令进行地址配置,当指令不属于自己时直接抛弃。The one-to-many communication device based on the serial port of the present invention has the following characteristics: 1) each slave is not allowed to actively report data; 2) when no data is sent, the TX port of each slave must be configured as a floating input mode; 3) the reply completion cycle of the slave to the host is set to be less than the host interval polling cycle; 4) each 86 combination unit must be configured with an address according to the combination requirements before leaving the factory, and the address needs to be unique. The core board sends instructions containing the address, and the slave configures the address for each instruction received, and directly discards the instruction when it does not belong to itself.
本发明克服了串口一对多通信时的通信阻塞问题,打破了传统串口单纯的一对一通信模式,支持一对多的通信模式,解决因主设备的端口少而不依赖硬件切换的情况下与多个从设备进行通信的问题。在资源上减少了通信端口、节约端口资源,并在逻辑上实现了一控制机与多受控机的基于串口通信方法。The present invention overcomes the communication blocking problem during one-to-many serial port communication, breaks the simple one-to-one communication mode of the traditional serial port, supports one-to-many communication mode, and solves the problem of communicating with multiple slave devices without relying on hardware switching due to the small number of ports of the master device. In terms of resources, the communication ports are reduced, the port resources are saved, and a serial port-based communication method between a control machine and multiple controlled machines is logically realized.
方法实施例:Method Example:
本发明的基于串口的一对多通信方法已经在装置实施例串口通信方法中介绍的足够清楚,此处不再赘述。The one-to-many communication method based on a serial port of the present invention has been introduced clearly enough in the serial port communication method of the device embodiment, and will not be repeated here.
本发明提出的基于串口的一对多通信方法,无需在现有单片机基础上增加串口,能够解决多联集成面板控制中采用485通讯或择用多串口的单片机,造成成本增加、不能灵活组合满足不了丰富定制功能需求的问题;可以实现在一个智能家居多联控制面板上,通过一个核心板(即本发明中的“主机”)、与开关、场景、温控器等多个86单元(通讯系统中的“从机”)有效通信、节约串口资源;且相对于现有多联产品每个86单元分别设计核心板的方案,进一步降低了成本,且可根据需求进行“一主机对多从机”的定制设计,满足“积木式”灵活随意组合,解决当前存在的因86单元类型、顺序等差异因素造成的多联产品设计耗费人力、周期长的技术问题。The one-to-many communication method based on serial port proposed in the present invention does not need to add serial ports on the basis of the existing single-chip microcomputer, and can solve the problem that 485 communication or single-chip microcomputer with multiple serial ports is used in the control of multi-link integrated panel, which causes increased cost and cannot be flexibly combined to meet the needs of rich customized functions; it can be realized on a smart home multi-link control panel, through a core board (that is, the "host" in the present invention) and multiple 86 units ("slaves" in the communication system) such as switches, scenes, and thermostats. Effective communication and saving of serial port resources; and compared with the existing multi-link product solution of designing a core board for each 86 unit separately, the cost is further reduced, and a customized design of "one host to multiple slaves" can be performed according to demand, which meets the "building block" flexible and arbitrary combination, and solves the current technical problem that the design of multi-link products is labor-intensive and has a long cycle due to differences in the type and sequence of the 86 units.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011630574.9A CN112765075B (en) | 2020-12-31 | 2020-12-31 | One-to-many communication method and system based on serial port |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011630574.9A CN112765075B (en) | 2020-12-31 | 2020-12-31 | One-to-many communication method and system based on serial port |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112765075A CN112765075A (en) | 2021-05-07 |
CN112765075B true CN112765075B (en) | 2024-09-24 |
Family
ID=75699525
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011630574.9A Active CN112765075B (en) | 2020-12-31 | 2020-12-31 | One-to-many communication method and system based on serial port |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112765075B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113242169B (en) * | 2021-05-10 | 2023-05-30 | 广东拓斯达科技股份有限公司 | Multi-slave data updating method, system, equipment and storage medium |
CN113886316A (en) * | 2021-09-27 | 2022-01-04 | 合肥讯飞数码科技有限公司 | Data communication method and related apparatus, equipment, system and storage medium |
CN113949671B (en) * | 2021-09-29 | 2023-06-02 | 深圳市优必选科技股份有限公司 | Master-slave communication system, method, host and slave |
CN113946529B (en) * | 2021-10-15 | 2024-03-22 | 上海商汤阡誓科技有限公司 | Circuit system, signal processing method and device |
CN115085758B (en) * | 2022-06-10 | 2024-08-02 | 贵州电网有限责任公司 | Working method of double-transceiver multi-mode RS-485 communication host |
CN116418625A (en) * | 2023-02-24 | 2023-07-11 | 杭州集普科技有限公司 | RS-485 bus-based high-speed synchronous data acquisition method for leg impact |
CN116775533B (en) * | 2023-08-25 | 2023-11-07 | 北京凯芯微科技有限公司 | One-to-many serial ports two-way communication conversion circuit |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN203180949U (en) * | 2013-03-27 | 2013-09-04 | 郑军 | A bus communication system based on UARTs |
CN106411655A (en) * | 2016-11-04 | 2017-02-15 | 合肥工业大学 | Communication processing method based on state diagnosis of serial communication equipment |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2738340B2 (en) * | 1995-05-11 | 1998-04-08 | 日本電気株式会社 | Multi-access communication method |
CN104317765B (en) * | 2014-10-20 | 2018-07-13 | 成都广达新网科技股份有限公司 | A kind of one-to-many communication system and implementation method based on serial communication |
CN110769078B (en) * | 2019-10-17 | 2023-04-28 | 广东美的制冷设备有限公司 | Address allocation method and system |
CN111813732A (en) * | 2020-06-12 | 2020-10-23 | 江西凯润达精密仪器有限公司 | Multi-machine communication method based on serial port communication of single chip microcomputer |
-
2020
- 2020-12-31 CN CN202011630574.9A patent/CN112765075B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN203180949U (en) * | 2013-03-27 | 2013-09-04 | 郑军 | A bus communication system based on UARTs |
CN106411655A (en) * | 2016-11-04 | 2017-02-15 | 合肥工业大学 | Communication processing method based on state diagnosis of serial communication equipment |
Also Published As
Publication number | Publication date |
---|---|
CN112765075A (en) | 2021-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112765075B (en) | One-to-many communication method and system based on serial port | |
CN107181659B (en) | Intelligent cabinet communication method and system based on RS485 bus | |
AU594057B2 (en) | Communication system | |
CN107707447B (en) | Slave station system based on EtherCAT and control method | |
CN207266039U (en) | A kind of single line anti-collision competitive mode bus network | |
CN110417930A (en) | A kind of auto-allocation method of serial device mailing address | |
CN113094321B (en) | RS485 bus communication method based on group call and time slot allocation | |
CN111277478B (en) | RS485 bus multiplexing control method based on slave devices with different baud rates | |
CN111756610A (en) | RS485 bus communication time sequence control method | |
CN110456705B (en) | Network control device capable of dynamically expanding interface and building automatic control system | |
US10742252B2 (en) | Radio base station and system having said radio base station | |
CN114039808B (en) | CAN/LIN/SENT forwarding protocol of CAN-based multichannel | |
CN112199316B (en) | Configuration method and communication method of chain-type master-slave serial port communication device | |
CN110601943A (en) | Communication system based on RS485 bus and communication method thereof | |
CN112398714B (en) | Backboard bus master station, system and data communication method thereof | |
KR20080024465A (en) | Network connection switching unit and network station | |
CN101751012B (en) | Device and method for realizing communication of direct current cabinet and host computer based on communication supervisor | |
CN109873741B (en) | System and working method of single-wire shared bus protocol | |
CN110474828A (en) | A kind of MBUS bus communication and system | |
CN100442713C (en) | A Method of Improving the Efficiency of Communication Link Layer Protocol | |
CN210954663U (en) | Cluster type lock control system | |
Wei et al. | The design of PROFINET-MODBUS protocol conversion gateway based on the ERTEC 200P | |
CN210780847U (en) | EtherCAT bus clock distribution system | |
CN106657093B (en) | Gateway protocol for smart home | |
CN109673044A (en) | Communication control method, chip, the gateway apparatus of chip |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |