CN106054819A - Method for setting server preset disconnection ID in server control system - Google Patents
Method for setting server preset disconnection ID in server control system Download PDFInfo
- Publication number
- CN106054819A CN106054819A CN201610506209.4A CN201610506209A CN106054819A CN 106054819 A CN106054819 A CN 106054819A CN 201610506209 A CN201610506209 A CN 201610506209A CN 106054819 A CN106054819 A CN 106054819A
- Authority
- CN
- China
- Prior art keywords
- server
- disconnection
- main controller
- preset
- preset disconnection
- 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
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/18—Numerical control [NC], i.e. automatically operating machines, in particular machine tools, e.g. in a manufacturing environment, so as to execute positioning, movement or co-ordinated operations by means of programme data in numerical form
- G05B19/414—Structure of the control system, e.g. common controller or multiprocessor systems, interface to servo, programmable interface controller
- G05B19/4145—Structure of the control system, e.g. common controller or multiprocessor systems, interface to servo, programmable interface controller characterised by using same processor to execute programmable controller and numerical controller function [CNC] and PC controlled NC [PCNC]
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/30—Nc systems
- G05B2219/31—From computer integrated manufacturing till monitoring
- G05B2219/31171—Each data object has corresponding identification for object manager, associative
Landscapes
- Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Manufacturing & Machinery (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Selective Calling Equipment (AREA)
Abstract
Description
技术领域technical field
本发明涉及伺服器控制系统领域,尤其指伺服器和控制该伺服器的主控制器。The invention relates to the field of server control systems, in particular to a server and a main controller for controlling the server.
背景技术Background technique
目前,机器人已越来越多的应用在日常生活和娱乐,其一般包括主控制器和若干伺服器(或称伺服马达或舵机)。通过各伺服器来实现机器人各关节的运动。现有一般通过一个主控制器控制若干伺服器。At present, robots have been more and more used in daily life and entertainment, which generally include a main controller and several servos (or called servo motors or steering gears). The movement of each joint of the robot is realized by each servo. At present, several servers are generally controlled by a master controller.
各伺服马达通过总线串接或并联接在主控制器的若干接口上;主控制器通过总线向伺服器发送控制讯号。各伺服马达和主控制器之间通过一组线(包括电源线(VDD)、接地线(GND)和信号线)连接到主控制器上。在主控制器内部、伺服器内部和主控制器和伺服器之间也连接有该信号线,以实现主控制器和伺服器的通讯。Each servo motor is connected in series or in parallel to several interfaces of the main controller through the bus; the main controller sends control signals to the servo through the bus. Each servo motor and the main controller are connected to the main controller through a set of wires (including power wires (VDD), ground wires (GND) and signal wires). The signal line is also connected inside the main controller, inside the server, and between the main controller and the server, so as to realize the communication between the main controller and the server.
目前,作为较优的方式,该信号线为多重伺服马达控制总线(英文全称:MultipleServo Motor Control Bus,英文简写:MSMCB)。主控制器通过MSMCB与伺服器通讯,主控制器下命令给伺服器,伺服器也可将讯号回传给主控制器,主控制器可以得知伺服器的状态,包括位置,是否过电流等。Currently, as a better way, the signal line is a multiple servo motor control bus (English full name: MultipleServo Motor Control Bus, English abbreviation: MSMCB). The main controller communicates with the server through MSMCB. The main controller sends commands to the server, and the server can also send the signal back to the main controller. The main controller can know the status of the server, including the position, whether it is over-current, etc. .
目前,通过该MSMCB,可以将多个伺服器接在主控制器的一个接口上,由于各伺服器共享MSMCB,因此,每个伺服器需要设定ID(身份标识号或账号或唯一编码的简写),才能在主控制器发送指令时用以分辨所要沟通的对象伺服器。该伺服器中设有存储器(如EEPROM(英文全称:Electrically Erasable Programmable Read-Only Memory,中文全称:电可擦可编程只读存储器))来存储各伺服器的ID。At present, through the MSMCB, multiple servers can be connected to one interface of the main controller. Since each server shares the MSMCB, each server needs to set an ID (identification number or account number or the abbreviation of the unique code) ), it can be used to identify the target server to be communicated when the main controller sends commands. The server is provided with a memory (such as EEPROM (English full name: Electrically Erasable Programmable Read-Only Memory, Chinese full name: Electrically Erasable Programmable Read-Only Memory)) to store the ID of each server.
目前,现有伺服器上一般均设有2端口,其中一个端口为输入端口,另一个端口为输出端口,各伺服器的输入端口通过总线接到主控制器上或者前一伺服器的输出端上。如此,以实现将各伺服器串接在主控制器一个接口上的目的。由于伺服器的个数为多个,因此,需要防止伺服器的ID出现重复的现象,此前的方式是在组装前预先设置好各伺服器的ID,且将各伺服器按照正确的位置设定,更换任意伺服器,或者使得任意伺服器的ID出现偏差,都将使得总个机器人无法按照正确的设定逻辑动作。At present, the existing servers are generally equipped with 2 ports, one of which is an input port and the other is an output port. The input port of each server is connected to the main controller or the output port of the previous server through the bus. superior. In this way, the purpose of connecting each server in series to one interface of the main controller is realized. Since there are multiple servers, it is necessary to prevent the duplication of server IDs. The previous method is to pre-set the ID of each server before assembly, and set each server according to the correct position. , replacing any server, or making the ID of any server deviate, will make the entire robot unable to act according to the correct set logic.
为解决上述技术问题,已有方案对伺服器做了改进,在伺服器内部两端口之间的MSMCB上增加了一开关。通过开关的通断控制,可以在开机时预设各开关为断路,然后通过主控制器对接在其上的第一个伺服器设定其ID,完成第一个伺服器的ID设定后,即将第一个伺服器内的开关导通,使该下一个串接的伺服器(第二个伺服器)可以接受来自主控制器的讯号。然后完成第二个伺服器的ID设定即开关导通,如此重复上述步骤,依序完成各伺服器的ID设定。其可在开机时,自动完成各伺服器的ID设定,省去组装和维修时人为设定ID的困扰。In order to solve the above-mentioned technical problems, existing solutions have improved the server by adding a switch to the MSMCB between the two ports inside the server. Through the on-off control of the switch, each switch can be preset as off-circuit when starting up, and then set the ID of the first server connected to it through the main controller. After completing the ID setting of the first server, That is, the switch in the first server is turned on, so that the next server connected in series (the second server) can receive the signal from the master controller. Then the ID setting of the second server is completed, that is, the switch is turned on, and the above steps are repeated to complete the ID setting of each server in sequence. It can automatically complete the ID setting of each server when it is turned on, eliminating the trouble of artificially setting IDs during assembly and maintenance.
然而,该种方式虽然可实现伺服器自动改ID,但伺服器组装时仍然比较麻烦,其必须预先搞清楚伺服器上输入端口和输出端口,防止其接反。否则可能会出现逻辑错误,导致伺服器无法实现自动改ID,其伺服器仍然无法按照正确的设定逻辑动作。However, although this method can automatically change the ID of the server, it is still troublesome when assembling the server. It is necessary to find out the input port and output port on the server in advance to prevent them from being reversed. Otherwise, there may be logic errors, which will cause the server to fail to automatically change the ID, and the server still cannot operate according to the correct set logic.
发明内容Contents of the invention
为此,本申请人针对上述缺陷,对伺服器控制系统及其伺服器控制系统中的伺服器ID设定方法等进行了改进。其中,改进后的伺服器控制系统包括主控制器及若干伺服器;所述主控制器包括主控MCU和若干接口,所述接口通过总线连接至所述主控MCU;至少在其中的一个接口上通过总线串接所述伺服器;For this reason, the applicant has improved the server control system and the server ID setting method in the server control system to address the above defects. Wherein, the improved server control system includes a main controller and several servers; the main controller includes a main control MCU and several interfaces, and the interfaces are connected to the main control MCU through a bus; at least one of the interfaces The server is connected in series through the bus;
所述伺服器包括舵机MCU、第一端口和第二端口;所述第一端口和所述第二端口之间通过总线连接,所述总线同时连接到所述舵机MCU;The server includes a steering gear MCU, a first port, and a second port; the first port and the second port are connected through a bus, and the bus is simultaneously connected to the steering gear MCU;
其中,所述第一端口和所述第二端口之间的总线上设有所述第一舵机开关和第二舵机开关;所述第一舵机开关连接于所述第一端口和所述舵机MCU之间,该第一舵机开关控制所述第一端口的通断;所述第二舵机开关连接于所述第二端口和所述舵机MCU之间,该第二舵机开关控制所述第二端口的通断;Wherein, the bus between the first port and the second port is provided with the first steering gear switch and the second steering gear switch; the first steering gear switch is connected to the first port and the Between the steering gear MCU, the first steering gear switch controls the on-off of the first port; the second steering gear switch is connected between the second port and the steering gear MCU, and the second steering gear switch The switch controls the on-off of the second port;
所述第一舵机开关与第一端口之间设有第一插入线连接至所述舵机MCU,所述第二舵机开关与第二开口之间设有第二插入线连接至所述舵机MCU。A first insertion line is provided between the first steering gear switch and the first port to connect to the steering gear MCU, and a second insertion line is provided between the second steering gear switch and the second opening to connect to the Servo MCU.
其伺服器通过如下ID设定方法实现自动设定ID,以省去组装和维修时人为设定ID的困扰。Its server automatically sets the ID through the following ID setting method, so as to save the trouble of manually setting the ID during assembly and maintenance.
伺服器的ID设定方法具体包括如下步骤:主控制器广播,向总线上的所有伺服器发送将伺服器的原始ID改为某预设断开ID的消息;各伺服器根据接收到的消息,以将所有伺服器的ID都设定为某预设断开ID;当伺服器内的ID为预设断开ID时,则使伺服器内输入端口内总线上的舵机开关接通,而使伺服器内输出端口内总线上的舵机开关断开。当伺服器内的ID为不同于预设断开ID的ID时,则使伺服器内总线上的两个舵机开关导通。The ID setting method of the server specifically includes the following steps: the master controller broadcasts and sends a message to all servers on the bus to change the original ID of the server to a preset disconnection ID; each server according to the received message , to set the IDs of all servers to a preset disconnection ID; when the ID in the server is the default disconnection ID, the servo switch on the bus in the input port of the server is turned on, And the servo switch on the bus in the output port in the server is disconnected. When the ID in the server is different from the preset disconnection ID, the two servo switches on the bus in the server are turned on.
主控制器然后广播,向总线发送将目标ID替换预设断开ID的消息;各伺服器顺序接入网络,并在伺服器接入网络时将伺服器ID替换为目标ID,并在设定伺服器ID后导通伺服器内所有舵机开关;然后重复本步骤,直至所有伺服器完成ID设定。The main controller then broadcasts and sends a message to the bus to replace the target ID with the preset disconnection ID; each server accesses the network sequentially, and replaces the server ID with the target ID when the server is connected to the network, and in the setting After the server ID, turn on all the servo switches in the server; then repeat this step until all servers complete the ID setting.
然而,申请人在设置上述预设断开ID,并将各预设断开ID逐一替换为互不相同的目标ID时,发现在将各伺服器内最早存储的原始ID修改为预设断开ID之前,如果若干伺服器中的原始ID就是预设断开ID,则在其原始ID为预设断开ID的伺服器就将出现断开,使后续伺服器无法接收到主控制器广播的消息,导致后续伺服器中的ID无法被修改为预设断开ID,使伺服器控制系统中的伺服器无法按照设定的逻辑完成所有ID的设定。However, when the applicant set the above preset disconnection IDs and replaced each preset disconnection ID with a different target ID one by one, he found that the original ID stored earliest in each server was changed to the default disconnection ID. Before the ID, if the original ID in several servers is the default disconnection ID, the server whose original ID is the default disconnection ID will be disconnected, so that the subsequent servers cannot receive the message broadcast by the master controller. message, causing the IDs in the subsequent servers to be unable to be modified to the default disconnected IDs, so that the servers in the server control system cannot complete the setting of all IDs according to the set logic.
因此,为解决上述预设断开ID设定过程中,当出现伺服器中原始ID即为预设断开ID时,将使原始ID为预设断开ID的伺服器处出现断开,结果使后续伺服器无法接收到主控制器广播的消息,导致后续伺服器中的ID无法被修改为预设断开ID,使伺服器控制系统中的伺服器无法按照设定的逻辑完成所有ID的设定的问题。本发明提供了一种伺服器控制系统中伺服器预设断开ID设定方法。Therefore, in order to solve the above-mentioned preset disconnection ID setting process, when the original ID in the server is the default disconnection ID, the server whose original ID is the default disconnection ID will be disconnected, resulting in Make the follow-up server unable to receive the message broadcast by the main controller, resulting in the inability of the ID in the follow-up server to be modified to the preset disconnection ID, so that the server in the server control system cannot complete all IDs according to the set logic set the question. The invention provides a server preset disconnection ID setting method in a server control system.
本发明提供的一种伺服器控制系统中伺服器预设断开ID设定方法,其中,所述伺服器控制系统包括主控制器及若干伺服器;所述主控制器包括主控MCU和若干接口,所述接口通过总线连接至所述主控MCU;至少在其中的一个接口上通过总线串接所述伺服器;The present invention provides a server preset disconnection ID setting method in a server control system, wherein the server control system includes a main controller and several servers; the main controller includes a main control MCU and several an interface, the interface is connected to the main control MCU through a bus; at least one of the interfaces is serially connected to the server through a bus;
所述伺服器预设断开ID设定方法包括如下步骤:The server preset disconnection ID setting method includes the following steps:
主控制器向接在其接口上的所有伺服器广播发送将伺服器的原始ID设定为非预设断开ID的消息;The master controller broadcasts a message that sets the original ID of the server to a non-preset disconnection ID to all servers connected to its interface;
各伺服器根据接收到的消息,用非预设断开ID替换原始ID;Each server replaces the original ID with a non-preset disconnection ID according to the received message;
主控制器向接在其接口上的所有伺服器广播发送将所述非预设断开ID设定为预设断开ID的消息;The main controller broadcasts and sends a message of setting the non-preset disconnection ID as the default disconnection ID to all servers connected to its interface;
各伺服器根据接收到的广播消息,用预设断开ID替换所述非预设断开ID。Each server replaces the non-preset disconnection ID with the preset disconnection ID according to the received broadcast message.
进一步地,所述非预设断开ID为任意与所述预设断开ID不相同的ID。Further, the non-preset disconnection ID is any ID different from the preset disconnection ID.
进一步地,所述步骤“主控制器向接在其接口上的所有伺服器广播发送将伺服器的原始ID设定为非预设断开ID的消息”中,还包括如下步骤:主控制器回读总线上是否存在预设断开ID,如果存在预设断开ID,则继续广播,直至所有伺服器的原始ID均被设定为非预设断开ID。Further, the step "the main controller broadcasts and sends a message that sets the original ID of the server to a non-preset disconnection ID to all servers connected to its interface" also includes the following steps: the main controller Read back whether there is a preset disconnection ID on the bus, and if there is a preset disconnection ID, continue broadcasting until the original IDs of all servers are set to non-default disconnection IDs.
进一步地,当伺服器的ID为所述预设断开ID时,则断开伺服器与下一相邻伺服器之间的连接。Further, when the ID of the server is the preset disconnection ID, the connection between the server and the next adjacent server is disconnected.
进一步地,当伺服器内的ID不同于所述预设断开ID时,则导通伺服器与下一相邻伺服器之间的连接。Further, when the ID in the server is different from the preset disconnection ID, the connection between the server and the next adjacent server is turned on.
本发明提供的伺服器预设断开ID设定方法,其在设定预设断开ID之前,先将所有伺服器的原始ID设置为与预设断开ID不相同的非预设断开ID,再将非预设断开ID全部替换为预设断开ID。如此,其可以将各伺服器的任意原始ID修改为非预设断开ID,即使原始ID为预设断开ID,也可以使其被修改为某非预设断开ID,也即实现了将所有任意原始ID替换为预设断开ID的目的。有效避免了原始ID为预设断开ID时,导致后续伺服器中的ID无法被修改为预设断开ID,使伺服器控制系统中的伺服器无法按照设定的逻辑完成所有ID的设定的问题。在此基础上,就可将所有伺服器的预设断开ID修改为互不相同的目标ID。最终实现了伺服器自动设定ID的目的。该方法无需复杂的步骤,简单快捷。The server preset disconnection ID setting method provided by the present invention, before setting the default disconnection ID, the original ID of all servers is set to a non-preset disconnection that is different from the preset disconnection ID ID, and then replace all non-preset disconnection IDs with preset disconnection IDs. In this way, it can modify any original ID of each server to a non-preset disconnection ID, even if the original ID is a preset disconnection ID, it can be modified to a non-preset disconnection ID, that is, it realizes Replaces all arbitrary original IDs with the purpose of preset disconnect IDs. It effectively avoids that when the original ID is the default disconnection ID, the ID in the subsequent server cannot be modified to the default disconnection ID, so that the server in the server control system cannot complete the setting of all IDs according to the set logic. fixed question. On this basis, the default disconnection IDs of all servers can be modified to different target IDs. Finally, the purpose of automatically setting the ID by the server is realized. This method does not require complicated steps, and is simple and quick.
附图说明Description of drawings
图1是本发明具体实施方式中第一实施例中提供的伺服器内部电路原理示意图;Fig. 1 is a schematic diagram of the internal circuit principle of the server provided in the first embodiment of the specific embodiment of the present invention;
图2是本发明具体实施方式中第二实施例中提供的一种主控制器内部电路原理示意图;Fig. 2 is a schematic diagram of the internal circuit principle of a main controller provided in the second embodiment of the specific embodiment of the present invention;
图3是本发明具体实施方式中第二实施例中提供的另一种主控制器内部电路原理示意图;Fig. 3 is a schematic diagram of the internal circuit principle of another main controller provided in the second embodiment of the specific embodiment of the present invention;
图4是本发明具体实施方式中第三实施例中提供的伺服器控制系统原理示意图;Fig. 4 is a schematic diagram of the principle of the server control system provided in the third embodiment of the present invention;
图5是本发明具体实施方式中第四实施例中提供的伺服器ID设定流程图;Fig. 5 is a flow chart of server ID setting provided in the fourth embodiment of the specific embodiment of the present invention;
图6是本发明具体实施方式中第五实施例中提供的伺服器ID设定流程图;Fig. 6 is a flow chart of server ID setting provided in the fifth embodiment of the specific embodiment of the present invention;
图7是本发明具体实施方式中第六实施例中提供的步骤S201具体步骤流程图;Fig. 7 is a flow chart of the specific steps of step S201 provided in the sixth embodiment of the specific embodiment of the present invention;
图8是本发明具体实施方式中第七实施例中提供的伺服器ID设定流程图;Fig. 8 is a flow chart of server ID setting provided in the seventh embodiment of the specific embodiment of the present invention;
图9是本发明具体实施方式中提供的第八实施例中主控制器广播的流程图;Fig. 9 is a flow chart of broadcasting by the master controller in the eighth embodiment provided in the specific embodiments of the present invention;
图10是本发明具体实施方式中提供的第八实施例伺服器内部的流程图。Fig. 10 is a flow chart inside the server of the eighth embodiment provided in the specific implementation manner of the present invention.
其中,1、伺服器;2、主控制器;11、第一端口;12、第二端口;13、舵机MCU;14、第一插入线;15、第二插入线;k1、第一舵机开关;k2、第二舵机开关;20、主控MCU;21、第一接口;22、第二接口;23、第三接口;24、第四接口;25、第五接口;2a、第一主控开关;2b、第二主控开关;2c、第三主控开关;2d、第四主控开关;2e、第五主控开关;1a、第一伺服器;1b、第二伺服器;1c、第三伺服器;1n、第n伺服器;L1、总线;Among them, 1. The server; 2. The main controller; 11. The first port; 12. The second port; 13. The steering gear MCU; 14. The first plug-in line; 15. The second plug-in line; k1, the first rudder k2, the second steering gear switch; 20, the main control MCU; 21, the first interface; 22, the second interface; 23, the third interface; 24, the fourth interface; 25, the fifth interface; 2a, the fifth interface 1 main control switch; 2b, second main control switch; 2c, third main control switch; 2d, fourth main control switch; 2e, fifth main control switch; 1a, first server; 1b, second server ; 1c, the third server; 1n, the nth server; L1, the bus;
具体实施方式detailed description
为了使本发明所解决的技术问题、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the technical problems, technical solutions and beneficial effects solved by the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
下面通过第一实施例对本发明公开的伺服器1进行具体解释说明。伺服器1又称伺服马达或舵机;该伺服器1的具体机械结构为公众所知,其包括变速齿轮组、马达、电位器、控制电路等,不再赘述。如图1所示,其伺服器1包括MCU(中文名称:微控制单元;英文名称:Micro Controller Unit)和两个端口,为区别后续主控制器2中的MCU,此处的MCU称为舵机MCU13。两端口之间通过总线L1(各图1-图4中的总线以加粗线条显示)连接,并同时连接到舵机MCU13。该总线L1为多重伺服马达控制总线(英文全称:Multiple Servo MotorControlBus,英文简写:MSMCB)。同时,端口之间除上述MSMCB外,还包括两电源线(VDD)和接地线(GND)。上述MSMCB线可以根据I2C(英文全称:Inter-Integrated Circuit)、UART(英文全称:Universal Asynchronous Receiver and Transmitter,中文全称:通用异步收发器)或自定的序列总线通讯协议来传递信号。该信号线可以是1条或以上,本例中为一条。The server 1 disclosed in the present invention will be specifically explained below through the first embodiment. The servo 1 is also called a servo motor or a steering gear; the specific mechanical structure of the servo 1 is known to the public, and it includes a transmission gear set, a motor, a potentiometer, a control circuit, etc., and will not be repeated here. As shown in Figure 1, its server 1 includes an MCU (Chinese name: Micro Control Unit; English name: Micro Controller Unit) and two ports. In order to distinguish the MCU in the subsequent main controller 2, the MCU here is called the rudder. Machine MCU13. The two ports are connected through the bus L1 (the buses in each of Figures 1-4 are shown in bold lines), and are connected to the steering gear MCU13 at the same time. The bus L1 is a multiple servo motor control bus (English full name: Multiple Servo MotorControlBus, English abbreviation: MSMCB). At the same time, in addition to the above-mentioned MSMCB, there are two power lines (VDD) and ground lines (GND) between the ports. The above-mentioned MSMCB line can transmit signals according to I 2 C (full name in English: Inter-Integrated Circuit), UART (full name in English: Universal Asynchronous Receiver and Transmitter, full name in Chinese: Universal Asynchronous Receiver and Transmitter), or a self-defined serial bus communication protocol. There can be one or more signal lines, one in this example.
上述端口包括第一端口11和第二端口12,该第一端口11和第二端口12之间没有输入端口和输出端口的限定,该第一端口11可以作为输入端口,则第二端口12作为输出端口;反之,第一端口11也可以作为输出端口,则第二端口12作为输入端口。Above-mentioned port comprises first port 11 and second port 12, does not have the restriction of input port and output port between this first port 11 and second port 12, and this first port 11 can be used as input port, then second port 12 serves as output port; conversely, the first port 11 can also be used as an output port, and the second port 12 can be used as an input port.
其中,在两端口的总线L1之间设有控制2个端口通断的2个舵机开关;上述2个开关分别称为第一舵机开关k1和第二舵机开关k2;也即在所述两端口总线L1之间临近第一端口11处设有第一舵机开关k1,即第一舵机开关k1连接于所述第一端口11和舵机MCU13之间,该第一舵机开关k1控制所述第一端口11的通断,所述两端口总线L1之间临近第二端口12处设有第二舵机开关k2,即第二舵机开关k2连接于所述第二端口12和舵机MCU13之间,所述第二舵机开关k2控制所述第二端口12的通断;所述2个舵机开关的控制端连接到所述舵机MCU13,受所述舵机MCU13的控制。Among them, two steering gear switches for controlling the on-off of the two ports are arranged between the bus L1 of the two ports; the above two switches are respectively called the first steering gear switch k1 and the second steering gear switch k2; A first steering gear switch k1 is provided near the first port 11 between the two port buses L1, that is, the first steering gear switch k1 is connected between the first port 11 and the steering gear MCU13, and the first steering gear switch k1 controls the on-off of the first port 11, and a second steering gear switch k2 is provided between the two-port bus L1 near the second port 12, that is, the second steering gear switch k2 is connected to the second port 12 Between the steering gear MCU13, the second steering gear switch k2 controls the on-off of the second port 12; the control ends of the two steering gear switches are connected to the steering gear MCU13, and are controlled by the steering gear MCU13 control.
如此,通过在第一端口11和第二端口12上外接总线L1,以实现伺服器1与主控制器2,以及伺服器1与伺服器1的之间的电连接,最终实现主控制器2通过总线L1控制各伺服器1的目的。In this way, by connecting the bus L1 to the first port 11 and the second port 12, the electrical connection between the server 1 and the main controller 2, and between the server 1 and the server 1 is realized, and finally the main controller 2 is realized. The purpose of controlling each server 1 is through the bus L1.
同时,在舵机开关与端口之间设置插入线连接到舵机MCU13。具体的,所述第一舵机开关k1与第一端口11之间设有第一插入线14连接至所述舵机MCU13,所述第二舵机开关k2与第二端口12之间设有第二插入线15连接至所述舵机MCU13。如此,舵机MCU13通过所述第一插入线14检测第一端口11的接入信号;通过所述第二插入线15检测第二端口12的接入信号;当第一舵机开关k1和第二舵机开关k2断开时,通过第一插入线14和第二插入线15可以检测哪边端口为输入端口,哪边端口为输出端口。At the same time, an insertion line is set between the steering gear switch and the port to connect to the steering gear MCU13. Specifically, a first plug-in line 14 is provided between the first steering gear switch k1 and the first port 11 to connect to the steering gear MCU13, and a connecting wire 14 is provided between the second steering gear switch k2 and the second port 12. The second plug-in wire 15 is connected to the steering gear MCU13. In this way, the servo MCU13 detects the access signal of the first port 11 through the first insertion line 14; detects the access signal of the second port 12 through the second insertion line 15; when the first steering gear switch k1 and the second When the second steering gear switch k2 is turned off, it can be detected which side port is the input port and which side port is the output port through the first plug-in line 14 and the second plug-in line 15 .
同时,该伺服器1内还设有存储舵机ID的存储器,所述存储器可以仅仅是一个缓存器,也可以是一个EEPROM或者FLASH。At the same time, the server 1 is also provided with a memory for storing the ID of the steering gear, and the memory may be only a buffer, or an EEPROM or FLASH.
本例提供的伺服器1,其在端口之间的总线L1上增加了两个开关,并在开关与端口之间设置插入线连接到舵机MCU13。如此,在将伺服器1进行组装时,无需考虑两个端口的输入输出关系,可以随意组装;组装完成后,通过该插入线来检测信号,以分别哪个是输入端口、哪个是输出端口。根据需要,伺服器1也可以通过对两个开关的通断控制,其可以通过逐个将伺服器1接入网络的方式,逐个将伺服器1顺序设定ID,以防止出现重复ID,如此,使得其组装更简单,省去组装和维修时人为设定ID的困扰。伺服器不会出现由于装反而导致无法按照正确的设定逻辑动作的情况。In the server 1 provided in this example, two switches are added on the bus L1 between the ports, and an insertion line is set between the switches and the ports to connect to the servo MCU13. In this way, when the server 1 is assembled, there is no need to consider the input-output relationship of the two ports, and it can be assembled at will; after the assembly is completed, the signal is detected through the insertion line to distinguish which is the input port and which is the output port. According to needs, the server 1 can also control the on-off of the two switches, which can set the IDs of the servers 1 in sequence by connecting the servers 1 to the network one by one, so as to prevent duplicate IDs from appearing, so, It makes its assembly easier and saves the trouble of artificially setting the ID during assembly and maintenance. The server will not be unable to act according to the correct set logic due to reverse installation.
下面通过第二实施例对本发明公开的主控制器2(简称主控)进行具体解释说明。如图2、图3所示,该主控制器2包括主控MCU20和若干接口;该接口的个数根据需要设置,优选1-6个接口,其可以仅只有一个接口,各伺服器1均通过总线L1串接或者混接在该接口上;也可以包括1个以上的接口,每个接口上根据需要通过总线L1串接若干伺服器1。比如,本例中,设有5个接口,分别命名为第一接口21、第二接口22、第三接口23、第四接口24和第五接口25;具体的,如图2所示,若干接口可以通过总线L1分别接至主控MCU20的若干引脚,所述各引脚和对应接口之间设置一个主控开关。该种连接方案称为并联式,该种方式可以同时向各接口广播相同的消息,也可以向各接口广播不同的消息。如图3所示,也可以将各接口接至主控MCU20的同一引脚上,该引脚与各接口之间的总线上分别接有一主控开关。该种方式称为串联式,该种方式总是同时向各伺服器1广播相同的消息。The main controller 2 (referred to as the main controller) disclosed in the present invention will be specifically explained below through the second embodiment. As shown in Fig. 2 and Fig. 3, the main controller 2 includes a main control MCU20 and several interfaces; It is serially connected or hybridly connected to the interface through the bus L1; it may also include more than one interface, and each interface is connected with several servers 1 in series through the bus L1 as required. For example, in this example, there are 5 interfaces named respectively as the first interface 21, the second interface 22, the third interface 23, the fourth interface 24 and the fifth interface 25; specifically, as shown in Figure 2, several The interfaces can be respectively connected to several pins of the main control MCU 20 through the bus L1, and a main control switch is arranged between each pin and the corresponding interface. This kind of connection scheme is called parallel connection. In this way, the same message can be broadcast to each interface at the same time, and different messages can also be broadcast to each interface. As shown in FIG. 3 , each interface can also be connected to the same pin of the main control MCU 20 , and a main control switch is respectively connected to the bus between the pin and each interface. This kind of way is called tandem, and this kind of way always broadcasts the same message to each server 1 at the same time.
其中,每个接口的内部总线L1上设置主控开关,每个主控开关的控制端均电连接至所述主控MCU20;所述主控MCU20控制各主控开关的通断,以控制各接口上连接的各伺服器1与主控制器2通讯的通断;具体的,该第一接口21的内部总线L1上设有第一主控开关2a;第二接口22的内部总线L1上设有第二主控开关2b;第三接口23的内部总线L1上设有第三主控开关2c;第四接口24的内部总线L1上设有第四主控开关2d;第五接口25的内部总线L1上设有第五主控开关2e。各第一主控开关2a、第二主控开关2b、第三主控开关2c、第四主控开关2d和第五主控开关2e的控制端均电连接至所述主控MCU20。Wherein, a main control switch is set on the internal bus L1 of each interface, and the control end of each main control switch is electrically connected to the main control MCU20; the main control MCU20 controls the on-off of each main control switch to control each Each server 1 connected to the interface communicates with the main controller 2; specifically, the internal bus L1 of the first interface 21 is provided with a first main control switch 2a; the internal bus L1 of the second interface 22 is provided with There is a second main control switch 2b; the internal bus L1 of the third interface 23 is provided with a third main control switch 2c; the internal bus L1 of the fourth interface 24 is provided with a fourth main control switch 2d; the interior of the fifth interface 25 A fifth main control switch 2e is provided on the bus L1. The control ends of each of the first main control switch 2 a , the second main control switch 2 b , the third main control switch 2 c , the fourth main control switch 2 d and the fifth main control switch 2 e are electrically connected to the main control MCU 20 .
本例提供的主控制器2,其在每个接口的内部总线L1上设置主控开关,每个主控开关的控制端均电连接至所述主控MCU20;所述主控MCU20控制各主控开关的通断,以控制各接口上连接的各伺服器1与主控制器2通讯的通断。如此,其可以有选择地打开各主控开关,以接通或断开主控制器2与对应接口上的各伺服器1通讯。可以有效避免主控制器2广播设定ID时出现重复ID的情况发生,使得自动设定ID以后的伺服器1可以按照正确的设定逻辑动作。The main controller 2 provided in this example is provided with a main control switch on the internal bus L1 of each interface, and the control end of each main control switch is electrically connected to the main control MCU20; the main control MCU20 controls each main control switch. Control the on-off of the switch to control the on-off of the communication between each server 1 and the main controller 2 connected on each interface. In this way, it can selectively turn on each main control switch to connect or disconnect the communication between the main controller 2 and each server 1 on the corresponding interface. It can effectively avoid the occurrence of repeated IDs when the main controller 2 broadcasts and sets the ID, so that the server 1 after the automatic setting of the ID can operate according to the correct setting logic.
下面通过第三实施例对本发明公开的伺服器1控制系统进行具体解释说明。如图4所示,所述伺服器控制系统包括主控制器2及若干伺服器1。其中,主控制器2已在第二实施例中具体解释说明,伺服器1已在第一实施例中进行具体解释说明。The control system of the server 1 disclosed in the present invention will be explained in detail below through the third embodiment. As shown in FIG. 4 , the server control system includes a main controller 2 and several servers 1 . Wherein, the main controller 2 has been specifically explained in the second embodiment, and the server 1 has been specifically explained in the first embodiment.
其中,将所有的伺服器1分成若干串,分别串接到主控制器2的各接口上,也即各接口上的伺服器1为串联的关系,而各接口之间的串联的伺服器串为并联的关系。所有伺服器1具体分成几串,每串伺服器1具体设置几个并没有特别限制,串联和并联混合的好处在于使布线更加简单而规律,并优化主控制器2对各伺服器1的控制效率。比如,第一接口21上串接有2个伺服器1,第二接口22上串接有2个伺服器1;第三接口23上串接有3个伺服器1。在该第四接口24上串接有n个伺服器1,分别称为第一伺服器1a、第二伺服器1b、第三伺服器1c和第n伺服器1n;第五接口25上串接有3个伺服器1;每个接口上串接的伺服器1的个数根据其具体需要进行设定。Among them, all the servers 1 are divided into several strings, which are respectively serially connected to each interface of the main controller 2, that is, the servers 1 on each interface are in a series relationship, and the serial connection between each interface for a parallel relationship. All the servers 1 are divided into several strings, and there is no special limit on the specific number of servers 1 in each string. The advantage of mixing series and parallel is to make the wiring more simple and regular, and to optimize the control of the main controller 2 to each server 1 efficiency. For example, two servers 1 are connected in series on the first interface 21 , two servers 1 are connected in series on the second interface 22 ; three servers 1 are connected in series on the third interface 23 . There are n servers 1 connected in series on the fourth interface 24, respectively referred to as the first server 1a, the second server 1b, the third server 1c, and the nth server 1n; the fifth interface 25 is connected in series There are three servers 1; the number of servers 1 connected in series on each interface is set according to its specific needs.
以第四接口24上串接n个伺服器为例,其具体连接方式如下:在主控制器2的第四接口24通过总线L1与第一伺服器1a的任一端口(如第一端口11,该第一端口11作为输入端口)串接,然后在另一端口(对应第二端口12,该第二端口12作为输出端口)通过总线L1与第二伺服器1b的任一端口(如第一端口11,该第一端口11作为输入端口)串接,如此,依次实现各伺服器1的串接。Taking n servers connected in series on the fourth interface 24 as an example, the specific connection method is as follows: the fourth interface 24 of the main controller 2 is connected to any port of the first server 1a (such as the first port 11 through the bus L1) , the first port 11 is used as the input port) in series, and then at another port (corresponding to the second port 12, the second port 12 is used as the output port) through the bus L1 and any port of the second server 1b (such as the first A port 11, the first port 11 is used as an input port) for serial connection, so that the serial connection of each server 1 is realized in sequence.
串接以后,其输入端口和输出端口即依次设定。在此串接过程中,并无需强制规定哪个端口为输入端口,哪个端口为输出端口。通过插入线即可判断哪个为输入端口,哪个为输出端口。当其在对各伺服器1的ID进行设定时,当前伺服器1内的舵机MCU13即可读取总线L1上的消息,并根据消息设定当前伺服器1的ID(将设定的ID替换存储在存储器中的原有ID)。并在完成设定ID的操作后,导通该当前伺服器1内的第一开关和第二开关,使下一伺服器1接入总线L1中,此时,下一伺服器1进入可被设定ID的状态,此时,下一伺服器1上即可通过插入线分别出输入端口和输出端口。如此循环,可依次设定各伺服器1的ID。After serial connection, the input port and output port are set in sequence. In this serial connection process, it is not mandatory to define which port is the input port and which port is the output port. You can judge which is the input port and which is the output port by inserting the wire. When it was setting the ID of each server 1, the steering gear MCU13 in the current server 1 can read the message on the bus L1, and set the ID of the current server 1 according to the message (will set ID replaces the original ID stored in memory). And after completing the operation of setting the ID, turn on the first switch and the second switch in the current server 1, so that the next server 1 is connected to the bus L1. At this time, the next server 1 can enter the Set the state of the ID, at this time, the input port and the output port can be respectively output on the next server 1 through the plug-in line. In such a cycle, the ID of each server 1 can be set sequentially.
其中,上述主控制器2和各伺服器1均可看做单独的节点,即各节点通过串接的方式串联,主控制器2相当于主节点、其余伺服器1成为从节点。Wherein, the above-mentioned main controller 2 and each server 1 can be regarded as separate nodes, that is, each node is connected in series through serial connection, the main controller 2 is equivalent to the master node, and the other servers 1 are slave nodes.
以在该第四接口24上串接有n个伺服器1为例进行具体解释说明,为方便描述起见,假设总是以各伺服器1的第一端口11为输入端口,以第二端口12为输出端口(实际上并不限制)。伺服器1第一伺服器1a的第一端口11通过总线L1连接到主控制器2的第四接口24;第一伺服器1a的第二端口12连接到第二伺服器1b的第一端口11;第二伺服器1b的第二端口12连接到第三伺服器1c的第一端口11……,以此类推;最终串联连接至第n伺服器1n。Take n servers 1 connected in series on the fourth interface 24 as an example for specific explanation. For the convenience of description, assume that the first port 11 of each server 1 is always used as the input port, and the second port 12 is an output port (actually not limited). The first port 11 of the first server 1a of the server 1 is connected to the fourth interface 24 of the main controller 2 through the bus L1; the second port 12 of the first server 1a is connected to the first port 11 of the second server 1b ; the second port 12 of the second server 1b is connected to the first port 11 of the third server 1c . . . and so on; finally connected in series to the nth server 1n.
当第四接口24内总线L1上的第四主控开关2d断开时,将使得串接在第四接口24上的第一伺服器1a、第二伺服器1b、第三伺服器1c……第n伺服器1n均处于与主控制器2断开通讯的状态,无法接收主控制器2广播的消息。当第四主控开关2d导通时,才使得串接在第四接口24上各伺服器1可以与主控制器2进行通讯,各伺服器1可以接收主控制器2广播的消息。然而,如果其中的任意一个伺服器1中接在输入端口上的舵机开关断开时,将使得自身和后续的伺服器1均与主控制器2断开通讯;如果任意一个伺服器1中接在输入端口内总线L1上的舵机开关接通,而接在输出端口内总线L1上的舵机开关断开时,将使得自身可与其前边的伺服器1导通;而后续的伺服器1都将处于与主控制器2断开通讯的状态。When the fourth main control switch 2d on the bus L1 in the fourth interface 24 is turned off, the first server 1a, the second server 1b, the third server 1c... The nth server 1n is in a state of disconnecting from the main controller 2 and cannot receive messages broadcast by the main controller 2 . When the fourth main control switch 2d is turned on, each server 1 serially connected to the fourth interface 24 can communicate with the main controller 2 , and each server 1 can receive messages broadcast by the main controller 2 . However, if the servo switch connected to the input port in any one of the servers 1 is disconnected, it will cause itself and the subsequent servers 1 to disconnect from the main controller 2; if any one of the servers 1 When the steering gear switch connected to the bus L1 in the input port is turned on, and when the steering gear switch connected to the bus L1 in the output port is turned off, it will make itself conduct with the server 1 in front of it; and the subsequent servo 1 will be in the state of disconnecting communication with the main controller 2.
可以这么理解,假设某伺服器1为当前伺服器1,只有所有当前伺服器1之前的伺服器1中的舵机开关均处于导通状态时,当前伺服器1才有可能通过控制内部2个舵机开关的通断,将自身及后续伺服器1也接入网络中;或者将自身接入到网络中,而将后续伺服器1断开。It can be understood in this way, assuming that a server 1 is the current server 1, only when all the servo switches in the server 1 before the current server 1 are in the on state, the current server 1 can control the internal two Turning on and off the steering gear switch connects itself and the follow-up server 1 to the network; or connects itself to the network and disconnects the follow-up server 1 .
比如,当当前伺服器1之前的伺服器1中的舵机开关均处于导通状态,而当前伺服器1中的第一舵机开关k1和第二舵机开关k2均与处于断开状态时,当前伺服器1与后续的伺服器1均无法接入当前伺服器1之前的总线L1中,即当前伺服器1和后续的伺服器1均无法与主控制器2进行通讯。此时,其可以通过检测第一插入线14和第二插入线15的信号来判断对应的第一端口11和第二端口12中那个为输入端口,哪个为输出端口;当其需要将当前伺服器1也接入网络时,当前伺服器1内的舵机MCU13向接在输入端口内总线L1上的舵机开关发送命令,使其导通,如此,即可将当前伺服器1接入网络中。当其舵机MCU13向接在输出端口内总线L1上的舵机开关也发送命令,使其导通,则将使得后续伺服器1也具备接入网络的基础。如果当前伺服器1接在输出端口内总线L1上的舵机开关断开,则无论后续伺服器1中的舵机开关如何动作,都将无法接入到网络中。For example, when the steering gear switches in the server 1 before the current server 1 are all on, and the first steering gear switch k1 and the second steering gear switch k2 in the current server 1 are both in the off state , neither the current server 1 nor the subsequent server 1 can be connected to the bus L1 before the current server 1, that is, neither the current server 1 nor the subsequent server 1 can communicate with the main controller 2. At this point, it can judge which of the corresponding first port 11 and second port 12 is an input port and which one is an output port by detecting the signals of the first plug-in line 14 and the second plug-in line 15; When the server 1 is also connected to the network, the steering gear MCU13 in the current server 1 sends a command to the steering gear switch connected to the bus L1 in the input port to make it conductive, so that the current server 1 can be connected to the network middle. When the steering gear MCU13 also sends a command to the steering gear switch connected to the bus L1 in the output port to make it conduct, the follow-up server 1 will also have the basis for accessing the network. If the servo switch of the current server 1 connected to the internal bus L1 of the output port is turned off, no matter how the servo switch in the subsequent server 1 operates, it will not be able to access the network.
本例提供的该伺服器控制系统,由于其改进了所述伺服器1,在伺服器1端口之间的总线L1上增加了两个舵机开关,并在舵机开关与端口之间设置插入线连接到舵机MCU13。如此,在将伺服器1连接到主控制器2上形成伺服器1控制系统时,无需考虑两个端口的输入输出关系,可以随意组装;组装完成后,通过插入线来检测信号,以分别哪个是输入端口、哪个是输出端口。根据需要,伺服器1也可以通过对两个开关的通断控制,其可以通过逐个将伺服器1接入网络的方式,逐个将伺服器1顺序设定ID,以防止出现重复ID,如此,使得其组装更简单,省去组装和维修时人为设定ID的困扰。伺服器不会出现由于装反而导致无法按照正确的设定逻辑动作的情况。The server control system provided in this example, because it improves the server 1, adds two steering gear switches on the bus L1 between the ports of the server 1, and inserts between the steering gear switches and the ports. The wire is connected to the servo MCU13. In this way, when connecting the server 1 to the main controller 2 to form the control system of the server 1, there is no need to consider the input and output relationship of the two ports, and it can be assembled at will; is the input port and which is the output port. According to needs, the server 1 can also control the on-off of the two switches, which can set the IDs of the servers 1 in sequence by connecting the servers 1 to the network one by one, so as to prevent duplicate IDs from appearing, so, It makes its assembly easier and saves the trouble of artificially setting the ID during assembly and maintenance. The server will not be unable to act according to the correct set logic due to reverse installation.
下面通过第四实施例对本发明公开的第三实施例中公开伺服器控制系统中的伺服器ID设定方法进行具体解释说明。The method for setting the server ID in the server control system disclosed in the third embodiment of the present invention will be specifically explained below through the fourth embodiment.
依次择一接通主控制器上的接口,重复通过以下步骤对接在主控制器的接口上的伺服器进行ID设定:如图5所示流程图,所述伺服器ID设定方法包括如下步骤:Select one in turn to connect to the interface on the main controller, and repeat the following steps to set the ID of the server connected to the interface of the main controller: the flow chart shown in Figure 5, the server ID setting method includes the following step:
S101、伺服器断开步骤:使依次串接在主控制器2接口上的各伺服器1预先处于断开状态;如此,使得各伺服器1均处于断开网络的状态,在此状态下,主控制器2广播的消息并不会往后传送。S101, the step of disconnecting the server: making each server 1 serially connected to the interface of the main controller 2 be disconnected in advance; in this way, each server 1 is disconnected from the network, and in this state, The message broadcast by the main controller 2 will not be transmitted later.
S102、伺服器ID设定步骤:主控制器2广播,向主控制器当前接通接口的总线L1发送将目标ID替换原有伺服器ID的消息;对应接口上各伺服器1内的舵机MCU13总是检测伺服器1内的第一插入线14和第二插入线15;并在舵机MCU13检测到第一插入线14或者第二插入线15中接收到信号时,判断接收到信号的插入线处的端口为输入端口,没有接收到信号的插入线处的端口为输出端口;然后使输入端口内总线L1上的舵机开关导通,将伺服器1接入网络,各伺服器1接入网络时接收主控广播的消息,根据消息将目标ID替换原有伺服器ID,完成该伺服器ID设定,并在设定伺服器ID后导通该伺服器1内两个舵机开关;在完成该伺服器ID设定后导通该伺服器1内两个舵机开关的目的是使下一伺服器1也可接收到主控制器2广播的消息。重复本步骤,直至完成所有伺服器1的ID设定。修改后的各目标ID互不相同,以保证不会出现重名的ID。S102, the server ID setting step: the main controller 2 broadcasts, and sends a message to replace the original server ID with the target ID to the bus L1 of the main controller currently connected to the interface; corresponding to the steering gear in each server 1 on the interface MCU13 always detects the first plug-in line 14 and the second plug-in line 15 in the servo 1; The port at the plug-in line is the input port, and the port at the plug-in line that does not receive the signal is the output port; then turn on the servo switch on the bus L1 in the input port, connect the server 1 to the network, and each server 1 When connecting to the network, receive the message broadcast by the master control, replace the original server ID with the target ID according to the message, complete the server ID setting, and turn on the two servos in the server 1 after setting the server ID Switch: After completing the setting of the server ID, the purpose of turning on the two servo switches in the server 1 is to make the next server 1 also receive the message broadcast by the master controller 2. Repeat this step until all server 1 ID settings are completed. The modified target IDs are different from each other to ensure that IDs with the same name will not appear.
S102步骤具体包括如下步骤:主控制器2广播,向总线L1发送将目标ID替换原有伺服器ID的消息;按顺序使串接的各伺服器1重复以下步骤:通过检测第一插入线14和第二插入线15的状态,判断伺服器1的输入端口和输出端口,然后导通伺服器1中接在输入端口内总线L1上的舵机开关,使该伺服器1接入网络中;然后伺服器1接收主控制器2广播的消息,将目标ID存储入存储器中,替换原有ID;然后在完成设定ID后或者同时导通伺服器1中的两个舵机开关。比如,第一个伺服器1修改以后的ID为1#;第二个伺服器1为2#,第三个伺服器1为3#,以此类推,直至完成所有伺服器1的ID设定。Step S102 specifically includes the following steps: the main controller 2 broadcasts, and sends a message to the bus L1 to replace the original server ID with the target ID; make each server 1 connected in series repeat the following steps in order: by detecting the first plug-in line 14 and the state of the second plug-in line 15, judge the input port and output port of the server 1, then turn on the servo switch connected to the bus L1 in the input port in the server 1, so that the server 1 is connected to the network; Then the server 1 receives the message broadcast by the main controller 2, stores the target ID in the memory, and replaces the original ID; then, after setting the ID, or at the same time, turn on the two servo switches in the server 1. For example, the modified ID of the first server 1 is 1#; the second server 1 is 2#, the third server 1 is 3#, and so on until the ID setting of all server 1 is completed .
本例提供的ID设定方法,可通过主控制器2周期性的广播,将各预先处于断开状态的伺服器1顺序接通,并按顺序将各伺服器1的ID改为目标ID。如此,通过本例提供的ID设定方法,使得伺服器1无需再装配前预先手动设置好不重复的ID,也无需考虑伺服器1与主控制器2连接成控制系统的过程中端口是否接反的问题,其可通过预先设定的程序,在接好伺服器控制系统后,自动完成伺服器1的ID设定。The ID setting method provided in this example can turn on the servers 1 that are in the disconnected state sequentially through the periodic broadcast of the main controller 2, and change the ID of each server 1 to the target ID in sequence. In this way, through the ID setting method provided in this example, the server 1 does not need to manually set a non-repeated ID before reassembly, and there is no need to consider whether the ports are reversed during the process of connecting the server 1 and the main controller 2 to form a control system For the problem, it can automatically complete the ID setting of the server 1 after the server control system is connected through the preset program.
在上述第四实施例中,需要较复杂的软件控制过程才能实现其方案,下面通过具体的第五实施例对第四实施例进行进一步的改进,以使其伺服器ID设定方法更为简单。In the above-mentioned fourth embodiment, a relatively complicated software control process is required to realize the solution. The fourth embodiment is further improved through the specific fifth embodiment below, so that the server ID setting method is simpler .
其中,同样的,主控制器2可以向各接口广播发送消息;同时,伺服器1内舵机MCU13可控制第一舵机开关k1和第二舵机开关k2的通断;各伺服器1可通过检测第一插入线14和第二插入线15,以判断输入端口和输出端口。当伺服器1的ID为某预设断开ID时,舵机MCU13控制输入端口内总线L1上的舵机开关导通,并使输出端口内总线L1上的舵机开关断开,将该伺服器1接通前边的总线L1中,而将该伺服器1后续的伺服器1断开。当伺服器1的ID与预设断开ID不同时,则舵机MCU13将控制两个舵机开关均导通;伺服器1可以接收输入端口上发过来的消息,将消息中的ID数据取出,并将其替换存储器中的原有ID。Wherein, similarly, the main controller 2 can broadcast and send messages to each interface; at the same time, the steering gear MCU13 in the server 1 can control the on-off of the first steering gear switch k1 and the second steering gear switch k2; each server 1 can The input port and the output port are judged by detecting the first insertion line 14 and the second insertion line 15 . When the ID of the server 1 is a preset disconnection ID, the steering gear MCU13 controls the steering gear switch on the bus L1 in the input port to be turned on, and disconnects the steering gear switch on the bus L1 in the output port, and the servo The server 1 is connected to the front bus L1, and the subsequent server 1 of the server 1 is disconnected. When the ID of server 1 is different from the preset disconnection ID, the servo MCU13 will control the two servo switches to be turned on; server 1 can receive the message sent from the input port, and take out the ID data in the message , and replace the original ID in memory.
依次择一接通主控制器上的接口,重复通过以下步骤对接在主控制器接通接口上的伺服器进行ID设定:具体的,如图6所示流程图,所述伺服器ID设定方法包括如下步骤:Select one of the interfaces on the main controller in turn, and repeat the following steps to set the ID of the server connected to the interface of the main controller: Specifically, as shown in the flow chart in Figure 6, the server ID setting The determination method includes the following steps:
S201、预设断开ID设定步骤:主控制器2广播,向总线L1上的所有伺服器1发送将伺服器1的原始ID改为某预设断开ID的消息;各伺服器1根据接收到的消息,将预设断开ID替换原始ID(即将预设断开ID存储入存储器中,以替换存储器中原有的ID);以将所有伺服器1的ID都设定为某预设断开ID。上述预设断开ID被用来作为伺服器1内第一舵机开关k1和第二舵机开关k2通断的判断条件,当伺服器1内的ID为预设断开ID时,则使伺服器1内输入端口内总线L1上的舵机开关接通,而使伺服器1内输出端口内总线L1上的舵机开关断开。也即各伺服器1预先处于断开的状态。当伺服器1内的ID为不同于预设断开ID的ID时,则使伺服器1内总线L1上的两个舵机开关导通。该预设断开ID为人为设定的任意值,比如,本例中设为0xFF。S201, preset disconnection ID setting steps: the main controller 2 broadcasts and sends a message to all servers 1 on the bus L1 to change the original ID of the server 1 to a preset disconnection ID; each server 1 according to In the received message, replace the original ID with the preset disconnection ID (that is, store the preset disconnection ID in the memory to replace the original ID in the memory); to set the IDs of all servers 1 to a certain preset Disconnect ID. The above-mentioned preset disconnection ID is used as the judgment condition for the on-off of the first steering gear switch k1 and the second steering gear switch k2 in the server 1. When the ID in the server 1 is the preset disconnection ID, the The steering gear switch on the bus L1 of the input port in the server 1 is turned on, and the steering gear switch on the bus L1 of the output port of the server 1 is turned off. That is, each server 1 is in a disconnected state in advance. When the ID in the server 1 is different from the preset off ID, the two servo switches on the bus L1 in the server 1 are turned on. The default disconnection ID is an arbitrary value set manually, for example, it is set to 0xFF in this example.
S202:目标ID替换预设断开ID步骤:主控制器2广播,向总线L1发送将目标ID替换预设断开ID的消息;各伺服器1顺序接入网络,并在伺服器1接入网络时将伺服器ID替换为目标ID,并在设定伺服器ID后导通伺服器1内所有舵机开关;然后重复本步骤,直至所有伺服器1完成ID设定。该目标ID不同于上述预设断开ID,且各伺服器1的目标ID互不相同。S202: The target ID replaces the preset disconnection ID Step: the main controller 2 broadcasts and sends a message to the bus L1 to replace the target ID with the preset disconnection ID; each server 1 accesses the network in sequence, and connects to the server 1 When networking, replace the server ID with the target ID, and turn on all the servo switches in server 1 after setting the server ID; then repeat this step until all server 1 complete the ID setting. The target ID is different from the aforementioned preset disconnection ID, and the target IDs of the servers 1 are different from each other.
其具体方式如下:先将所有伺服器1的ID都设定为预设断开ID,当伺服器1内的ID为预设断开ID时,则使伺服器1内输入端口内总线L1上的舵机开关接通,而使伺服器1内输出端口内总线L1上的舵机开关断开。然后主控制器2广播,向总线L1发送包含将目标ID替换预设断开ID的消息,各伺服器1按顺序逐个接收主控制器2广播的消息,逐一将各伺服器1的预设断开ID改为互不相同的目标ID。由于目标ID不与预设断开ID相同,修改后的伺服器1中的舵机开关导通;如此,紧接位于其后的伺服器1才能接收到来自主控制器2的消息。换言之,任何一个伺服器1在其前一个伺服器1设定ID之前,该伺服器1都无法连接到网络,其收不到主控制器2广播的消息。只有在前一个伺服器1完成ID设定后,该伺服器1才能连接到网络。The specific method is as follows: first set the IDs of all servers 1 as the default disconnection IDs, and when the IDs in the server 1 are the default disconnection IDs, then make the input port of the server 1 on the bus L1 The steering gear switch of the server 1 is turned on, and the steering gear switch on the bus L1 in the output port of the server 1 is turned off. Then the main controller 2 broadcasts and sends a message to the bus L1 including replacing the target ID with the preset disconnection ID. Each server 1 receives the messages broadcast by the main controller 2 one by one in order, and replaces the preset disconnection ID of each server 1 one by one. The opening ID is changed to a target ID that is different from each other. Since the target ID is not the same as the preset disconnection ID, the servo switch in the modified server 1 is turned on; thus, the server 1 immediately behind can receive the message from the master controller 2 . In other words, any server 1 cannot connect to the network before its previous server 1 sets the ID, and it cannot receive the message broadcast by the master controller 2 . Only after the ID setting of the previous server 1 is completed, the server 1 can be connected to the network.
具体的,最初状态下,只有第一个伺服器1的输入端口内总线L1上的舵机开关导通,可将第一个伺服器1接到主控制器2上,可以接收到主控制器2广播的消息,由于第一个伺服器1的输出端口内总线L1上的舵机开关断开,第二个伺服器1及以后的各个伺服器1均处于断开的状态,此时第一个伺服器1根据主控制器2广播的消息,将目标ID替换预设断开ID,完成第一个伺服器1的ID设定,然后使第一个伺服器1内的两个舵机开关都导通。如此,使得第二个伺服器1也可重复上述步骤完成ID设定并导通,如此,依次顺序完成所有伺服器1的ID设定。Specifically, in the initial state, only the servo switch on the bus L1 in the input port of the first server 1 is turned on, the first server 1 can be connected to the main controller 2, and the main controller can receive 2 broadcast message, because the servo switch on the bus L1 in the output port of the first server 1 is disconnected, the second server 1 and all subsequent servers 1 are in the disconnected state, at this time the first According to the message broadcast by the main controller 2, the first server 1 replaces the target ID with the preset disconnection ID, completes the ID setting of the first server 1, and then switches the two steering gears in the first server 1 Both are on. In this way, the second server 1 can also repeat the above steps to complete the ID setting and conduction, so that the ID setting of all servers 1 is completed in sequence.
本例提供的上述ID设定方法,其无需复杂的步骤,仅通过简单的主控制器2广播,各伺服器1根据接收到的消息,将预设断开ID逐一替换为互不相同的目标ID,可以快速的逐一完成各伺服器1的ID设定,其方法简单快捷。The above-mentioned ID setting method provided in this example does not require complicated steps. It only broadcasts through the simple main controller 2, and each server 1 replaces the preset disconnection ID with a different target one by one according to the received message. ID can quickly complete the ID setting of each server 1 one by one, and the method is simple and quick.
申请人在设置上述预设断开ID,并将各预设断开ID逐一替换为互不相同的目标ID时,发现由于其核心逻辑为当其伺服器1内的ID为预设断开ID时,则使伺服器1内输入端口内总线L1上的舵机开关接通,同时使伺服器1内输出端口内总线L1上的舵机开关断开。当伺服器1内的ID为非预设断开ID时,使伺服器1内总线L1上的两个舵机开关均导通。如此,可以使当前伺服器1完成ID设定,并在ID设定后导通当前伺服器1,使下一个伺服器1可以接入网络中重复上述过程,最终完成所有伺服器1的ID设定。然而,在将各伺服器1内最早存储的原始ID修改为预设断开ID之前,如果若干伺服器1中的原始ID就是预设断开ID,则在其原始ID为预设断开ID的伺服器1就将出现断开,导致后续伺服器1中的ID无法被修改为预设断开ID,最终导致无法按照设定的逻辑完成所有ID的设定。为此,作为改进,本例中采用以下第六实施例介绍的方案以防止上述错误的发生。When the applicant set the above preset disconnection IDs and replaced each preset disconnection ID with a different target ID one by one, he found that the core logic was that when the ID in the server 1 was the default disconnection ID , the steering gear switch on the bus L1 of the input port in the server 1 is turned on, and the steering gear switch on the bus L1 of the output port of the server 1 is turned off at the same time. When the ID in the server 1 is a non-default disconnection ID, both the steering gear switches on the bus L1 in the server 1 are turned on. In this way, the current server 1 can complete the ID setting, and turn on the current server 1 after the ID setting, so that the next server 1 can access the network and repeat the above process, and finally complete the ID setting of all servers 1. Certainly. However, before modifying the earliest stored original ID in each server 1 to the preset disconnection ID, if the original IDs in several servers 1 are the preset disconnection IDs, then when the original ID is the preset disconnection ID The server 1 will be disconnected, resulting in that the ID in the subsequent server 1 cannot be modified to the default disconnected ID, and eventually all ID settings cannot be completed according to the set logic. Therefore, as an improvement, in this example, the scheme described in the following sixth embodiment is adopted to prevent the occurrence of the above-mentioned errors.
下面通过第六实施例介绍一种进一步改进的预设断开ID设定方法,如图7所示流程图,其具体包括如下步骤:The following introduces a further improved preset disconnection ID setting method through the sixth embodiment, as shown in the flow chart in Figure 7, which specifically includes the following steps:
S2011、非预设断开ID设定步骤:主控制器2广播,向总线L1上的所有伺服器1发送将伺服器1的原始ID设定为某非预设断开ID的消息;各伺服器1根据接收到的消息,将非预设断开ID替换原始ID;且主控制器2回读总线L1上是否存在预设断开ID,即查找是否存在预设断开ID的伺服器1,如果存在预设断开ID,则主控制器2继续广播,直至所有伺服器1总线L1上的原始ID均被设定为非预设断开ID;在此情形下,即使有部分伺服器1的原始ID为预设断开ID(此时该原始ID为预设断开ID的伺服器1后续的伺服器1均处于断开状态,无法接收主控制器2广播的消息),该预设断开ID也可被修改为非预设断开ID,使得该伺服器1及后续的伺服器1均可接入网络,且后续的伺服器1将原始ID全部改为非预设断开ID;该非预设断开ID可以人为设定的任意与预设断开ID不相同的值。比如,本例中设定为0xFE。由于该非预设断开ID与预设断开ID不相同,因此,各伺服器1内的舵机开关均将处于导通状态,也即将各伺服器ID设定为非预设断开ID后,各伺服器1均导通接入网络中,各伺服器1均可接收主控制器2广播的消息。S2011. Non-preset disconnection ID setting step: the master controller 2 broadcasts and sends a message to all servers 1 on the bus L1 to set the original ID of the server 1 as a non-preset disconnection ID; The controller 1 replaces the original ID with the non-preset disconnection ID according to the received message; and the main controller 2 reads back whether there is a preset disconnection ID on the bus L1, that is, finds whether there is a server 1 with a preset disconnection ID , if there is a default disconnection ID, the main controller 2 continues to broadcast until the original IDs on the bus L1 of all servers 1 are set to non-default disconnection IDs; in this case, even if some servers The original ID of 1 is the default disconnection ID (at this time, the server 1 whose original ID is the default disconnection ID and the subsequent servers 1 are all disconnected and cannot receive the message broadcast by the main controller 2), the preset The disconnection ID can also be modified to a non-default disconnection ID, so that the server 1 and the subsequent server 1 can access the network, and the subsequent server 1 will change all the original IDs to non-default disconnection ID; the non-preset disconnection ID can be artificially set to any value different from the preset disconnection ID. For example, it is set to 0xFE in this example. Since the non-default disconnection ID is different from the default disconnection ID, the steering gear switches in each server 1 will be in a conducting state, that is, each server ID will be set to a non-default disconnection ID Afterwards, each server 1 is connected to the network, and each server 1 can receive the message broadcast by the main controller 2 .
S2022、预设断开ID替换非预设断开ID步骤:主控制器2广播,向总线L1上的所有伺服器1发送将所述非预设断开ID设定为预设断开ID的消息;各伺服器1根据接收到的消息,将预设断开ID替换所述非预设断开ID。S2022. The step of replacing the non-preset disconnection ID with the preset disconnection ID: the main controller 2 broadcasts and sends the message of setting the non-preset disconnection ID as the preset disconnection ID to all servers 1 on the bus L1 message; each server 1 replaces the non-preset disconnection ID with the preset disconnection ID according to the received message.
采用本例提供的该预设断开ID设定方法,其在设定预设断开ID之前,先将所有伺服器1的原始ID设置为某与预设断开ID不相同的非预设断开ID,再将非预设断开ID全部替换为预设断开ID。如此,有效的避免了上述实施例5中出现的问题(即指由于部分伺服器1的原始ID为预设断开ID,导致原始ID为预设断开ID的伺服器1后续的电机均无法被修改为预设断开ID,使得无法按照程序设定,将各伺服器1按顺序逐个接通并一一设定ID的操作的问题)。在此基础上,就可将所有伺服器的预设断开ID修改为互不相同的目标ID。最终实现了伺服器自动设定ID的目的。该方法无需复杂的步骤,简单快捷。Using the default disconnection ID setting method provided in this example, before setting the default disconnection ID, the original IDs of all servers 1 are set to a non-preset that is different from the preset disconnection ID Disconnect ID, and then replace all non-preset disconnect IDs with preset disconnect IDs. In this way, the problem in the above-mentioned embodiment 5 is effectively avoided (that is, because the original ID of some servers 1 is the preset disconnection ID, the subsequent motors of the servo 1 whose original ID is the preset disconnection ID cannot be It is modified to the default disconnection ID, so that it is impossible to follow the program setting, the problem of turning on each server 1 one by one and setting the ID one by one). On this basis, the default disconnection IDs of all servers can be modified to different target IDs. Finally, the purpose of automatically setting the ID by the server is realized. This method does not require complicated steps, and is simple and quick.
在第五实施例、第六实施例的基础上,下面通过第七实施例介绍改进后的伺服器ID设定方法。如图8所示流程图,该伺服器ID设定方法主要为第五实施例中的步骤,且将第六实施例中的S2011和S2012步骤替换原S201步骤。On the basis of the fifth embodiment and the sixth embodiment, the improved server ID setting method is introduced below through the seventh embodiment. As shown in the flowchart of FIG. 8 , the server ID setting method is mainly the steps in the fifth embodiment, and the steps S2011 and S2012 in the sixth embodiment are replaced with the original step S201.
采用本例提供的伺服器ID设定方法,其可以将各伺服器1的任意原始ID修改为非预设断开ID,然后将所有伺服器1的非预设断开ID修改为互不相同的目标ID。最终实现了伺服器1自动设定ID的目的。该方法无需复杂的步骤,简单快捷,且修改结果更准确可靠。Using the server ID setting method provided in this example, it can modify any original ID of each server 1 to a non-default disconnection ID, and then modify the non-default disconnection IDs of all servers 1 to be different from each other The target ID for . Finally, the purpose of server 1 automatically setting ID is realized. The method does not need complicated steps, is simple and fast, and the modification result is more accurate and reliable.
下面通过第八实施例进一步具体介绍进一步优化后的伺服器ID设定方法,根据需要,依次择一接通主控制器2接口内的主控开关,然后重复通过下述步骤对串接在接通的主控开关对应接口上的各伺服器1进行ID设定。此处所说的“依次择一接通”请结合图2-图4进行理解,比如,当第一接口21内的第一主控开关2a接通时,其余接口内的主控开关均断开;对接在第一接口21上的各伺服器ID进行设定。同样的,当第二接口22内的第二主控开关2b接通时,其余接口内的主控开关均断开;对接在第二接口22内的各伺服器ID进行设定。当第三接口23上的第三主控开关2c接通时,其余接口内的主控开关均断开;对接在第三接口23上的各伺服器ID进行设定。同样的,当第四接口24内的第四主控开关2d接通时,其余接口内的主控开关均断开;对接在第四接口24上的各伺服器ID进行设定。同样的,当第五接口25内的第五主控开关2e接通时,其余接口内的主控开关均断开;对接在第五接口25上的各伺服器ID进行设定。其中,依次并不指各接口只能按顺序接通,即并不一定要按照第一接口21、第二接口22、第三接口23、第四接口24和第五接口25顺序接通,也可以按其他不规则顺序进行接通,比如,按第一接口21、第三接口23、第四接口24、第二接口22、第五接口25等的顺序也是可以的。如此,可以逐串完成所有主控制器2接口上串接的伺服器设定ID;具体的串接在每个主控制器2接口上伺服器ID设定方法包括在伺服器1中的步骤和在主控制器2中的步骤:The following further describes the further optimized server ID setting method through the eighth embodiment. According to the needs, one of the main control switches in the interface of the main controller 2 is selected in sequence, and then the following steps are repeated to connect the serially connected The main control switch corresponding to each server 1 on the interface carries out ID setting. The "choose one to turn on" mentioned here should be understood in conjunction with Fig. 2-Fig. 4, for example, when the first main control switch 2a in the first interface 21 is turned on, the main control switches in the other interfaces are all off ; Set the IDs of the servers connected to the first interface 21 ; Similarly, when the second main control switch 2b in the second interface 22 is turned on, the main control switches in the other interfaces are all turned off; the IDs of the servers connected to the second interface 22 are set. When the third main control switch 2c on the third interface 23 is turned on, the main control switches in the other interfaces are all turned off; the IDs of the servers connected to the third interface 23 are set. Similarly, when the fourth main control switch 2d in the fourth interface 24 is turned on, the main control switches in the other interfaces are all turned off; the IDs of the servers connected to the fourth interface 24 are set. Similarly, when the fifth main control switch 2e in the fifth interface 25 is turned on, the main control switches in the other interfaces are all turned off; the IDs of the servers connected to the fifth interface 25 are set. Wherein, sequentially does not mean that each interface can only be connected in order, that is, it does not necessarily have to be connected in sequence according to the first interface 21, the second interface 22, the third interface 23, the fourth interface 24 and the fifth interface 25, and also Connections may be made in other irregular orders, for example, the order of the first interface 21, the third interface 23, the fourth interface 24, the second interface 22, the fifth interface 25, etc. is also possible. In this way, it is possible to set IDs of all servers serially connected to the interface of the main controller 2 one by one; the specific method of setting the server ID on each interface of the main controller 2 includes the steps in the server 1 and Steps in main controller 2:
其中,所述主控制器2中的步骤如图9所示,具体如下:Wherein, the steps in the main controller 2 are as shown in Figure 9, specifically as follows:
步骤S301、主控制器2广播,向总线L1发送将所有伺服器1的原始ID设定为某非预设断开ID的消息;具体的,该主控制器2广播消息,且回读总线L1上是否存在预设断开ID,如存在预设断开ID,则继续重复广播,直至将所有伺服器1原始ID设定为非预设断开ID时,才进入S302步骤,该非预设断开ID可以为人为设定的任意值,比如0xFE。Step S301, the main controller 2 broadcasts and sends a message to the bus L1 to set the original IDs of all servers 1 to a non-preset disconnection ID; specifically, the main controller 2 broadcasts the message and reads back the bus L1 Whether there is a preset disconnection ID on the network, if there is a preset disconnection ID, continue to repeat the broadcast until all the original IDs of the server 1 are set to non-default disconnection IDs, and then enter step S302, the non-default The disconnection ID can be any value set manually, such as 0xFE.
步骤S302、主控制器2广播,向总线L1发送将所有伺服器1的非预设断开ID设定为预设断开ID的消息;该预设断开ID可以为人为设定的任何值,且不同于非预设断开ID,比如0xFF。Step S302, the main controller 2 broadcasts and sends a message to the bus L1 to set the non-preset disconnection IDs of all servers 1 as the default disconnection ID; the preset disconnection ID can be any value set manually , and is different from non-preset disconnection ID, such as 0xFF.
步骤S303、主控制器2广播,重复向总线L1发送将预设断开ID设定为互不相同的目标ID的消息;本步骤中,主控制器2重复广播包含互不相同的目标ID的消息,每广播一次就回读总线L1上的消息,判断是否已将总线L1上可接收到广播的ID为预设断开ID的伺服器1完成目标ID的设定,如果已完成目标ID的设定,则进入下一广播,向总线L1发送将预设断开ID设定为另一与上次目标ID不相同的目标ID。以此类推。比如,主控制器2第一次广播将伺服器1的预设断开ID(0xFF)替换为目标ID(0x01)的消息。总线L1上的第一个伺服器1接收到该主控制器2广播的该消息后,即根据该消息将目标ID(0x01)替换该伺服器1中原有的预设断开ID(0xFF),并向总线L1上返回结果。主控制器2接收到该返回结果后,即进入下一轮广播,再次向总线L1发送将预设断开ID设定为另一与上次目标ID(0x01)不相同的目标ID(比如0x02)。然后主控制器2重复广播互不相同的目标ID,并接收总线L1上返回的结果。作为优选的方式,目标ID总是按顺序递增或递减。比如目标ID从0x01、0x02、0x03……0x0n依次递增。或者从0x0n……0x03、0x02、0x01依次递增。Step S303, the main controller 2 broadcasts, and repeatedly sends to the bus L1 the message that the preset disconnection ID is set as a target ID different from each other; in this step, the main controller 2 repeatedly broadcasts messages containing different target IDs. Message, read back the message on the bus L1 every time it is broadcast, and judge whether the server 1 whose ID can receive the broadcast on the bus L1 is the preset disconnection ID has completed the setting of the target ID, if the setting of the target ID has been completed If set, enter the next broadcast and send to the bus L1 to set the preset disconnection ID to another target ID different from the last target ID. and so on. For example, the main controller 2 broadcasts the message of replacing the default disconnection ID (0xFF) of the server 1 with the target ID (0x01) for the first time. After the first server 1 on the bus L1 receives the message broadcast by the main controller 2, it replaces the original preset disconnection ID (0xFF) in the server 1 with the target ID (0x01) according to the message, And return the result to the bus L1. After the main controller 2 receives the return result, it will enter the next round of broadcasting, and send the preset disconnection ID to another target ID (such as 0x02) different from the last target ID (0x01) to the bus L1 again. ). Then the main controller 2 repeatedly broadcasts different target IDs, and receives the returned results on the bus L1. As a preference, the target IDs are always sequentially incremented or decremented. For example, the target ID increases sequentially from 0x01, 0x02, 0x03...0x0n. Or increase sequentially from 0x0n...0x03, 0x02, 0x01.
所述伺服器1中的步骤如图10所示,具体如下:The steps in the server 1 are shown in Figure 10, specifically as follows:
S401、舵机MCU13读取存储在存储器中的舵机ID;S401, the steering gear MCU13 reads the steering gear ID stored in the memory;
S402、判断舵机ID是否为预设断开ID,如果判断结果为否,进入步骤S403,如果判断结果为是,则进入步骤S404;S402, judging whether the steering gear ID is a preset disconnection ID, if the judgment result is no, enter step S403, if the judgment result is yes, then enter step S404;
步骤S403、使第一舵机开关k1和第二舵机开关k2均接通,即使该伺服器1处于接通状态;Step S403, turning on both the first steering gear switch k1 and the second steering gear switch k2, even if the servo 1 is in the on state;
S404、检测第一插入线14和第二插入线15;然后分别进入步骤S405和步骤S406;S404. Detect the first insertion line 14 and the second insertion line 15; then enter step S405 and step S406 respectively;
S405、判断第一插入线14是否检测到信号,如果判断结果为否,则进入步骤S406,如果判断结果为是,则进入步骤S407;S405. Judging whether the first insertion line 14 has detected a signal, if the judgment result is no, proceed to step S406, and if the judgment result is yes, proceed to step S407;
S406、使第一舵机开关k1断开;S406. Turn off the first steering gear switch k1;
S407、使第一舵机开关k1接通;S407. Turn on the first steering gear switch k1;
S408、判断第二插入线15是否检测到信号,如果判断结果为是,则进入步骤S409,如果判断结果为否,则进入步骤S410;S408, judging whether the second insertion line 15 detects a signal, if the judging result is yes, go to step S409, if the judging result is no, go to step S410;
S409、使第二舵机开关k2接通;S409. Turn on the second steering gear switch k2;
S410、使第二舵机开关k2断开。S410. Turn off the second steering gear switch k2.
该步骤S403的含义为如果不为预设断开ID,则表示该伺服器1将被接通,该伺服器1具备可以接收主控制器2广播的信息的基础(是否能接收到主控制器2广播的消息,还取决于在该伺服器1之前是否存在ID为预设断开ID的伺服器1,如果该伺服器1之前存在ID为预设断开ID的伺服器1,则该伺服器1同样因为前面的伺服器1断开,使得其处于同样无法接收到主控制器2广播的消息的状态),并可根据接收到的主控制器2广播的消息完成相应的动作。The meaning of this step S403 is that if it is not the preset disconnection ID, it means that the server 1 will be connected, and the server 1 has the basis for receiving the information broadcast by the main controller 2 (whether it can receive the information from the main controller or not). 2 The broadcast message also depends on whether there is a server 1 whose ID is the default disconnection ID before the server 1. If there is a server 1 whose ID is the preset disconnection ID before the server 1, the server The server 1 is also in a state of being unable to receive the message broadcast by the main controller 2 because the previous server 1 is disconnected), and can complete corresponding actions according to the received message broadcast by the main controller 2.
步骤S404-S410的含义为,当该伺服器1内的ID为预设断开ID时,舵机MCU13检测第一插入线14和第二插入线15中的信号,当其中的任一插入线检测到信号时,则表示该检测到信号的插入线连接到的端口为输入端口;反之,没有检测到信号的插入线连接到的端口为输出端口(由于各伺服器1通过串接的方式接在主控制器2的接口上,因此,由于信号的单向流动,其结果只能是一个插入线检测到信号时,另一插入线必然检测不到信号,因此可以以此判断谁是输入端口和输出端口);然后,将输入端口内总线L1上的舵机开关接通,而将输出端口内总线L1上的舵机开关断开;如此,即可使该伺服器1被连接到前序的总线L1中,使其可以接收到主控制器2广播的消息,并根据该消息完成相应的操作(比如将其修改为目标ID或者预设断开ID等)。且使输出端口上的舵机开关断开,使得该伺服器1后续的伺服器1无法再接收到主控制器2广播的消息。比如,当第一插入线14检测到信号时,表示对应的第一端口11为输入端口,则接通该第一端口11内的第一舵机开关k1;如此,第二插入线15中将检测不到信号,表示对应的第二端口12为输出端口,则断开第二端口12内的第二舵机开关k2。The meaning of steps S404-S410 is that when the ID in the server 1 is the preset disconnection ID, the servo MCU 13 detects the signals in the first plug-in line 14 and the second plug-in line 15, and when any of the plug-in lines When a signal is detected, it means that the port connected to the plug-in line that detects the signal is an input port; otherwise, the port connected to the plug-in line that does not detect the signal is an output port (because each server 1 is connected in series) On the interface of the main controller 2, therefore, due to the one-way flow of the signal, the result can only be that when one plug-in line detects the signal, the other plug-in line must not detect the signal, so it can be judged who is the input port and output port); then, turn on the servo switch on the bus L1 in the input port, and turn off the steering gear switch on the bus L1 in the output port; in this way, the servo 1 can be connected to the front sequence In the bus L1 of the main controller 2, it can receive the message broadcast by the main controller 2, and complete the corresponding operation according to the message (such as modifying it to the target ID or preset disconnection ID, etc.). And the servo switch on the output port is turned off, so that the subsequent servers 1 of the server 1 can no longer receive the message broadcast by the main controller 2 . For example, when the first plug-in line 14 detects a signal, it means that the corresponding first port 11 is an input port, and the first servo switch k1 in the first port 11 is turned on; thus, the second plug-in line 15 will If no signal is detected, it means that the corresponding second port 12 is an output port, and the second steering gear switch k2 in the second port 12 is turned off.
在本例提供的ID设定方法中,在主控制器2进行步骤S301时,接在主控制器2对应接口上的伺服器1都会进入步骤S401-S403的判断过程,由于在此过程中,大部分情况下,伺服器1中的原始ID都不是预设断开ID(如0xFF),使得所有伺服器1中的舵机开关都将被接通,且使各伺服器1接收主控制器2广播的消息,将伺服器1中的原始ID设定为非预设断开ID(如0xFE);即使其中有部分伺服器1的原始ID为预设断开ID,其也可以经步骤S401、S402、S404-S410修改为非预设断开ID,并使其在下一个循环内使该已经修改成非预设断开ID的伺服器1导通,使后续的伺服器1也可以接收到主控制器2的广播,再进入S401-S303的步骤,如此,使得所有伺服器1的原始ID最终都被修改为非预设断开ID。In the ID setting method provided in this example, when the main controller 2 performs step S301, the server 1 connected to the corresponding interface of the main controller 2 will enter the judgment process of steps S401-S403, because in this process, In most cases, the original ID in server 1 is not the default disconnection ID (such as 0xFF), so that the servo switches in all server 1 will be turned on, and each server 1 will receive the master controller 2 broadcast message, set the original ID in the server 1 to a non-preset disconnection ID (such as 0xFE); even if some of the original IDs of the server 1 are preset disconnection IDs, it can also pass step S401 , S402, S404-S410 to modify the non-preset disconnection ID, and make it turn on the server 1 that has been modified to the non-preset disconnection ID in the next cycle, so that the subsequent server 1 can also receive The broadcast of the main controller 2 then enters the steps of S401-S303, so that the original IDs of all servers 1 are eventually modified to non-preset disconnection IDs.
然后主控制器2进行步骤S302,此时,主控制器2广播,向总线L1发送将所有伺服器1的非预设断开ID设定为预设断开ID的消息;此时,由于主控制器2经过上述步骤S301及各伺服器1经过S401-S410步骤后,已将所有伺服器1的ID修改为非预设断开ID,此时,总线L1上的各伺服器1接收到上述总线L1上的将所有伺服器1的非预设断开ID设定为预设断开ID的消息,即执行将预设断开ID替换原有非预设断开ID的操作;各伺服器1执行步骤S401-S403,将所有伺服器1ID设定为预设断开ID。一旦各伺服器1完成设定预设断开ID的操作;则在下一周期中,伺服器1重复执行S401、S402、S404-S410的步骤;如此,将使得各伺服器1均保持其中的输入端口内总线L1上的舵机开关导通,而使各伺服器1输出端口内总线L1上的舵机开关断开。如此,也就使得仅有串接在主控制器2接口上的第一个伺服器1能接收到主控制器2广播的该消息,第一个伺服器1以后的伺服器1均处于断开状态,无法接收到主控制器2广播的消息,其结果使得最终所有伺服器1的ID都被修改为预设断开ID存储在存储器中。Then the main controller 2 performs step S302. At this time, the main controller 2 broadcasts and sends a message that the non-preset disconnection IDs of all servers 1 are set to the preset disconnection IDs to the bus L1; After the controller 2 has gone through the above step S301 and each server 1 has gone through the steps S401-S410, the IDs of all the servers 1 have been changed to non-default disconnection IDs. At this time, each server 1 on the bus L1 receives the above The message of setting the non-default disconnection IDs of all servers 1 to the default disconnection IDs on the bus L1 is to perform the operation of replacing the original non-default disconnection IDs with the default disconnection IDs; each server 1 Execute steps S401-S403 to set all server IDs as default disconnection IDs. Once each server 1 completes the operation of setting the default disconnection ID; then in the next cycle, the server 1 repeats the steps of S401, S402, S404-S410; thus, each server 1 will maintain the input The steering gear switch on the bus L1 in the port is turned on, and the steering gear switch on the bus L1 in the output port of each server 1 is turned off. In this way, only the first server 1 serially connected to the interface of the main controller 2 can receive the message broadcast by the main controller 2, and the servers 1 after the first server 1 are all disconnected. state, the message broadcast by the main controller 2 cannot be received, and as a result, the IDs of all servers 1 are modified to the preset disconnection IDs and stored in the memory.
然后主控制器2进行步骤S303,此时,主控制器2广播,重复向总线L1发送将预设断开ID设定为互不相同的目标ID的消息;当主控制器2在该阶段初次广播将某目标ID(如0x01)替换预设断开ID时,仅有第一个伺服器1能接收到广播,该第一个伺服器1接收到信号,执行步骤S401、S402、S404-S410;如此,将第一个伺服器1接收到的目标ID(如0x01)替换原有预设断开ID;当主控制器2回读到总线L1上返回的第一个伺服器1已完成ID设定的结果后,主控制器2进入下一轮广播,向总线L1发送将不同于上次广播的目标ID(如0x02)替换预设ID的消息,第一个伺服器1执行步骤S401-S403,但其不修改其存储器内存储的ID(0x01),第二个伺服器1执行S401、S402、S404-S410,将第二个伺服器1上输入端口内总线L1上的舵机开关导通,而使各伺服器1输出端口内总线L1上的舵机开关断开。该第二个伺服器1接收到主控制器2广播的消息,将目标ID(即0x02)替换预设断开ID。当主控制器2回读到总线L1上返回的第二个伺服器1已完成ID设定的结果后,主控制器2进入下一轮广播,向总线L1发送将不同于上述2次广播的目标ID(如0x03)替换预设ID的消息,第一个、第二个伺服器1执行步骤S401-S403,但其不修改其存储器内存储的ID,第三个伺服器1执行S401、S402、S404-S410,将第三个伺服器1上输入端口内总线L1上的舵机开关导通,而使各伺服器1输出端口内总线L1上的舵机开关断开。该第三个伺服器1接收到主控制器2广播的消息,将目标ID(即0x03)替换预设断开ID。如此循环,主控制器2重复广播,各伺服器1依次完成各不相同的目标ID替换预设断开ID的步骤,最终将所有目标ID替换预设断开ID。Then main controller 2 carries out step S303, at this moment, main controller 2 broadcasts, repeatedly sends to bus L1 the message that preset disconnection ID is set as mutually different target ID; When a target ID (such as 0x01) is replaced with the preset disconnection ID, only the first server 1 can receive the broadcast, and the first server 1 receives the signal, and executes steps S401, S402, S404-S410; In this way, replace the original preset disconnection ID with the target ID (such as 0x01) received by the first server 1; when the main controller 2 reads back the returned first server 1 on the bus L1 has completed the ID setting After the results are obtained, the main controller 2 enters the next round of broadcasting, and sends a message to the bus L1 to replace the preset ID with a target ID (such as 0x02) different from the previous broadcasting, and the first server 1 executes steps S401-S403, But it does not modify the ID (0x01) stored in its memory, the second server 1 executes S401, S402, S404-S410, and turns on the servo switch on the bus L1 in the input port of the second server 1, And the servo switch on the bus L1 in the output port of each server 1 is turned off. The second server 1 receives the message broadcast by the main controller 2, and replaces the default disconnection ID with the target ID (ie 0x02). When the main controller 2 reads back the result that the second server 1 has completed the ID setting returned on the bus L1, the main controller 2 enters the next round of broadcast, and sends to the bus L1 a target that will be different from the above two broadcasts ID (such as 0x03) replaces the preset ID message, the first and second servers 1 execute steps S401-S403, but they do not modify the ID stored in their memory, and the third server 1 executes S401, S402, S404-S410, turn on the steering gear switch on the bus L1 in the input port of the third server 1, and turn off the steering gear switch on the bus L1 in the output port of each server 1. The third server 1 receives the message broadcast by the main controller 2, and replaces the default disconnection ID with the target ID (ie 0x03). In such a cycle, the main controller 2 repeats the broadcast, and each server 1 sequentially completes the steps of replacing the preset disconnection ID with different target IDs, and finally replaces all target IDs with the default disconnection ID.
如此,经过上述步骤,即完成了所有伺服器1设定ID的过程。In this way, through the above steps, the process of setting IDs for all servers 1 is completed.
本例提供的伺服器ID设定方法,无需复杂的软件设置流程,仅需简单地经过主控制器2广播消息,各伺服器1内部自行根据设定的程序及接收到的主控制器2广播的消息,自动完成伺服器1的ID设定。The server ID setting method provided in this example does not require a complicated software setting process. It only needs to simply broadcast a message through the main controller 2, and each server 1 will broadcast the message according to the set program and the received main controller 2. message, the ID setting of server 1 is automatically completed.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.
Claims (5)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610506209.4A CN106054819B (en) | 2016-06-30 | 2016-06-30 | Method for setting preset disconnection ID of server in server control system |
| JP2017125811A JP6482606B2 (en) | 2016-06-30 | 2017-06-28 | Servo actuator ID setting method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610506209.4A CN106054819B (en) | 2016-06-30 | 2016-06-30 | Method for setting preset disconnection ID of server in server control system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106054819A true CN106054819A (en) | 2016-10-26 |
| CN106054819B CN106054819B (en) | 2018-12-04 |
Family
ID=57201410
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610506209.4A Active CN106054819B (en) | 2016-06-30 | 2016-06-30 | Method for setting preset disconnection ID of server in server control system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106054819B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112936219A (en) * | 2019-12-11 | 2021-06-11 | 精工爱普生株式会社 | Identification number setting system, identification number setting method, and robot system |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6105077A (en) * | 1997-01-21 | 2000-08-15 | Nittan Company, Limited | Transmitting system with address polling for providing a control signal to open/close switch |
| CN101417425A (en) * | 2007-10-26 | 2009-04-29 | 应广科技股份有限公司 | Multiple servo motor control system and method |
| CN101635637A (en) * | 2008-07-21 | 2010-01-27 | 江森自控楼宇设备科技(无锡)有限公司 | Method and system for distributing intelligent addresses based on serial bus |
| CN102498444A (en) * | 2009-07-27 | 2012-06-13 | 齐尔-阿贝格股份公司 | Device and method for assigning addresses to servo units |
-
2016
- 2016-06-30 CN CN201610506209.4A patent/CN106054819B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6105077A (en) * | 1997-01-21 | 2000-08-15 | Nittan Company, Limited | Transmitting system with address polling for providing a control signal to open/close switch |
| CN101417425A (en) * | 2007-10-26 | 2009-04-29 | 应广科技股份有限公司 | Multiple servo motor control system and method |
| CN101635637A (en) * | 2008-07-21 | 2010-01-27 | 江森自控楼宇设备科技(无锡)有限公司 | Method and system for distributing intelligent addresses based on serial bus |
| CN102498444A (en) * | 2009-07-27 | 2012-06-13 | 齐尔-阿贝格股份公司 | Device and method for assigning addresses to servo units |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112936219A (en) * | 2019-12-11 | 2021-06-11 | 精工爱普生株式会社 | Identification number setting system, identification number setting method, and robot system |
| CN112936219B (en) * | 2019-12-11 | 2023-12-08 | 精工爱普生株式会社 | Identification number setting system, identification number setting method, and robot system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106054819B (en) | 2018-12-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9960930B2 (en) | Bus node and bus system and method for identifying the bus nodes of the bus system | |
| CN101719112A (en) | Half-duplex automatic receiving-transmitting switching circuit of RS485 | |
| WO2010009584A1 (en) | Method and system for smart address assignment based on serial bus | |
| CN105988404A (en) | Server control system | |
| US11159369B2 (en) | Automatic initialization routine in an automation system | |
| CN117319124A (en) | Coupling module, data transmission device and switching method | |
| CN105974890A (en) | a server | |
| CN205844810U (en) | a master controller | |
| CN201557127U (en) | RS485 half-duplex transmit-receive automatic switch circuit | |
| CN206075045U (en) | Server control system | |
| CN106200560A (en) | How to set the server ID of the server control system | |
| CN206075121U (en) | a server | |
| CN106054819A (en) | Method for setting server preset disconnection ID in server control system | |
| CN218974809U (en) | Equipment cascading device and system | |
| JP6482606B2 (en) | Servo actuator ID setting method | |
| CN118573499A (en) | Terminal equipment automatic identification and terminal resistance automatic access device and method thereof | |
| CN109901540B (en) | Automatic matching method, circuit and equipment for parallel machine CAN matching resistor | |
| CN216527159U (en) | Communication isolation circuit and device | |
| CN105404271A (en) | Centralized body control system and identity early warning method thereof | |
| CN116782059A (en) | Method for realizing automatic addressing of nodes in control sensor serial networking | |
| CN103473206A (en) | Data transmission method and I2C (Inter-Integrated Circuit) interface extender | |
| CN115658583A (en) | LIN automatic addressing system and method combined with single-wire bidirectional protocol | |
| JP2006174352A (en) | Remote I / O module communication device | |
| CN108737583A (en) | From the configuration method of controller and configuration system in system | |
| CN114168514A (en) | Communication isolation circuit and device |
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 | ||
| CP01 | Change in the name or title of a patent holder |
Address after: 518000 16th and 22nd Floors, C1 Building, Nanshan Zhiyuan, 1001 Xueyuan Avenue, Nanshan District, Shenzhen City, Guangdong Province Patentee after: Shenzhen UBTECH Technology Co.,Ltd. Address before: 518000 16th and 22nd Floors, C1 Building, Nanshan Zhiyuan, 1001 Xueyuan Avenue, Nanshan District, Shenzhen City, Guangdong Province Patentee before: Shenzhen UBTECH Technology Co.,Ltd. |
|
| CP01 | Change in the name or title of a patent holder |