[go: up one dir, main page]

WO2010009584A1 - Method and system for smart address assignment based on serial bus - Google Patents

Method and system for smart address assignment based on serial bus Download PDF

Info

Publication number
WO2010009584A1
WO2010009584A1 PCT/CN2008/001814 CN2008001814W WO2010009584A1 WO 2010009584 A1 WO2010009584 A1 WO 2010009584A1 CN 2008001814 W CN2008001814 W CN 2008001814W WO 2010009584 A1 WO2010009584 A1 WO 2010009584A1
Authority
WO
WIPO (PCT)
Prior art keywords
slave
host
address
command
accordance
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.)
Ceased
Application number
PCT/CN2008/001814
Other languages
French (fr)
Inventor
Xi Luo
Hongchen Xu
Yunfeng Zhang
Lei Shi
Zhifeng Zhang
Yuanhui Liu
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Johnson Controls Building Efficiency Technology Wuxi Co Ltd
Johnson Controls Technology Co
Original Assignee
Johnson Controls Building Efficiency Technology Wuxi Co Ltd
Johnson Controls Technology Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Johnson Controls Building Efficiency Technology Wuxi Co Ltd, Johnson Controls Technology Co filed Critical Johnson Controls Building Efficiency Technology Wuxi Co Ltd
Publication of WO2010009584A1 publication Critical patent/WO2010009584A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/403Bus networks with centralised control, e.g. polling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • H04L12/40019Details regarding a bus master
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]

Definitions

  • the invention generally relates to smart address assignment, and more particularly, to a method and system of smart address assignment based on a serial bus under the master-slave communication mode
  • a serial bus is widely used in the industrial control field When a s ⁇ nal bus is used, all devices on the bus share communication media, and the communication information sent by any device can be received by other devices on the bus In order to identify the devices which send or receive the information, it is necessary to assign one communication address to each device Generally, a bus has two types of operation modes, i e master-slave mode and "alternate master- alternate slave" mode The latter does not perform well when there are a large number of nodes, therefore, the communication network architecture of "single master, mulu slaves" is used in the most conditions in the industrial control Under the master-slave mode, lhe whole communication bus system is composed of one master node and several slave nodes, wherein the master node continuously checks whether the slave nodes have communication request in turn If the slave nodes have communication request, then the bus control nght is given to a slave node, and the slave node surrenders the bus control nght when it finishes sending communication Only when the host determines the address of the slave
  • a host is connected to a plurality of slaves, and the location of each slave is unfixed and slaves are separated by a long distance. Accordingly it is very likely to set repeated addresses by manually setting the device addresses.
  • many hosts are closed hosts, therefore only when the housing of the machine is opened, can simple settings be done. If the users maintain the salves or newly add slave devices, it tends to cause some unexpected malfunctions.
  • Fig. Ia which shows a network architecture of RS485 bus in the prior art
  • the network is comprised of one host and three slaves 1, 2, 3.
  • Figs Ib and Ic illustrate the structural views of the host and the slave in the prior art respectively.
  • the host in the prior art includes an MCU microcontroller, a communication module, a memory and a DIP input device.
  • the communication module is connected to twisted pair lines, and connected to the MCU microcontroller. Under the control of the MCU microcontroller, the communication module executes the normal sending and receiving functions.
  • the MCU microcontroller is connected to the communication module and memory respectively.
  • the memory is used to store each inputted salve address, and provides it to the MCU microcontroller for retrieval.
  • the DIP input switch is used to input each set slave address to the memory " . It is necessary to manually input the set address of each slave into the host of the prior art, therefore, it is necessary to pro ⁇ de an input device, i.e. DIP input switch, for correctly inputting the set slave address to the memory.
  • the slave of the prior art includes an MCU microcontroller, a communication module, a memory and a DIP input device. It is necessary to manually input the set address of each slave of the prior art, therefore, it is necessary to provide an input device, i.e. DIP input switch.
  • the device addresses are not allowed to be duplicate, and the device address on the bus is unique.
  • the manual setting process if a user inadvertently sets the addresses of two slaves, e.g. slave 1 and salve 3, as OxOl, then, according to the bus character, if the host sends a command to the slaves of address 0x01, slaves 1 and 3 each will receive the instruction, and answer the host, so that two slaves sending messages at the same time in the network will cause the communication failure at all the terminals, i.e. cause bus conflict, and hence the whole system cannot operate.
  • There is an urgent need for automatic address assignment under the master-slave communication mode in the application For example, if some slave stations are added to an existing system, the problem of duplicate addresses may occur; similarly, when a damaged slave station is replaced, it is also possible to cause the problem that the addresses are duplicate.
  • an address assignment method in a serial bus system including at least one host and at least one slave, the method including the following steps: a, providing an electronic physical switch for each of the at least one slave in a serial bus, to control the line connection/disconnection between each said slave and its next slave adjacent thereto; b, disconnecting the electronic physical switch of each of the at least one slaves ; c, after the host assigns an address to the slave which is to be assigned an address and which is the most adjacent to the host, close the electronic physical switch of the said slave.
  • step c is repeated, until the address assignment is completed for all of the slaves.
  • the host sends an initialization command to the slaves, to disconnect the electronic physical switches.
  • the method also includes the following step: the host sends an address checking command to the slaves, and the slave with an address that matches the address to be checked in the address checking command sends an acknowledgement response to the host.
  • the address assignment method further includes step d: the host regularly sends polling command to the slaves, the polling command includes the address of each slave. More preferably, the polling command also includes an address of an original value.
  • the address assignment method further includes: e. add at least one additional slave in the serial bus system; f. initialize the additional slave, to disconnect the electronic physical switch of the additional slave, and set the address of the additional slave as the original value; g. the additional slave with an address that matches the address which is the original value in the polling command sends the acknowledgement response to the host, store the said address, and close the electronic physical switch of the said additional slave. More preferably, step g is repeated, until the address assignment is completed for all of the additional slaves.
  • the address assignment method further includes the step of determining whether the effectively-assigned address is less than the number of the slaves.
  • the original value of the slave address is OxFF.
  • the electronic physical switch is a relay. According to another aspect of the invention, it provides a host for a serial bus system.
  • the serial bus system also includes at least one slave and the host includes: a controller; a communication module connected to the controller, for sending data to the at least one slave and receiving data from the at least one slave; a memory connected to the controller, for accessing the address data of the at least one slave; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
  • the controller includes: an initialization command unit, for sending an initialization command to the at least one slave when the initialization switch is activated; and an address assignment command sending unit, for sending an address assignment command to the at least one slave.
  • the controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave. More preferably, the polling command also includes an address of an original value.
  • the controller also includes an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
  • an exception processing module for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
  • the controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
  • the communication module is a RS485 communication module.
  • the memory is a nonvolatile memory.
  • the initialization switch is a JP jumper switch or a trigger key switch.
  • it provides a slave for a serial bus system.
  • the serial bus system also includes at least one host, the slave including: a controller; a communication module connected to the controller, for sending data to the at least one host and receiving data from the at least one host; a memory connected to the controller, for accessing the address data of the slave; an electronic physical switch connected in the serial bus and located downstream of the communication module; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
  • the slave including: a controller; a communication module connected to the controller, for sending data to the at least one host and receiving data from the at least one host; a memory connected to the controller, for accessing the address data of the slave; an electronic physical switch connected in the serial bus and located downstream of the communication module; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
  • the controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the initialization switch is activated or after receiving the initialization command sent by the at least one host; an address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time closing the electronic physical switch.
  • an initialization command executing unit for disconnecting the electronic physical switch and setting its own address as an original value, when the initialization switch is activated or after receiving the initialization command sent by the at least one host
  • an address assignment command sending unit for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time closing the electronic physical switch.
  • the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
  • the communication module is a R.S485 communication module.
  • the memory is a nonvolatile memory.
  • the initialization switch is a JP jumper switch or a trigger key switch.
  • the electronic physical switch is a relay.
  • the system includes: at least one host; at least one slave; a serial bus including pair lines; wherein each of the at least one slave includes an electronic physical switch, and wherein the pair lines in the serial bus are lead from the host, and in turn pass the electronic physical switch of each of the at least one slave.
  • each of the at least one host includes: a host controller; a host communication module connected to the host controller, for sending data to the at least one slave and receiving data from the at least one slave; a host memory connected to the host controller, for accessing the address data of the at least one slave; and a host initialization switch connected to the host controller, for starting the initialization operation when the host initialization switch is activated.
  • the host controller includes: an initialization command unit, for sending an initialization command to the at least one slave when the host initialization switch is activated; and a host address assignment command sending unit, for sending an address assignment command to the at least one slave.
  • the host controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave. More preferably, the polling command also includes an address of an original value.
  • the host controller also includes an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
  • an exception processing module for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
  • the host controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
  • the host communication module is a RS485 communication module.
  • the host memory is a nonvolatile memory.
  • the host initialization switch is a JP jumper switch or a trigger key switch.
  • each of the at least one slave includes: a slave controller; a slave communication module connected to the slave controller, for sending data to the at least one host and receiving data from the at least one host; a slave memory connected to the slave controller, for accessing the address data of the at least one slave; an electronic physical switch connected in the serial bus and located downstream of the slave communication module; and a slave initialization switch connected to the slave controller, for starling the initialization operation when the slave initialization switch is activated.
  • the slave controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the slave initialization switch is activated or after the initialization command sent by the at least one host is received; a slave address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time close the electronic physical switch.
  • an initialization command executing unit for disconnecting the electronic physical switch and setting its own address as an original value, when the slave initialization switch is activated or after the initialization command sent by the at least one host is received
  • a slave address assignment command sending unit for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time close the electronic physical switch.
  • the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
  • the slave communication module is a RS485 communication module.
  • the slave memory is a nonvolatile memory.
  • the slave initialization switch is a JP jumper switch or a trigger key switch.
  • the electronic physical switch is a relay.
  • the host when adding a new slave to the system, just activate the initialization key on the slave, the host will execute the address assignment of the newly-inserted slave without affecting the communication of other slaves.
  • the invention can realize automatic address assignment in serial bus systems, so as to avoid the problems of high error rate and low efficiency during manual setting process.
  • Fig. Ia is a network architecture of RS485 bus in the prior art
  • Fig. Ib is a structure scheme of a host hi the prior art
  • Fig. Ic is a structure scheme of of a slave in the prior art
  • Fig 2 is a network architecture of a smart address assignment system according to an embodiment of the invention.
  • Fig 3 is a structure scheme of a host according to an embodiment of the invention
  • Fig 4 is a structure scheme of slave according to an embodiment of the invention
  • Fig 5 is a flow-chart of a smart address assignment method according to one embodiment of the invention
  • Fig 6 is a flow-chart of a smart address assignment method according to another embodiment of the invention.
  • Fig 7 is a flow-chart of a smart address assignment method according to yet another embodiment of the invention.
  • Fig 8 is a flow-chart showing the initialization process of a slave according to one embodiment of the invention.
  • RS485 bus As an example.
  • the invention is not limited to RS485 bus, but it may be advantageous to use other buses, e.g. RS 422 bus.
  • Fig 2 is a network architecture of a smart address assignment system according to an embodiment of the invention.
  • the system includes a host 100, a plurality of slaves 200 , and RS485 bus 300, wherein host 100 is the commands starter , slaves 200 are the receiver and executor of the commands, and the host 100 and the slaves 200 are connected through RS485 bus to realize the sending and receiving of instructions.
  • Each slave 200 is set with an electronic physical switch 205.
  • the twisted pair lines of RS485 bus are lead out from the host 100, the twisted pair lines are firstly lead into the input terminal of the electronic physical switch of the first slave, then lead to the input terminal of the electronic physical switch of the second slave from the output terminal of the electronic physical switch of the first slave, and on the analogy of this operation, the network is build up.
  • Fig 3 shows a structure scheme of host 100 according to an embodiment of the invention, wherein host 100 includes a host controller 101 (e.g. host MCU microcontroller), a host communication module 102, a host memory 103, and a host initialization switch 104.
  • host controller 101 e.g. host MCU microcontroller
  • the host communication module 102 is connected to the host MCU microcontroller 101 and the twisted pair lines respectively, and executes normal sending and receiving functions under the control of the host MCU microcontroller 101;
  • the host MCU microcontroller 101 is connected to the host communication module 102 and the host memory 103 respectively, so as to implement initialization actions, automatically assign each slave address, store the assigned slave addresses, and regularly poll the slaves, and when it is found that a new slave is connected in, read the assigned slave address in the host memory 103, automatically increase it sequentially to create a new address, and assign it to the newly-connected slave;
  • the host memory 103 is used to automatically store the addresses which are assigned to the corresponding slaves by the host 100, and provide them to the host MCU microcontroller 101 for retrieval;
  • the host initialization switch 104 is connected to the host MCU microcontroller 101, so as to start initialization actions after it is pressed.
  • the initialization actions include: setting all the slave addresses with a predetermined value, such as OxFF, assigning addresses to all slaves in the network, and recording and storing them into the host memory 103.
  • the host initialization switch 104 is a JP jumper switch or trigger key switch
  • the host memory 103 is a flash memory.
  • the host initialization switch 104 is not limited to the switch described above, which may be a toggle switch or any other suitable switch.
  • the host memory 103 is also not limited to abovementioned memory, which may be any other suitable memory.
  • the host memory is preferably a nonvolatile memory, including but not limited to, floppy disk, Random-access memory (RAM), Read-only memory (ROM), Erasable Programmable Read-Qnly Memory (EPROM or flash memory), etc.
  • the host controller 101 is also not limited to MCU microcontroller, which may be any suitable controller.
  • the host controller 101 may be also connected to an alarm device (not shown) for giving off voice and/or light alarm during communication failure.
  • the host controller may include the following functional modules: an initialization command unit, for sending an initialization command to the slave after the initialization switch is pressed; and an address assignment command sending unit, for sending an address assignment command to the slave.
  • the host controller may also include a polling module, for regularly sending a polling command to the slave.
  • the host controller may also include an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
  • the host controller may also include an address checking command sending unit, for sending an address checking command to the slave.
  • Fig 4 is a structure scheme of slave 200 according to an embodiment of the invention.
  • slave 200 includes a slave controller 201, such as MCU microcontroller, a slave communication module 202, a slave memory 203, an electronic physical switch 205, and a slave initialization switch 204.
  • the electronic physical switch 205 is a relay (normally closed, in order not to affect the communication of other slaves when this slave is switched off or malfunctioned, which is equivalent to the case where this slave is not connected on the bus), and the slave initialization switch is a JP jumper switch.
  • the electronic physical switch 205 and the slave initialization switch 204 are not limited to the abovementioned types, but may be any other suitable types.
  • the slave controller 201 is not limited to MCU microcontroller, but may be any other suitable controller.
  • the slave communication module 202 is connected to the slave MCU microcontroller 202 and the twisted pair lines respectively, and the twisted pair lines are lead out after passing through the relay 205;
  • the slave memory 203 is used to store the assigned address of slave 200;
  • the relay 205 executes connection/disconnection under the control of the slave MCU microcontroller 201, and is closed in the default state, so as not to affect the normal communication of other devices when starting or initialization can not be executed due to the faults that occur at the slave nodes;
  • the slave initialization switch 204 is a JP jumper, for initializing the address based on the control of the slave MCU microcontroller 201, for example, it may be necessary to initialize the address as factory default setting after the device is repaired.
  • the slave controller can include the following functional modules: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, after the initialization switch is activated or after the initialization command sent by the host is received; an address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment. and making a response when it receives an address assignment command sent by the host, and at the same time closing the electronic physical switch.
  • the slave controller may also include an address checking command answering unit, for making a response after receiving an address checking command sent by the host.
  • Fig.5 is a flowchart of a smart address assignment method according to one embodiment of the invention.
  • the system operation is started from step 502, and at this time, both the host and the slaves are powered up.
  • the host initialization switch 104 is pressed, and the initialization command units of the host controller 101 of the host 100 sends the initialization commands to slaves 200, so that the initialization command executing units of the slave controllers of all slaves 200 take action to disconnect the relays 205, and all of the slave addresses are set with a predetermined value, such as Oxff.
  • the initialization command is sent consecutively for 20 times, to assure that the slaves have received them.
  • step 506 the address assignment command unit of the host controller 101 of the host 100 sends effectively-assigned addresses to slaves 200, and the address assignment command sending units of the slave controllers of the slaves 200 which have not been assigned the addresses, after receiving the addresses, use the assigned addresses to replace Oxff, close the relay, and make a responses. If there is a response, then the operation proceeds to step 508, i.e. waiting for the answer of slaves or until a predetermined waiting time, such as 100 ms. If there is a response, then the effectively-assigned address is increased according to a predetermined sequence, e.g. increased by 1 and the operation proceeds to step 506 again.
  • a predetermined sequence e.g. increased by 1
  • step 506 the address assignment command sending unit of the slave controller of another slave which is the nearest to the said slave, after receiving the address assignment command, stores the address, closes its relay 205 and makes a response. If there is no answer after step 506 has been entered for a plurality of times (such as 10 times), then it is considered that the addresses have been assigned to all of the slaves, and subsequently the operation proceeds to step 510, wherein automatic address assignment is completely finished.
  • Fig 6 is a flowchart of a smart address assignment method according to another embodiment of the invention.
  • the system operation is started from step 602, and at this time, both the host and the slaves are powered up.
  • the host 100 in the system determines whether the system initialization is necessary by checking the host initialization switch 104 (jumper switch state or key switch state). For example, the system automatically sets that, when the host initialization switch is 1, it is needed to perform initialization, and when the host initialization switch is 0, it is not necessary to perform initialization.
  • the host initialization switch 104 jumper switch state or key switch state
  • the initialization command unit of the host controller 101 of host 100 consecutively sends address assignment group-sending commands to slaves 200 for many times, so that the initialization command executing units of the slave controller of all slaves 200 take action to disconnect the relay 205, and the slave addresses are set with a predetermined value, such as Oxff.
  • the host 100 consecutively sends the commands for 20 times, to assure that the slaves receive them.
  • step 606 the system enters step 606 and at this time the system reads the list of assigned slave addresses from the designated memory area, and subsequently enters step 608, wherein it enters the normal communication program, and polls the slaves. It should be understood that the system may also has the opposite settings.
  • step 612 since the original bus is physically disconnected, but there is always one node which is uniquely connected to the host (the nearest node), the address checking command sending unit of the host controller 101 of the host 100 sends address checking command to the nearest slave 200, wherein the carried target address is Oxff, and the address checking command answering unit of the slave controller of the slave whose address is Oxff makes a response after receiving the command, and if the host does not receive the answer of the slave after a predetermined time (such as 30s), an alarm is triggered. Otherwise the system enters step 614, and waits for the answer of the slave or waits for a predetermined time, such as 100ms.
  • a predetermined time such as 100ms.
  • step 614 If the slave makes a response in step 614, then the system enters step 616, and the system sends the effective slave addresses to be assigned. Otherwise, the system returns to step 612.
  • step 618 the address assignment command sending unit of the host controller 101 of the host sends the effectively-assigned address to the slaves, which carry the formally-assigned address, and the addresses to be assigned which the address assignment command sending unit of the slave controller of the slave 200 receives, and uses the formally-assigned address to replace Oxf ⁇ closes its relay 205 and makes a response. If there is a response, the effectively-assigned addresses is increased according to a predetermined sequence (e.g.
  • step 616 again, and at this time, previous slave which has been assigned an address also receives the assigned address that the host sends to the slave. However, since it finds that the address does not match its assigned address, the slave would not make a response. But the address assignment command sending unit of the slave controller of another slave which is the nearest to this slave, after receiving the address assignment command, stores the address, closes the relay 205 and makes a response. If there is no response after step 618 has been entered for a plurality of times (such as 10 times), then it is considered that the addresses have been assigned to all of the slaves, and subsequently the process enters step 620 wherein the system address assignment ends, the largest assigned address of the slaves is stored and the success of automatic assignment is suggested.
  • Fig 7 is a flowchart of a smart address assignment method according to another embodiment of the invention.
  • the system operation starts from step 702, and at this time, both the host and the slaves are powered up.
  • the host 100 in the system determines whether the system initialization is necessary by checking the host initialization switch 104 (jumper switch state or key switch state). For example, the system automatically sets that, when the host initialization switch is 1, it is needed to perform initialization, and when the host initialization switch is 0, it is unnecessary to perform initialization. In other words, if the host initialization switch is 1, then the system enters step 710, and at this time, the system starts to read the total number of the slaves.
  • the host initialization switch 104 jumper switch state or key switch state
  • step 706 the system enters step 706, and at this time the system reads the list of the assigned slave addresses from the designated memory area, and subsequently enters steps 708, wherein it enters the normal communication program, and polls the slaves. It should be understood that, the system may also have the opposite settings.
  • step 712 the initialization command unit of the host controller 101 of the host 100 consecutively sends address assignment group-sending commands to slaves 200 for many times so that the initialization command executing units of the slave controllers of all slaves 200 take action to disconnect the relays 205, and the slave addresses are set as Oxff. In one embodiment, host 100 consecutively sends the commands for 20 times, to assure that the slaves receive them.
  • step 714 since the original bus is physically disconnected, but there is always one node which is uniquely connected to the host (the nearest node), therefore the address checking command sending unit of the host controller 101 of the host 100 sends address checking command to the nearest slave 200, wherein the carried target address is Oxff, and the address assignment command sending unit of the slave controllers of the slave whose address is Oxff makes a response after receiving the command, and if the host does not receive the answer of the slave after a predetermined time (e.g. 30s), an alarm will be triggered, otherwise the process enters step 716, and waits for the answer of the slave or waits for a predetermined time, such as 100ms.
  • a predetermined time e.g. 30s
  • step 718 the address assignment command sending unit of the host controller 101 of the host sends the effective slave address to be assigned to the slaves, wherein the effective slave address carries formally-assigned address, and the address assignment command sending unit of the slave controller of slaves 200 which have not been assigned addresses, after receiving the addresses, uses the formally-assigned address to replace Oxff and closes its relay 205 and makes a response.
  • step 720 the system waits for the answer of the slave or for 100 ms again. If there is no response, then the system will return to step 716, otherwise the system will enter step 722.
  • step 722 the system determines whether "effectively-assigned address ⁇ SlaveNum>" is valid. If it is valid, the effectively-assigned address will be added by 1, and the system will enter step 720 again, otherwise, the system will enter step 724 wherein the system address assignment ends, the largest assigned address of the slaves is stored and the success of automatic assignment is suggested.
  • Fig 8 is a flowchart showing the initialization process of a slave according to one embodiment of the invention.
  • the slave 200 is powered up.
  • slaves 200 determines whether the system initialization is necessary by checking the slave initialization switch 204. For example, the system automatically sets that, when the slave initialization switch is 1, it is needed to perform initialization, and when the slave initialization switch is 0, it is unnecessary to perform initialization.
  • step 610 the system enters step 610, and at this time the initialization command executing units of the slave controllers of the slaves set their memories 203 as factory " default setting value, such as Oxff, and the relay 205 is disconnected, to wait for the assigned address. If the slave initialization switch is 0, then the system enters step 806, and determines whether the address has been assigned, and subsequently enters step 808 and turns to the normal communication mode. It should be understood that, the system may also has the opposite settings. ⁇ /hen a new slave 200 is to be inserted in the original network, it is just needed to activate the sla ⁇ e initialization switch 204, and resume the default setting Oxff.
  • the slave would wait for an address assignment command, disconnect the switch of its relay 205, and then be directly inserted to the newly connected network and the host initialization switch 104 is pressed again, so that the smart address assignment of all slaves can be automatically completed all over again.
  • an address can be assigned to the newly-inserted slave, without having the host initialization switch 104 pressed again.
  • the polling module of the host controller of the host can be set such that Oxff device searching command is added to the command sent during polling.
  • the host can also be set such that it separately sends a command to inquire the OxFF address when the bus is idle after the ending of all normal communications.
  • the period of the normal communication is different according to different system conditions, for example, the period may be 10s. Both of the above methods can be used to assign addresses to the newly-inserted slaves.
  • the invention will be described by taking the example wherein OxFF device searching command is added to the command sent by the host during regular polling. Firstly, the initialization switch of the new slave is activated, and the default setting Oxff is resumed. During polling of the host, the polling module of the host controller would receive a response once it sends OxFF device searching command, which means that a new slave has been inserted. Subsequently, the exception processing module of the host controller of the host invokes the address assignment command unit to assign an address to the new slave, until the assignment for all new slaves is completed.
  • the host on the basis of the assigned address number, increases the address number sequentially, and assigns them to the newly-added slaves.
  • the aforementioned polling command sent by the host may be sent regularly, wherein carried target addresses are respectively the addresses of the slaves, and also include one Oxff address.
  • the invention is further described in combination with a communication protocol stack, wherein the data frame format is comprised of 23 bytes.
  • the specific data frame format is described as follows:
  • each byte respectively represents: STX: 0x02. This value is just an example value, and it should be understood that, it may be other values;
  • CMD data format type
  • Dest Addr destination address of data sending
  • Source Addr source address of data sending
  • DATA 16-byte sending data
  • ETX 0x03. This value is just an example value, and it should be understood that, it may be other values.
  • one host and three slaves I 3 2 and 3 constitute one control network, and is taken as an example embodiment.
  • the addresses which the host assigns to the slaves start from 0x01.
  • the normal state of the relay in each slave is in closed state. It should be understood that, the addresses of the slaves are not limited to starting from 0x01, which may be selected any one from 0x00 -OxFE
  • the host will automatically enter the initialization process: 1.
  • the host sends the initialization command: STX + 0x5A + OxFF + 0x00 + Data + CRC16 + ETX (any data)
  • the host consecutively sends it for 5 seconds, and after three slaves receive effective information, delays for 3 seconds to disconnect the relay, and at the same time set its own address as Oxff.
  • slave 1 sends the response to the host:
  • the destination address 0x00 is the address of the host
  • the source address OxFF is the address of the slave. 3.
  • the destination address is 0x01, which represents that the assignment starts from 0x01;
  • slave 1 After receiving the command, slave 1 sends acknowledgement response to the host:
  • slave 1 After slave 1 receives the command, slave 1 compares the address in the command with its assigned address, finds that the addresses do not match, then neglects it and does not answer it; after receiving the command, slave 2 stores the address (i.e. replaces Oxff with the address in the command) and sends the acknowledgement response to the host: STX + OxAo + 0x00 + 0x02 + Data + CRC16 + ETX (any Data) and at the same time closes the relay, and connects next slave 3.
  • slave 3 After slave 1 and slave 2 receive the command and find that the address in the command and their assigned addresses do not match, then neglect them and do not answer them; after receiving the command, slave 3 stores the address and sends the acknowledgement response to the host:
  • the host consecutively sends it for 10 times, and if there is no response, the address assignment ends.
  • the format of the address assignment command is not limited to the above format, but may be any other suitable format, for example, it may apply the format that carries assigned address in the Data bit.
  • the slave whose address is Oxff after receiving the command, uses Addr to replace Oxff, and sends the acknowledgement response, and at the same time connects the communication of the next slave
  • the first slave finds that it is not its own address by comparison and does not answer it; after receiving the command, the second slave finds that the command is just for itself, then the second slave uses Addr + 1 to replace Oxff, and answers it , and at the same time connects the next slave
  • the address checking is not executed after the initialization step, and the address assignment can be directly executed. In another embodiment, every time before address assignment, address checking is executed once.
  • Oxff is resumed. Then, slave 4 is directly inserted to the network. After slave 4 is powered up, it finds that the initialization switch is pressed, then slave 4 starts initialization, disconnects the relay, and waits for the address assignment.
  • Slaves 1, 2 and 3 receive the command and find that the address in the command does not match their assigned addresses, and then neglect it; after receiving the command, slave 4 stores the address and sends the acknowledgement response to the host: STX + 0xA6 + 0x00 + 0x04 + Data + CRC 16 + ETX (any Data)
  • the host consecutively sends it for 10 times, and if there is no response, the address assignment ends.
  • one new slave 5 is added in the network between slave 1 and slave 2
  • one new slave 6 is added between slave 3 and slave 4
  • the initialization switches of slaves 5 and 6 are pressed, the factory default setting Oxff is resumed, and then the slaves are directly inserted to the network.
  • slave 5 and salve 6 are powered up and find that the initialization switches are pressed, then slave 5 and slave 6 start initialization, disconnect the relay, and wait for the address assignment.
  • slave 6 Since slave 6 is located downstream of slave 5, when the relay of slave 5 has been disconnected, only slave 5 is the slave that is connected to the host and whose address is Oxff, i.e., in the system, at any time, there is no more than one slave whose address is Oxff is connected to the host.
  • slave 1 After slave 1 receives the command and finds that the address in the command does not match its assigned address, slave 1 neglects it; after receiving the command, slave 5 sends the acknowledgement response to the host:
  • slave 1 After slave 1 receives the command and finds that the address in the command does not match its assigned address, slave 1 neglects it; after receiving the command, slave 5 saves the address and sends the acknowledgement response to the host: STX + 0xA6 + 0x00 + 0x05 + Data + CRC 16 + ETX (any Data) and at the same time closes the relay, and connects slave 6.
  • the host sends the formal address assignment command to the slaves again: STX + 0x5C + 0x07 + 0x00 + Data + CRC16 + ETX (any Data)
  • the host consecutively sends it for 10 times, and if there is no response, the address assignment ends.
  • the invention is not limited to the detailed form disclosed in the abovementioned preferred implementing scheme.
  • the invention can also be applied in multi- master and multi-slave system.
  • this kind of system there would be one master station which realizes the address assignment, and the other master stations may not take part in the address assignment, or they may be treated as a special slave station (with some kind of special mark).

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Selective Calling Equipment (AREA)

Abstract

The invention provides a system for a smart address assignment. The system includes: a host, including an MCU controller which executes address assignment function, a communication module, a memory and an initialization switch; a slave, including an MCU controller which executes address assignment function, a communication module, an electronic physical switch, a memory and an initialization switch; wherein the network is formed in the following manner: after being lead out from the host, the twisted pair lines are lead into the input terminal of the electronic physical switch of the first slave, then are lead from the output terminal of the electronic physical switch of the first slave to the input terminal of the electronic physical switch of the second slave.

Description

Method and System for Smart Address Assignment Based on Serial Bus
Technical Field
The invention generally relates to smart address assignment, and more particularly, to a method and system of smart address assignment based on a serial bus under the master-slave communication mode
Background
A serial bus is widely used in the industrial control field When a sεnal bus is used, all devices on the bus share communication media, and the communication information sent by any device can be received by other devices on the bus In order to identify the devices which send or receive the information, it is necessary to assign one communication address to each device Generally, a bus has two types of operation modes, i e master-slave mode and "alternate master- alternate slave" mode The latter does not perform well when there are a large number of nodes, therefore, the communication network architecture of "single master, mulu slaves" is used in the most conditions in the industrial control Under the master-slave mode, lhe whole communication bus system is composed of one master node and several slave nodes, wherein the master node continuously checks whether the slave nodes have communication request in turn If the slave nodes have communication request, then the bus control nght is given to a slave node, and the slave node surrenders the bus control nght when it finishes sending communication Only when the host determines the address of the slaves, can the communication be established, and the address of the salves must be unique in the network At one time, only one node in the bus can be the master node which is in the sending state, while all of the other nodes must be in the receiving state If there are two nodes or more in the sending state at one time, it will cause the data sending failure of all sending parties, i e the said bus conflict
Currently, in a senal bus system which employs master-slave communication mode, generally, device addresses are set manually Generally, the address setting is done through the following process, i e manually setting the assigned device address of a DIP switch on the slave in advance, then recording the assigned address numbers, and then inputting the assigned addresses of the slave devices to the host, so as to establish the communication In the industrial application, e.g. in a central air-conditioning system, generally, a host is connected to a plurality of slaves, and the location of each slave is unfixed and slaves are separated by a long distance. Accordingly it is very likely to set repeated addresses by manually setting the device addresses. Additionally, many hosts are closed hosts, therefore only when the housing of the machine is opened, can simple settings be done. If the users maintain the salves or newly add slave devices, it tends to cause some unexpected malfunctions.
For example, as shown in Fig. Ia, which shows a network architecture of RS485 bus in the prior art, the network is comprised of one host and three slaves 1, 2, 3. Figs Ib and Ic illustrate the structural views of the host and the slave in the prior art respectively. As shown, the host in the prior art includes an MCU microcontroller, a communication module, a memory and a DIP input device. The communication module is connected to twisted pair lines, and connected to the MCU microcontroller. Under the control of the MCU microcontroller, the communication module executes the normal sending and receiving functions. The MCU microcontroller is connected to the communication module and memory respectively. The memory is used to store each inputted salve address, and provides it to the MCU microcontroller for retrieval. The DIP input switch is used to input each set slave address to the memory". It is necessary to manually input the set address of each slave into the host of the prior art, therefore, it is necessary to proλάde an input device, i.e. DIP input switch, for correctly inputting the set slave address to the memory. Similarly, the slave of the prior art includes an MCU microcontroller, a communication module, a memory and a DIP input device. It is necessary to manually input the set address of each slave of the prior art, therefore, it is necessary to provide an input device, i.e. DIP input switch.
According to the electrical characteristic of the bus, the device addresses are not allowed to be duplicate, and the device address on the bus is unique. However, in the manual setting process, if a user inadvertently sets the addresses of two slaves, e.g. slave 1 and salve 3, as OxOl, then, according to the bus character, if the host sends a command to the slaves of address 0x01, slaves 1 and 3 each will receive the instruction, and answer the host, so that two slaves sending messages at the same time in the network will cause the communication failure at all the terminals, i.e. cause bus conflict, and hence the whole system cannot operate. There is an urgent need for automatic address assignment under the master-slave communication mode in the application. For example, if some slave stations are added to an existing system, the problem of duplicate addresses may occur; similarly, when a damaged slave station is replaced, it is also possible to cause the problem that the addresses are duplicate.
Summary of the Disclosure According to an aspect of the invention, it provides an address assignment method in a serial bus system, the serial bus system including at least one host and at least one slave, the method including the following steps: a, providing an electronic physical switch for each of the at least one slave in a serial bus, to control the line connection/disconnection between each said slave and its next slave adjacent thereto; b, disconnecting the electronic physical switch of each of the at least one slaves ; c, after the host assigns an address to the slave which is to be assigned an address and which is the most adjacent to the host, close the electronic physical switch of the said slave.
Preferably, step c is repeated, until the address assignment is completed for all of the slaves. Preferably, in step b, the host sends an initialization command to the slaves, to disconnect the electronic physical switches.
Preferably, before step c, the method also includes the following step: the host sends an address checking command to the slaves, and the slave with an address that matches the address to be checked in the address checking command sends an acknowledgement response to the host.
Preferably, the address assignment method further includes step d: the host regularly sends polling command to the slaves, the polling command includes the address of each slave. More preferably, the polling command also includes an address of an original value.
Preferably, the address assignment method further includes: e. add at least one additional slave in the serial bus system; f. initialize the additional slave, to disconnect the electronic physical switch of the additional slave, and set the address of the additional slave as the original value; g. the additional slave with an address that matches the address which is the original value in the polling command sends the acknowledgement response to the host, store the said address, and close the electronic physical switch of the said additional slave. More preferably, step g is repeated, until the address assignment is completed for all of the additional slaves. Preferably, the address assignment method further includes the step of determining whether the effectively-assigned address is less than the number of the slaves. Preferably, the original value of the slave address is OxFF. Preferably, the electronic physical switch is a relay. According to another aspect of the invention, it provides a host for a serial bus system.
The serial bus system also includes at least one slave and the host includes: a controller; a communication module connected to the controller, for sending data to the at least one slave and receiving data from the at least one slave; a memory connected to the controller, for accessing the address data of the at least one slave; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
Preferably, the controller includes: an initialization command unit, for sending an initialization command to the at least one slave when the initialization switch is activated; and an address assignment command sending unit, for sending an address assignment command to the at least one slave. Preferably, the controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave. More preferably, the polling command also includes an address of an original value.
Preferably, the controller also includes an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
Preferably, the controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
Preferably, the communication module is a RS485 communication module. Preferably, the memory is a nonvolatile memory.
Preferably, the initialization switch is a JP jumper switch or a trigger key switch.
According to yet another aspect of the invention, it provides a slave for a serial bus system.
The serial bus system also includes at least one host, the slave including: a controller; a communication module connected to the controller, for sending data to the at least one host and receiving data from the at least one host; a memory connected to the controller, for accessing the address data of the slave; an electronic physical switch connected in the serial bus and located downstream of the communication module; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
Preferably, the controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the initialization switch is activated or after receiving the initialization command sent by the at least one host; an address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time closing the electronic physical switch.
Preferably, the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
Preferably, the communication module is a R.S485 communication module.
Preferably, the memory is a nonvolatile memory. Preferably, the initialization switch is a JP jumper switch or a trigger key switch.
Preferably, the electronic physical switch is a relay.
According to yet another aspect of the invention, it provides a system. The system includes: at least one host; at least one slave; a serial bus including pair lines; wherein each of the at least one slave includes an electronic physical switch, and wherein the pair lines in the serial bus are lead from the host, and in turn pass the electronic physical switch of each of the at least one slave.
Preferably, each of the at least one host includes: a host controller; a host communication module connected to the host controller, for sending data to the at least one slave and receiving data from the at least one slave; a host memory connected to the host controller, for accessing the address data of the at least one slave; and a host initialization switch connected to the host controller, for starting the initialization operation when the host initialization switch is activated.
Preferably, the host controller includes: an initialization command unit, for sending an initialization command to the at least one slave when the host initialization switch is activated; and a host address assignment command sending unit, for sending an address assignment command to the at least one slave.
Preferably, the host controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave. More preferably, the polling command also includes an address of an original value.
Preferably, the host controller also includes an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
Preferably, the host controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
Preferably, the host communication module is a RS485 communication module. Preferably, the host memory is a nonvolatile memory.
Preferably, the host initialization switch is a JP jumper switch or a trigger key switch.
Preferably, each of the at least one slave includes: a slave controller; a slave communication module connected to the slave controller, for sending data to the at least one host and receiving data from the at least one host; a slave memory connected to the slave controller, for accessing the address data of the at least one slave; an electronic physical switch connected in the serial bus and located downstream of the slave communication module; and a slave initialization switch connected to the slave controller, for starling the initialization operation when the slave initialization switch is activated.
Preferably, the slave controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the slave initialization switch is activated or after the initialization command sent by the at least one host is received; a slave address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time close the electronic physical switch.
Preferably, the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
Preferably, the slave communication module is a RS485 communication module. Preferably, the slave memory is a nonvolatile memory.
Preferably, the slave initialization switch is a JP jumper switch or a trigger key switch. Preferably, the electronic physical switch is a relay.
Using the invention, when adding a new slave to the system, just activate the initialization key on the slave, the host will execute the address assignment of the newly-inserted slave without affecting the communication of other slaves. The invention can realize automatic address assignment in serial bus systems, so as to avoid the problems of high error rate and low efficiency during manual setting process.
Brief Description of the Drawings
When thinking over the detailed description of the disclosed implementing scheme referring to the drawings below, the invention can be better understood, wherein: Fig. Ia is a network architecture of RS485 bus in the prior art; Fig. Ib is a structure scheme of a host hi the prior art; Fig. Ic is a structure scheme of of a slave in the prior art;
Fig 2 is a network architecture of a smart address assignment system according to an embodiment of the invention;
Fig 3 is a structure scheme of a host according to an embodiment of the invention; Fig 4 is a structure scheme of slave according to an embodiment of the invention; Fig 5 is a flow-chart of a smart address assignment method according to one embodiment of the invention; Fig 6 is a flow-chart of a smart address assignment method according to another embodiment of the invention; and
Fig 7 is a flow-chart of a smart address assignment method according to yet another embodiment of the invention;
Fig 8 is a flow-chart showing the initialization process of a slave according to one embodiment of the invention.
Detailed Description
In the embodiments of the invention, the invention is described in detail by taking RS485 bus as an example. However, it should be understood that, the invention is not limited to RS485 bus, but it may be advantageous to use other buses, e.g. RS 422 bus.
Fig 2 is a network architecture of a smart address assignment system according to an embodiment of the invention. As is shown, the system includes a host 100, a plurality of slaves 200 , and RS485 bus 300, wherein host 100 is the commands starter , slaves 200 are the receiver and executor of the commands, and the host 100 and the slaves 200 are connected through RS485 bus to realize the sending and receiving of instructions. Each slave 200 is set with an electronic physical switch 205. After the twisted pair lines of RS485 bus are lead out from the host 100, the twisted pair lines are firstly lead into the input terminal of the electronic physical switch of the first slave, then lead to the input terminal of the electronic physical switch of the second slave from the output terminal of the electronic physical switch of the first slave, and on the analogy of this operation, the network is build up.
In details, as shown in Fig 3, it shows a structure scheme of host 100 according to an embodiment of the invention, wherein host 100 includes a host controller 101 (e.g. host MCU microcontroller), a host communication module 102, a host memory 103, and a host initialization switch 104. In the host, the host communication module 102 is connected to the host MCU microcontroller 101 and the twisted pair lines respectively, and executes normal sending and receiving functions under the control of the host MCU microcontroller 101; the host MCU microcontroller 101 is connected to the host communication module 102 and the host memory 103 respectively, so as to implement initialization actions, automatically assign each slave address, store the assigned slave addresses, and regularly poll the slaves, and when it is found that a new slave is connected in, read the assigned slave address in the host memory 103, automatically increase it sequentially to create a new address, and assign it to the newly-connected slave; the host memory 103 is used to automatically store the addresses which are assigned to the corresponding slaves by the host 100, and provide them to the host MCU microcontroller 101 for retrieval; the host initialization switch 104 is connected to the host MCU microcontroller 101, so as to start initialization actions after it is pressed. The initialization actions include: setting all the slave addresses with a predetermined value, such as OxFF, assigning addresses to all slaves in the network, and recording and storing them into the host memory 103. In this embodiment, the host initialization switch 104 is a JP jumper switch or trigger key switch, and the host memory 103 is a flash memory. However, it should be understood that, the host initialization switch 104 is not limited to the switch described above, which may be a toggle switch or any other suitable switch. Likewise, the host memory 103 is also not limited to abovementioned memory, which may be any other suitable memory. The host memory is preferably a nonvolatile memory, including but not limited to, floppy disk, Random-access memory (RAM), Read-only memory (ROM), Erasable Programmable Read-Qnly Memory (EPROM or flash memory), etc. Likewise, the host controller 101 is also not limited to MCU microcontroller, which may be any suitable controller. Additionally, the host controller 101 may be also connected to an alarm device (not shown) for giving off voice and/or light alarm during communication failure. The host controller may include the following functional modules: an initialization command unit, for sending an initialization command to the slave after the initialization switch is pressed; and an address assignment command sending unit, for sending an address assignment command to the slave. The host controller may also include a polling module, for regularly sending a polling command to the slave. The host controller may also include an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added. The host controller may also include an address checking command sending unit, for sending an address checking command to the slave.
Fig 4 is a structure scheme of slave 200 according to an embodiment of the invention. As is shown, slave 200 includes a slave controller 201, such as MCU microcontroller, a slave communication module 202, a slave memory 203, an electronic physical switch 205, and a slave initialization switch 204. In this embodiment, the electronic physical switch 205 is a relay (normally closed, in order not to affect the communication of other slaves when this slave is switched off or malfunctioned, which is equivalent to the case where this slave is not connected on the bus), and the slave initialization switch is a JP jumper switch. It should be understood that, the electronic physical switch 205 and the slave initialization switch 204 are not limited to the abovementioned types, but may be any other suitable types. Likewise, the slave controller 201 is not limited to MCU microcontroller, but may be any other suitable controller. The slave communication module 202 is connected to the slave MCU microcontroller 202 and the twisted pair lines respectively, and the twisted pair lines are lead out after passing through the relay 205; the slave memory 203 is used to store the assigned address of slave 200; the relay 205 executes connection/disconnection under the control of the slave MCU microcontroller 201, and is closed in the default state, so as not to affect the normal communication of other devices when starting or initialization can not be executed due to the faults that occur at the slave nodes; in this embodiment, the slave initialization switch 204 is a JP jumper, for initializing the address based on the control of the slave MCU microcontroller 201, for example, it may be necessary to initialize the address as factory default setting after the device is repaired. Since relay 205 is located downstream of the slave communication module 202, when the relay 205 is disconnected, the communication with the next slave is thus disconnected but the slave can still communicate with the host through the slave communication module 202 of the slave. The slave controller can include the following functional modules: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, after the initialization switch is activated or after the initialization command sent by the host is received; an address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment. and making a response when it receives an address assignment command sent by the host, and at the same time closing the electronic physical switch. The slave controller may also include an address checking command answering unit, for making a response after receiving an address checking command sent by the host.
Fig.5 is a flowchart of a smart address assignment method according to one embodiment of the invention. As shown, the system operation is started from step 502, and at this time, both the host and the slaves are powered up. In step 504, the host initialization switch 104 is pressed, and the initialization command units of the host controller 101 of the host 100 sends the initialization commands to slaves 200, so that the initialization command executing units of the slave controllers of all slaves 200 take action to disconnect the relays 205, and all of the slave addresses are set with a predetermined value, such as Oxff. In one embodiment, the initialization command is sent consecutively for 20 times, to assure that the slaves have received them. Then, in step 506, the address assignment command unit of the host controller 101 of the host 100 sends effectively-assigned addresses to slaves 200, and the address assignment command sending units of the slave controllers of the slaves 200 which have not been assigned the addresses, after receiving the addresses, use the assigned addresses to replace Oxff, close the relay, and make a responses. If there is a response, then the operation proceeds to step 508, i.e. waiting for the answer of slaves or until a predetermined waiting time, such as 100 ms. If there is a response, then the effectively-assigned address is increased according to a predetermined sequence, e.g. increased by 1 and the operation proceeds to step 506 again. At this time, last slave which has been assigned the address also receives the assigned address that the host sends to the slave. However, since it finds that the address does not match its assigned address, the slave would not make a response. But the address assignment command sending unit of the slave controller of another slave which is the nearest to the said slave, after receiving the address assignment command, stores the address, closes its relay 205 and makes a response. If there is no answer after step 506 has been entered for a plurality of times (such as 10 times), then it is considered that the addresses have been assigned to all of the slaves, and subsequently the operation proceeds to step 510, wherein automatic address assignment is completely finished.
Fig 6 is a flowchart of a smart address assignment method according to another embodiment of the invention. As is shown, the system operation is started from step 602, and at this time, both the host and the slaves are powered up. In step 604, the host 100 in the system determines whether the system initialization is necessary by checking the host initialization switch 104 (jumper switch state or key switch state). For example, the system automatically sets that, when the host initialization switch is 1, it is needed to perform initialization, and when the host initialization switch is 0, it is not necessary to perform initialization. In other words, if the host initialization switch is I5 then the system enters step 610, and at this time, the initialization command unit of the host controller 101 of host 100 consecutively sends address assignment group-sending commands to slaves 200 for many times, so that the initialization command executing units of the slave controller of all slaves 200 take action to disconnect the relay 205, and the slave addresses are set with a predetermined value, such as Oxff. In one embodiment, the host 100 consecutively sends the commands for 20 times, to assure that the slaves receive them. If the host initialization switch is 0, then the system enters step 606, and at this time the system reads the list of assigned slave addresses from the designated memory area, and subsequently enters step 608, wherein it enters the normal communication program, and polls the slaves. It should be understood that the system may also has the opposite settings. Then, in step 612, since the original bus is physically disconnected, but there is always one node which is uniquely connected to the host (the nearest node), the address checking command sending unit of the host controller 101 of the host 100 sends address checking command to the nearest slave 200, wherein the carried target address is Oxff, and the address checking command answering unit of the slave controller of the slave whose address is Oxff makes a response after receiving the command, and if the host does not receive the answer of the slave after a predetermined time (such as 30s), an alarm is triggered. Otherwise the system enters step 614, and waits for the answer of the slave or waits for a predetermined time, such as 100ms. If the slave makes a response in step 614, then the system enters step 616, and the system sends the effective slave addresses to be assigned. Otherwise, the system returns to step 612. In step 618, the address assignment command sending unit of the host controller 101 of the host sends the effectively-assigned address to the slaves, which carry the formally-assigned address, and the addresses to be assigned which the address assignment command sending unit of the slave controller of the slave 200 receives, and uses the formally-assigned address to replace Oxfζ closes its relay 205 and makes a response. If there is a response, the effectively-assigned addresses is increased according to a predetermined sequence (e.g. increased by 1), and the system enters step 616 again, and at this time, previous slave which has been assigned an address also receives the assigned address that the host sends to the slave. However, since it finds that the address does not match its assigned address, the slave would not make a response. But the address assignment command sending unit of the slave controller of another slave which is the nearest to this slave, after receiving the address assignment command, stores the address, closes the relay 205 and makes a response. If there is no response after step 618 has been entered for a plurality of times (such as 10 times), then it is considered that the addresses have been assigned to all of the slaves, and subsequently the process enters step 620 wherein the system address assignment ends, the largest assigned address of the slaves is stored and the success of automatic assignment is suggested.
Fig 7 is a flowchart of a smart address assignment method according to another embodiment of the invention. As is shown, the system operation starts from step 702, and at this time, both the host and the slaves are powered up. In step 704, the host 100 in the system determines whether the system initialization is necessary by checking the host initialization switch 104 (jumper switch state or key switch state). For example, the system automatically sets that, when the host initialization switch is 1, it is needed to perform initialization, and when the host initialization switch is 0, it is unnecessary to perform initialization. In other words, if the host initialization switch is 1, then the system enters step 710, and at this time, the system starts to read the total number of the slaves. If the host initialization switch is 0, then the system enters step 706, and at this time the system reads the list of the assigned slave addresses from the designated memory area, and subsequently enters steps 708, wherein it enters the normal communication program, and polls the slaves. It should be understood that, the system may also have the opposite settings. In step 712, the initialization command unit of the host controller 101 of the host 100 consecutively sends address assignment group-sending commands to slaves 200 for many times so that the initialization command executing units of the slave controllers of all slaves 200 take action to disconnect the relays 205, and the slave addresses are set as Oxff. In one embodiment, host 100 consecutively sends the commands for 20 times, to assure that the slaves receive them. Then, in step 714, since the original bus is physically disconnected, but there is always one node which is uniquely connected to the host (the nearest node), therefore the address checking command sending unit of the host controller 101 of the host 100 sends address checking command to the nearest slave 200, wherein the carried target address is Oxff, and the address assignment command sending unit of the slave controllers of the slave whose address is Oxff makes a response after receiving the command, and if the host does not receive the answer of the slave after a predetermined time (e.g. 30s), an alarm will be triggered, otherwise the process enters step 716, and waits for the answer of the slave or waits for a predetermined time, such as 100ms. If the slave makes a response in step 716, then the system enters step 718, otherwise, the system returns to step 714. In step 718, the address assignment command sending unit of the host controller 101 of the host sends the effective slave address to be assigned to the slaves, wherein the effective slave address carries formally-assigned address, and the address assignment command sending unit of the slave controller of slaves 200 which have not been assigned addresses, after receiving the addresses, uses the formally-assigned address to replace Oxff and closes its relay 205 and makes a response. In step 720, the system waits for the answer of the slave or for 100 ms again. If there is no response, then the system will return to step 716, otherwise the system will enter step 722. In step 722, the system determines whether "effectively-assigned address < SlaveNum>" is valid. If it is valid, the effectively-assigned address will be added by 1, and the system will enter step 720 again, otherwise, the system will enter step 724 wherein the system address assignment ends, the largest assigned address of the slaves is stored and the success of automatic assignment is suggested.
Fig 8 is a flowchart showing the initialization process of a slave according to one embodiment of the invention. When a new slave 200 is connected in the network, in step 802, the slave 200 is powered up. Subsequently, in step 804, slaves 200 determines whether the system initialization is necessary by checking the slave initialization switch 204. For example, the system automatically sets that, when the slave initialization switch is 1, it is needed to perform initialization, and when the slave initialization switch is 0, it is unnecessary to perform initialization. In other words, if the slave initialization switch is I, then the system enters step 610, and at this time the initialization command executing units of the slave controllers of the slaves set their memories 203 as factory" default setting value, such as Oxff, and the relay 205 is disconnected, to wait for the assigned address. If the slave initialization switch is 0, then the system enters step 806, and determines whether the address has been assigned, and subsequently enters step 808 and turns to the normal communication mode. It should be understood that, the system may also has the opposite settings. λλ/hen a new slave 200 is to be inserted in the original network, it is just needed to activate the slaλ^e initialization switch 204, and resume the default setting Oxff. Then the slave would wait for an address assignment command, disconnect the switch of its relay 205, and then be directly inserted to the newly connected network and the host initialization switch 104 is pressed again, so that the smart address assignment of all slaves can be automatically completed all over again. Preferably, once a new slave is inserted in, an address can be assigned to the newly-inserted slave, without having the host initialization switch 104 pressed again. To this end, the polling module of the host controller of the host can be set such that Oxff device searching command is added to the command sent during polling. The host can also be set such that it separately sends a command to inquire the OxFF address when the bus is idle after the ending of all normal communications. The period of the normal communication is different according to different system conditions, for example, the period may be 10s. Both of the above methods can be used to assign addresses to the newly-inserted slaves. The invention will be described by taking the example wherein OxFF device searching command is added to the command sent by the host during regular polling. Firstly, the initialization switch of the new slave is activated, and the default setting Oxff is resumed. During polling of the host, the polling module of the host controller would receive a response once it sends OxFF device searching command, which means that a new slave has been inserted. Subsequently, the exception processing module of the host controller of the host invokes the address assignment command unit to assign an address to the new slave, until the assignment for all new slaves is completed. In one embodiment, on the basis of the assigned address number, the host increases the address number sequentially, and assigns them to the newly-added slaves. The aforementioned polling command sent by the host may be sent regularly, wherein carried target addresses are respectively the addresses of the slaves, and also include one Oxff address. By means of this preferred implementing scheme, the host can smartly realize the insertion of the new slaves without affecting the communication of other slaves, and it is not necessary to know what the addresses in the current network.
In the following, the invention is further described in combination with a communication protocol stack, wherein the data frame format is comprised of 23 bytes. The specific data frame format is described as follows:
Figure imgf000016_0001
Wherein, each byte respectively represents: STX: 0x02. This value is just an example value, and it should be understood that, it may be other values;
CMD: data format type;
Dest Addr: destination address of data sending;
Source Addr: source address of data sending; DATA: 16-byte sending data;
CHECK: CRC 16 checking, and CRC original value is OxFFFF;
ETX: 0x03. This value is just an example value, and it should be understood that, it may be other values.
Supposed that one host and three slaves I3 2 and 3 constitute one control network, and is taken as an example embodiment. The addresses which the host assigns to the slaves start from 0x01. The normal state of the relay in each slave is in closed state. It should be understood that, the addresses of the slaves are not limited to starting from 0x01, which may be selected any one from 0x00 -OxFE When no new slave is inserted to the network, if the initialization switch on the host is pressed, then the host will automatically enter the initialization process: 1. The host sends the initialization command: STX + 0x5A + OxFF + 0x00 + Data + CRC16 + ETX (any data)
The host consecutively sends it for 5 seconds, and after three slaves receive effective information, delays for 3 seconds to disconnect the relay, and at the same time set its own address as Oxff.
2. Subsequently the host sends the address checking command
STX + 0x5B + OxFF + OxOO + Data + CRC16 + ETX (any Data)
At this time, all of the relays are disconnected, and only slave 1 connected to the host through its slave communication module can receive the address checking command, and the address is OxFF. Therefore, slave 1 sends the response to the host:
STX + 0xA5 + 0x00 + OxFF + Data + CRCl 6 + ETX (any Data)
Wherein, the destination address 0x00 is the address of the host, and the source address OxFF is the address of the slave. 3. After receiving the response of slave I5 the host sends formal address assignment command:
STX + 0x5C + 0x01 + 0x00 + Data + CRC16 + ETX (any Data)
Wherein, the destination address is 0x01, which represents that the assignment starts from 0x01; After receiving the command, slave 1 sends acknowledgement response to the host:
STX + 0xA6 + 0x00 + 0x01 + Data + CRC16 + ETX (any Data) and at the same time closes the relay, and connects next slave 2.
4. After receiving the response of slave 2, the host sends formal address assignment command: STX + 0x5C + 0x02 + 0x00 + Data + CRC16 + ETX (any Data)
After slave 1 receives the command, slave 1 compares the address in the command with its assigned address, finds that the addresses do not match, then neglects it and does not answer it; after receiving the command, slave 2 stores the address (i.e. replaces Oxff with the address in the command) and sends the acknowledgement response to the host: STX + OxAo + 0x00 + 0x02 + Data + CRC16 + ETX (any Data) and at the same time closes the relay, and connects next slave 3.
5. After receiving the response of slave 3, the host sends formal address assignment command:
STX + 0x5C + 0x03 + 0x00 + Data + CRC16 + ETX (any Data) After slave 1 and slave 2 receive the command and find that the address in the command and their assigned addresses do not match, then neglect them and do not answer them; after receiving the command, slave 3 stores the address and sends the acknowledgement response to the host:
STX + 0xA6 + OxOO + 0x03 + Data + CRC 16 + ETX (any Data) and at the same time closes the relay. 6. The host sends formal address assignment command to the slaves again:
STX + 0x5C + 0x04 + 0x00 + Data + CRCl 6 + ETX (any Data)
The host consecutively sends it for 10 times, and if there is no response, the address assignment ends.
It should be understood that, the format of the address assignment command is not limited to the above format, but may be any other suitable format, for example, it may apply the format that carries assigned address in the Data bit.
STX + 0x5C + Oxff + 0x00 + Addr + CRC 16 + ETX
The slave whose address is Oxff, after receiving the command, uses Addr to replace Oxff, and sends the acknowledgement response, and at the same time connects the communication of the next slave
STX + 0xA6 + 0x00 + Addr + Data + CRC16 + ETX (any Data)
Subsequently, the host sends the address assignment command again:
STX + 0x5C + Oxff + 0x00 + (Addr + 1) + CRC16 + ETX
After receiving the command, the first slave finds that it is not its own address by comparison and does not answer it; after receiving the command, the second slave finds that the command is just for itself, then the second slave uses Addr + 1 to replace Oxff, and answers it , and at the same time connects the next slave
STX + 0xA6 + 0x00 + (Addr + 1) + Data + CRC16 + ETX (any Data)
In this manner, consecutive address assignment can also be achieved. Additionally, it should be understood that, in one embodiment, in order to simplify the design, the address checking is not executed after the initialization step, and the address assignment can be directly executed. In another embodiment, every time before address assignment, address checking is executed once.
When one new slave 4 is connected sequentially after slave 3 in the network, firstly, before slave 4 is connected, the initialization switch of slave 4 is pressed, and the factory default setting
Oxff is resumed. Then, slave 4 is directly inserted to the network. After slave 4 is powered up, it finds that the initialization switch is pressed, then slave 4 starts initialization, disconnects the relay, and waits for the address assignment.
1. When polling, the host would insert the command of searching the Oxff slave: STX + 0x5B + OxFF + OxOO + Data + CRC16 + ETX (any Data) Slaves 1, 2 and 3 receive the command and find that the address in the command does not match their assigned addresses, and then neglect it; after receiving the command, slave 4 sends the acknowledgement response to the host:
STX + 0xA5 + 0x00 + OxFF + Data + CRC16 + ETX (any Data)
2. After receiving the response of slave 4, the host sends formal address assignment command:
STX + 0x5C + 0x04 + 0x00 + Data + CRC16 + ETX (any Data)
Slaves 1, 2 and 3 receive the command and find that the address in the command does not match their assigned addresses, and then neglect it; after receiving the command, slave 4 stores the address and sends the acknowledgement response to the host: STX + 0xA6 + 0x00 + 0x04 + Data + CRC 16 + ETX (any Data)
3. The host sends the formal address assignment command to the slaves again: STX + 0x5C + 0x05 + 0x00 + Data + CRCl 6 + ETX (any Data)
The host consecutively sends it for 10 times, and if there is no response, the address assignment ends. When one new slave 5 is added in the network between slave 1 and slave 2, and at the same time one new slave 6 is added between slave 3 and slave 4, firstly, before slave 5 and slave 6 are connected, the initialization switches of slaves 5 and 6 are pressed, the factory default setting Oxff is resumed, and then the slaves are directly inserted to the network. After slave 5 and salve 6 are powered up and find that the initialization switches are pressed, then slave 5 and slave 6 start initialization, disconnect the relay, and wait for the address assignment. Since slave 6 is located downstream of slave 5, when the relay of slave 5 has been disconnected, only slave 5 is the slave that is connected to the host and whose address is Oxff, i.e., in the system, at any time, there is no more than one slave whose address is Oxff is connected to the host.
1. When polling, the host would insert the command of searching the Oxff slave: STX + 0x5B + OxFF + 0x00 + Data + CRC16 + ETX (any Data)
After slave 1 receives the command and finds that the address in the command does not match its assigned address, slave 1 neglects it; after receiving the command, slave 5 sends the acknowledgement response to the host:
STX + 0xA5 + OxOO + OxFF + Data + CRC16 + ETX (any Data)
2. After receiving the response of slave 5, the host sends formal address assignment command:
STX + 0x5C + 0x05 + 0x00 + Data + CRC 16 + ETX (any Data)
After slave 1 receives the command and finds that the address in the command does not match its assigned address, slave 1 neglects it; after receiving the command, slave 5 saves the address and sends the acknowledgement response to the host: STX + 0xA6 + 0x00 + 0x05 + Data + CRC 16 + ETX (any Data) and at the same time closes the relay, and connects slave 6.
3. After receiving the response of slave 5, the host sends formal address assignment command:
STX + 0x5C + 0x06 + 0x00 + Data + CRC16 + ETX (any Data) After slave 1, slave 5, slave 2 and slave 3 receive the command and find that the address in the command does not match their assigned addresses, they neglect them; after receiving the command, slaveό saves the address and sends the acknowledgement response to the host: STX + 0xA6 + 0x00 + 0x06 + Data + CRC 16 + ETX (any Data)
4. The host sends the formal address assignment command to the slaves again: STX + 0x5C + 0x07 + 0x00 + Data + CRC16 + ETX (any Data)
The host consecutively sends it for 10 times, and if there is no response, the address assignment ends.
It is clear described in the above examples that, whenever the electronic switch of any one slave is disconnected, among the slaves which have not been assigned an address, there is always only one slave which communicates with the host, and the slave must be one which is the nearest to the host and which has not been assigned an address.
It should be understood that, the invention is not limited to the detailed form disclosed in the abovementioned preferred implementing scheme. For example, the invention can also be applied in multi- master and multi-slave system. In this kind of system, there would be one master station which realizes the address assignment, and the other master stations may not take part in the address assignment, or they may be treated as a special slave station (with some kind of special mark).
Though the invention has been represented and described in accordance with the specific embodiments of the invention, the one skilled in the art will understand that, some variations can be made in the above and other forms and details without deviating from the spirit and scale of the invention. The variations include but are not limited to, addition, deletion, or modification of an element, or replacement with the equivalents, and/or addition, deletion or modification of the steps which are executed in the same or different order.

Claims

Claims
1. An address assignment method in a serial bus system, the serial bus system includes at least one host and at least one slave, the method includes the following steps: a, providing an electronic physical switch for each of the at least one slave in a serial bus, to control the line connection/disconnection between each slave and the next slave adjacent thereto; b, disconnecting the electronic physical switch of each of the at least one slaves ; c, after the host assigns an address to the slave which is to be assigned an address and which is the most adjacent to the host, close the electronic physical switch of the said slave.
2. The address assignment method in accordance with claim 1, wherein step c is repeated, until the address assignment is completed for all of the slaves.
3. The address assignment method in accordance with claim 1, wherein in step b, the host sends an initialization command to the slaves, to disconnect the electronic physical switches.
4. The address assignment method in accordance with claim 1, wherein before step c, the method includes the following step: the host sends an address checking command to the slaves, and the slave with an address that matches the checking address in the address checking command sending an acknowledgement response to the host.
5. The address assignment method in accordance with claim 1, further includes step d: the host regularly sends polling command to the slaves, the polling command includes the address of each slave.
6. The address assignment method in accordance with claim 5, wherein the polling command also includes an address of an original value.
7. The address assignment method in accordance with claim 6, further including: e. add at least one additional slave in the serial bus system; f. initialize the additional slave, to disconnect the electronic physical switch of the additional slave, and set the address of the additional slave as the original value; g. the additional slave with an address that matches the address which is the original value in the polling command sends the acknowledgement response to the host, saves the said address, and closes the electronic physical switch of the said additional slave.
8. The address assignment method in accordance with claim 7, wherein step g is repeated, until the address assignment is completed for all of the additional slaves.
9. The address assignment method in accordance with claim 1, further includes the step of determining whether the effectively-assigned address is less than the number of the slaves.
10. The address assignment method in accordance with claim 1, wherein the original value of the slave address is OxFF.
11. The address assignment method in accordance with claim 1, wherein the electronic physical switch is a relay.
12. A host is used in a serial bus system, the serial bus system also includes at least one slave, and the host includes a controller; a communication module connected to the controller, for sending data to the at least one slave and receiving data from the at least one slave; a memory connected to the controller, for accessing the address data of the at least one slave; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
13. The host in accordance with claim 12, wherein the controller includes: an initialization command unit, for sending an initialization command to the at least one slave after an initialization switch is activated; and an address assignment command sending unit, for sending an address assignment command to the at least one slave.
14. The host in accordance with claim 13, wherein the controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave.
15. The host in accordance with claim 14, wherein the polling command also includes an address of an original value.
16. The host in accordance with claim 15, wherein the controller also includes an exception processing module, for invoking the address assignment command unit to send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
17. The host in accordance with claim 13, wherein the controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
18. The host in accordance with claim 12, wherein the communication module is a RS485 communication module.
19. The host in accordance with claim 12, wherein the memory is a nonvolatile memory.
20. The host in accordance with claim 12, wherein the initialization switch is a JP jumper switch or a trigger key switch.
21. A slave for a serial bus system, the serial bus system also includes at least one host, the slave includes a controller; a communication module connected to the controller, for sending data to the at least one host and receiving data from the at least one host; a memory connected to the controller, for accessing the address data of the slave; an electronic physical switch connected in the serial bus and located downstream of the communication module; and an initialization switch connected to the controller, for starting the initialization operation when the initialization switch is activated.
22. The slave in accordance with claim 21, wherein the controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the initialization switch is activated or after the initialization command sent by the at least one host is received; an address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time closing the electronic physical switch.
23. The slave in accordance with claim 22, wherein the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
24. The slave in accordance with claim 21, wherein the communication module is a R.S485 communication module.
25. The slave in accordance with claim 21, wherein the memory is a nonvolatile memory.
26. The slave in accordance with claim 21, wherein the initialization switch is a JP jumper switch or a trigger key switch.
27. The slave in accordance with claim 21, wherein the electronic physical switch is a relay.
28. A system, the system includes: at least one host; at least one slave; a serial bus including pair lines; wherein each of the at least one slave includes an electronic physical switch, and wherein the pair lines in the serial bus are lead from the host, and in turn pass through the electronic physical switch of each of the at least one slave.
29. The system in accordance with claim 28, wherein each of the at least one host includes: a host controller; a host communication module connected to the host controller, for sending data to the at least one slave and receiving data from the at least one slave; a host memory connected to the host controller, for accessing the address data of the at least one slave; and a host initialization switch connected to the host controller, for starting the initialization operation when the host initialization switch is activated.
30. The system in accordance with claim 29, wherein the host controller includes: an initialization command unit, for sending an initialization command to the at least one slave when host initialization switch is activated; and a host address assignment command sending unit, for sending an address assignment command to the at least one slave.
31. The system in accordance with claim 30, wherein the host controller also includes a polling module, for regularly sending a polling command to the at least one slave, wherein the polling command includes the address of the at least one slave.
32. The system in accordance with claim 31, wherein the polling command also includes an address of an original value.
33. The system in accordance with claim 32, wherein the host controller also includes an exception processing module, for invoking the address assignment command unit to' send the address assignment command to the additional slave when the polling module finds that an additional slave is added.
34. The system in accordance with claim 29, wherein the host controller also includes an address checking command sending unit, for sending an address checking command to the at least one slave.
35. The system in accordance with claim 29, wherein the host communication module is a RS485 communication module.
36. The system in accordance with claim 29, wherein the host memory is a nonvolatile memory.
37. The system in accordance with claim 29, wherein the host initialization switch is a JP jumper switch or a trigger key switch.
38. The system in accordance with claim 28, wherein each of the at least one slave includes: a slave controller; a slave communication module connected to the slave controller, for sending data to the at least one host and receiving data from the at least one host; a slave memory connected to the slave controller, for accessing the address data of the said at least one slave; an electronic physical switch connected in the serial bus and located downstream of the slave communication module; and a slave initialization switch connected to the slave controller, for starting the initialization operation when the slave initialization switch is activated.
39. The system in accordance with claim 38, wherein the slave controller includes: an initialization command executing unit, for disconnecting the electronic physical switch and setting its own address as an original value, when the slave initialization switch is activated or after the initialization command sent by the at least one host is received; a slave address assignment command sending unit, for using the address in the address assignment command to replace the address before the assignment and making a response, when it receives an address assignment command sent by the at least one host, and at the same time closes the electronic physical switch.
40 The system in accordance with claim 39, wherein the controller also includes an address checking command answering unit, for making a response after receiving an address checking command sent by the at least one host.
41. The system in accordance with claim 38, wherein the slave communication module is a RS485 communication module.
42. The system in accordance with claim 38, wherein the slave memory is a nonvolatile memory.
43. The system in accordance with claim 38, wherein the slave initialization switch is a JP jumper switch or a trigger key switch.
44. The system in accordance with claim 38, wherein the electronic physical switch is a relay.
PCT/CN2008/001814 2008-07-21 2008-10-29 Method and system for smart address assignment based on serial bus Ceased WO2010009584A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200810133595A CN101635637A (en) 2008-07-21 2008-07-21 Method and system for distributing intelligent addresses based on serial bus
CN200810133595.2 2008-07-21

Publications (1)

Publication Number Publication Date
WO2010009584A1 true WO2010009584A1 (en) 2010-01-28

Family

ID=41569986

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2008/001814 Ceased WO2010009584A1 (en) 2008-07-21 2008-10-29 Method and system for smart address assignment based on serial bus

Country Status (2)

Country Link
CN (1) CN101635637A (en)
WO (1) WO2010009584A1 (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012091998A3 (en) * 2010-12-28 2013-08-15 3M Innovative Properties Company Serial transmission system and slave unit used therein
GB2506976A (en) * 2012-08-20 2014-04-16 Control Tech Ltd Address allocation for slave nodes connected in series
EP2840643A1 (en) * 2013-06-05 2015-02-25 Samsung SDI Co., Ltd. Slave controller, communication method, communication system, energy storage system including the communication system
CN104833924A (en) * 2015-04-29 2015-08-12 深圳市共济科技有限公司 Serial automatic addressing method and system of lead storage battery internal resistance detection modules
WO2019192907A1 (en) * 2018-04-04 2019-10-10 Continental Automotive Gmbh Databus system for a vehicle, vehicle access system, and method for learning a unique installation position
CN111211955A (en) * 2019-11-15 2020-05-29 华为技术有限公司 Method for distributing slave node address and node management system
CN113037889A (en) * 2021-03-19 2021-06-25 天合光能股份有限公司 Slave machine address allocation method for energy storage battery management system
CN113382094A (en) * 2021-05-20 2021-09-10 西安麦格米特电气有限公司 Module address determination method and device, power module and communication network
CN113587393A (en) * 2021-08-05 2021-11-02 青岛海信日立空调系统有限公司 Central air-conditioning control system
CN113645322A (en) * 2021-07-15 2021-11-12 大力电工襄阳股份有限公司 Address code identification method and device based on optical fiber serial communication and application thereof
US11265223B2 (en) 2018-11-23 2022-03-01 Samsung Sdi Co., Ltd. Slave module and number assignment system including the same
WO2023123874A1 (en) * 2021-12-30 2023-07-06 如果新能源科技(江苏)股份有限公司 Automatic bus address allocation and identification method, electronic device, storage medium, and program product
CN116962351A (en) * 2023-09-18 2023-10-27 上海红檀智能科技有限公司 An automatic communication address allocation method and device for an Internet of Things circuit breaker
CN117135142A (en) * 2023-10-26 2023-11-28 浙江大学 Address allocation device and method for performance test of flexible production line of electric automobile motor
CN117319354A (en) * 2023-11-28 2023-12-29 天合光能股份有限公司 Address configuration method and device for photovoltaic tracking bracket controller
EP4614886A1 (en) * 2024-03-05 2025-09-10 Akademia Gorniczo-Hutnicza im. Stanislawa Staszica w Krakowie Method of operation of a communication bus system

Families Citing this family (43)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102200953A (en) * 2010-03-24 2011-09-28 鸿富锦精密工业(深圳)有限公司 Electronic system
CN101895453B (en) * 2010-07-19 2012-08-22 江苏省东方世纪网络信息有限公司 Automatic address identification handshaking method of share type bus under master-slave communication mode
CN101958939A (en) * 2010-10-15 2011-01-26 德讯科技股份有限公司 Automatic distribution method and system for multi-machine communication node equipment key address
CN103246627A (en) * 2012-02-03 2013-08-14 施耐德电器工业公司 Multi-stage subordinate serial communication system and method capable of automatically allocating addresses
CN103812962B (en) * 2014-02-12 2017-03-22 南京欧帝科技股份有限公司 Automatic device communication address allocation system based on serial interface and working method
CN104243577A (en) * 2014-09-12 2014-12-24 北京能克科技有限公司 Electronic device having automatic networking function and automatic networking method
CN104410557A (en) * 2014-12-25 2015-03-11 深圳中科讯联科技有限公司 Dynamic networking method and communication method based on RS-485
CN105049551A (en) * 2015-08-27 2015-11-11 赵忠义 System and method for automatically distributing address via bus
CN105808396A (en) * 2016-03-04 2016-07-27 浙江大华技术股份有限公司 Chip debugging device, debugging method and SOC (System of Chip) chip system
CN106054819B (en) * 2016-06-30 2018-12-04 深圳市优必选科技有限公司 Method for setting preset disconnection ID of server in server control system
CN106200560B (en) * 2016-06-30 2018-12-04 深圳市优必选科技有限公司 Server ID setting method for server control system
CN105988404B (en) * 2016-06-30 2018-12-04 深圳市优必选科技有限公司 Server control system
DE102016214416A1 (en) 2016-08-04 2018-02-08 Continental Automotive Gmbh Method for assigning addresses by a master unit to a number of slave units
CN106647393A (en) * 2016-12-13 2017-05-10 东莞力朗电池科技有限公司 CAN bus automatic coding circuit and method
CN108234684A (en) * 2016-12-21 2018-06-29 顺丰科技有限公司 The method and system of configuration address
CN107071076B (en) * 2016-12-23 2020-07-03 京信通信系统(中国)有限公司 Equipment address configuration method, device and system in communication system
CN106873513A (en) * 2017-03-01 2017-06-20 深圳市亿维自动化技术有限公司 A kind of PLC system and its principal and subordinate link structure
EP3428653B1 (en) * 2017-07-13 2021-09-15 Roche Diagnostics GmbH Method of operating a laboratory sample distribution system, laboratory sample distribution system and laboratory automation system
CN107566543B (en) * 2017-08-28 2021-02-05 东软医疗系统股份有限公司 Node identifier setting method and device
CN107682467A (en) * 2017-10-01 2018-02-09 北京迪利科技有限公司 A kind of bus address distribution that communication is realized by powering step by step is with knowing method for distinguishing
CN109951369A (en) * 2017-12-21 2019-06-28 成都长城开发科技有限公司 System based on RS485
CN108304333B (en) * 2017-12-26 2021-04-13 中国科学院长春光学精密机械与物理研究所 A one-master multi-slave bus
CN108462621B (en) * 2018-03-01 2020-12-29 航天柏克(广东)科技有限公司 Method for communication equipment address allocation and equipment quantity statistics
CN108616610A (en) * 2018-05-21 2018-10-02 深圳前海有电物联科技有限公司 Address distribution method, host, slave and bus system
CN109059414A (en) * 2018-10-25 2018-12-21 长虹美菱股份有限公司 A kind of display board adaptation method for refrigerator after-sales service
CN109474717A (en) * 2018-12-18 2019-03-15 中信重工开诚智能装备有限公司 A kind of connection of communication bus and address automatic allocating method
CN110137520B (en) * 2019-05-06 2021-03-02 奇瑞汽车股份有限公司 Slave address calibration system and method for battery management system
CN110412957B (en) * 2019-07-31 2022-08-02 广州市佛达信号设备有限公司 Multi-machine self-synchronizing warning lamp control method
CN111077813B (en) * 2019-09-26 2021-04-27 深圳市东深电子股份有限公司 Dam safety monitoring data automatic acquisition system and method
CN111030906A (en) * 2019-12-12 2020-04-17 山东鼎维数字技术有限公司 Method for automatically addressing slave station address based on RS485 bus cascade
CN111241019A (en) * 2019-12-31 2020-06-05 苏州阿德文斯电子科技有限公司 RS485 bus arbitration and address automatic identification method
CN111585820B (en) * 2020-05-13 2023-02-03 贝榕物联(常州)有限公司 Numbering method for multiple slave machines and weighing shelf
CN111756872A (en) * 2020-06-18 2020-10-09 浙江鲜达环保科技有限公司 Address setting method, temperature control system and computer readable storage medium
CN112074063B (en) * 2020-09-14 2023-03-24 广州彩熠灯光股份有限公司 Method and device for configuring lamp information
CN112669590B (en) * 2020-12-10 2023-05-09 浙江理工大学 Serial plug-and-play intelligent sensor communication system and its automatic addressing method
CN112905508B (en) * 2021-02-01 2021-08-20 浙江中拓合控科技有限公司 Address allocation method, communication device and storage medium for serial communication equipment
CN113271244B (en) * 2021-04-09 2022-06-28 电子科技大学 RS485 bus ad hoc network full-duplex communication system and automatic address addressing method thereof
CN113572675B (en) * 2021-06-30 2022-11-11 摩拜(北京)信息技术有限公司 Communication system for charging and replacing battery cabinet and charging and replacing battery cabinet
CN114257468B (en) * 2021-12-10 2024-11-08 湖北迅迪科技有限公司 A system and method for allocating addresses to slave devices via RS-485 bus
CN114500689B (en) * 2022-01-30 2023-09-08 合肥美的电冰箱有限公司 Bus communication method, device, communication board, household electrical appliance and storage medium
CN116016015B (en) * 2022-12-13 2024-06-18 烟台创为新能源科技股份有限公司 Device and method for realizing automatic coding and communication redundancy strategy of vehicle-mounted equipment
CN116760657A (en) * 2023-06-29 2023-09-15 营口天成消防设备有限公司 Two-bus equipment for fire protection and automatic coding method
CN118885430A (en) * 2024-08-07 2024-11-01 山东锐易电动科技有限公司 SPI communication hardware circuit, method for configuring slave and monitoring slave online status

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1125370A (en) * 1994-02-17 1996-06-26 海德堡印刷机械股份公司 Method and apparatus for matching functional unit in series muster and slave device
JPH1165970A (en) * 1997-08-25 1999-03-09 Hitachi Ltd Control system construction method
CN1655081A (en) * 2004-02-10 2005-08-17 上海新时达电气有限公司 Allocator for automatically allocating address to serial bus device and method for controlling the same

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1125370A (en) * 1994-02-17 1996-06-26 海德堡印刷机械股份公司 Method and apparatus for matching functional unit in series muster and slave device
JPH1165970A (en) * 1997-08-25 1999-03-09 Hitachi Ltd Control system construction method
CN1655081A (en) * 2004-02-10 2005-08-17 上海新时达电气有限公司 Allocator for automatically allocating address to serial bus device and method for controlling the same

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012091998A3 (en) * 2010-12-28 2013-08-15 3M Innovative Properties Company Serial transmission system and slave unit used therein
GB2506976A (en) * 2012-08-20 2014-04-16 Control Tech Ltd Address allocation for slave nodes connected in series
EP2840643A1 (en) * 2013-06-05 2015-02-25 Samsung SDI Co., Ltd. Slave controller, communication method, communication system, energy storage system including the communication system
US9436261B2 (en) 2013-06-05 2016-09-06 Samsung Sdi Co., Ltd. Battery management system, and method of managing the same
CN104833924A (en) * 2015-04-29 2015-08-12 深圳市共济科技有限公司 Serial automatic addressing method and system of lead storage battery internal resistance detection modules
WO2019192907A1 (en) * 2018-04-04 2019-10-10 Continental Automotive Gmbh Databus system for a vehicle, vehicle access system, and method for learning a unique installation position
US11265223B2 (en) 2018-11-23 2022-03-01 Samsung Sdi Co., Ltd. Slave module and number assignment system including the same
CN111211955A (en) * 2019-11-15 2020-05-29 华为技术有限公司 Method for distributing slave node address and node management system
CN113037889A (en) * 2021-03-19 2021-06-25 天合光能股份有限公司 Slave machine address allocation method for energy storage battery management system
CN113382094A (en) * 2021-05-20 2021-09-10 西安麦格米特电气有限公司 Module address determination method and device, power module and communication network
CN113382094B (en) * 2021-05-20 2023-09-12 西安麦格米特电气有限公司 Module address determining method and device, power module and communication network
CN113645322A (en) * 2021-07-15 2021-11-12 大力电工襄阳股份有限公司 Address code identification method and device based on optical fiber serial communication and application thereof
CN113587393B (en) * 2021-08-05 2022-11-29 青岛海信日立空调系统有限公司 Central air-conditioning control system
CN113587393A (en) * 2021-08-05 2021-11-02 青岛海信日立空调系统有限公司 Central air-conditioning control system
WO2023123874A1 (en) * 2021-12-30 2023-07-06 如果新能源科技(江苏)股份有限公司 Automatic bus address allocation and identification method, electronic device, storage medium, and program product
CN116962351A (en) * 2023-09-18 2023-10-27 上海红檀智能科技有限公司 An automatic communication address allocation method and device for an Internet of Things circuit breaker
CN116962351B (en) * 2023-09-18 2023-12-29 上海红檀智能科技有限公司 Automatic communication address allocation method and device for Internet of things circuit breaker
CN117135142A (en) * 2023-10-26 2023-11-28 浙江大学 Address allocation device and method for performance test of flexible production line of electric automobile motor
CN117135142B (en) * 2023-10-26 2024-02-06 浙江大学 Address allocation device and method for performance test of flexible production line of electric automobile motor
CN117319354A (en) * 2023-11-28 2023-12-29 天合光能股份有限公司 Address configuration method and device for photovoltaic tracking bracket controller
EP4614886A1 (en) * 2024-03-05 2025-09-10 Akademia Gorniczo-Hutnicza im. Stanislawa Staszica w Krakowie Method of operation of a communication bus system

Also Published As

Publication number Publication date
CN101635637A (en) 2010-01-27

Similar Documents

Publication Publication Date Title
WO2010009584A1 (en) Method and system for smart address assignment based on serial bus
US9100397B2 (en) BACnet MS/TP automatic MAC addressing
US20140223048A1 (en) Communication network and method for communicating in a communication network
US11159369B2 (en) Automatic initialization routine in an automation system
CN118300918B (en) Electric energy meter system
CN102684923A (en) Self-healing networking method for half-duplex asynchronous communication
US10467024B2 (en) System and method for bus arrangement communications
CN113381916A (en) CAN bus intelligent household management method, device, equipment and storage medium
CN105988404A (en) Server control system
CN112178881B (en) Self-checking method and device of RS485 network
JP4023342B2 (en) Dual address detection method, slave, master and field bus in field bus system
TWI470441B (en) Method and system of intelligent address allocation based on tandem bus
CN116346540B (en) An adaptive air conditioning gateway modular topology system and expansion method
CN112764385A (en) System and method for realizing small PLC bus
CN106412657B (en) A kind of method and system of set-top box programming sequence code
CN113395215B (en) Communication method, system, device, electronic equipment and storage medium
CN111190846A (en) Networking method based on bus system and bus system
CN109413641B (en) Network system, communication method, device, equipment and storage medium based on MESH
US20180276169A1 (en) Bus arrangement and method for operating a bus arrangement
CN105974890A (en) a server
CN118381043B (en) Master-slave communication method, reactive compensation system and storage medium
CN117135142B (en) Address allocation device and method for performance test of flexible production line of electric automobile motor
CN114599038B (en) Pairing method of multi-link system, pairing system and multi-link system
CN206075045U (en) Server control system
CN205844810U (en) a master controller

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 08876597

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 08876597

Country of ref document: EP

Kind code of ref document: A1