CN115426214B - Number distribution system, method for slave device, slave device and readable medium - Google Patents

Number distribution system, method for slave device, slave device and readable medium Download PDF

Info

Publication number
CN115426214B
CN115426214B CN202211122961.0A CN202211122961A CN115426214B CN 115426214 B CN115426214 B CN 115426214B CN 202211122961 A CN202211122961 A CN 202211122961A CN 115426214 B CN115426214 B CN 115426214B
Authority
CN
China
Prior art keywords
slave device
bus
stage
switch
slave
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211122961.0A
Other languages
Chinese (zh)
Other versions
CN115426214A (en
Inventor
杨晨宇
黄舒平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jiebote Robot Co ltd
Original Assignee
Shanghai Jiebote Robot Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Jiebote Robot Co ltd filed Critical Shanghai Jiebote Robot Co ltd
Priority to CN202211122961.0A priority Critical patent/CN115426214B/en
Publication of CN115426214A publication Critical patent/CN115426214A/en
Application granted granted Critical
Publication of CN115426214B publication Critical patent/CN115426214B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/40006Architecture of a communication node
    • 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/40169Flexible bus arrangements
    • 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
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

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

Abstract

The application relates to a number distribution system, a number distribution method, a number distribution slave device and a readable medium of the slave device, wherein the system comprises a master device and a plurality of levels of slave devices connected with the master device through buses, each slave device comprises a first switch, a matching resistor and a second switch, the first switch is connected with the buses after being connected with the matching resistor in series, and the second switch is connected on a series path of the buses; the first-stage slave device is configured to set the number of the first-stage slave device after receiving the first request instruction, feed the number back to the bus, control the first switch to be opened, control the second switch to be closed, and send a second request instruction to the bus, wherein the second request instruction comprises the number of the first-stage slave device and a message for requesting the slave device to set the number of the first-stage slave device; the master device is configured to send a first request instruction, where the first request instruction includes a message that requires the slave device to set its own number. The invention can automatically allocate numbers for the slave devices without adding additional signal wires, and has strong universality and wide application.

Description

Number distribution system, method for slave device, slave device and readable medium
Technical Field
The present application relates generally to the field of communications, and in particular, to a number allocation system and method for a slave device, and a computer readable medium.
Background
Buses are often used for one master device to communicate with a plurality of slave devices, and therefore, each slave device needs to be assigned a number to determine an object when in communication, otherwise if the numbers conflict, bus conflict can be caused, and communication fails. In general, when the number of the slave device is increased or decreased, a dial switch can be adopted to reassign the number to the slave device, and the number assignment method needs manual intervention and is easy to miss the number or repeat the number, so that communication failure is caused.
Patent CN102582462a discloses a system for automatically allocating slave device numbers, wherein an additional output signal line is added through a master device for starting the number allocation of each slave device, and an additional input signal line is added for receiving a number allocation completion signal; additional input signal lines are added to the slave device for receiving the number assignment signals, and additional output signal lines are added for controlling the number assignment of the slave device at the subsequent stage. Such a distribution system requires the addition of an additional signal line to enable automatic distribution of slave device numbers by software, increasing the complexity of the system.
Accordingly, there is a need for a method, system, slave device, and computer readable medium for automatically assigning slave device numbers without adding additional signal lines.
Disclosure of Invention
The technical problem to be solved by the application is to provide a number distribution system and method of slave equipment, the slave equipment and a computer readable medium, and the problem that an additional signal wire is required to be added in the current automatic distribution slave equipment number distribution system is solved.
In order to solve the technical problem, the application provides a serial number distribution system of slave equipment, which comprises a master equipment and multi-stage slave equipment connected with the master equipment in series through a bus, wherein each slave equipment comprises a first switch, a matching resistor and a second switch, the first switch is connected with the bus after being connected with the matching resistor in series, and the second switch is connected on a serial path of the bus; the first-stage slave device is configured to set the number of the first-stage slave device after receiving a first request instruction, feed back the number to the bus, control the first switch to be opened, control the second switch to be closed so that the second-stage slave device is connected to the bus, and send a second request instruction to the bus, wherein the second request instruction comprises the number of the first-stage slave device and a message for requesting the slave device to set the number of the first-stage slave device; the master device is configured to send a first request instruction, where the first request instruction includes a message that requires the slave device to set its own number.
In an embodiment of the present application, the initial state of the first switch is closed, and the initial state of the second switch is open.
In an embodiment of the present application, further includes: the second-stage slave device is configured to set the number of the second-stage slave device after receiving the second request instruction, feed back the number to the bus, control the first switch to be opened, control the second switch to be closed so that the third-stage slave device is connected to the bus, and send a third request instruction to the bus, wherein the third request instruction comprises the number of the second-stage slave device and a message for requesting the slave device to set the number of the second-stage slave device.
In an embodiment of the present application, the second-level slave device sets its own number according to the number of the first-level slave device in the second request instruction.
In an embodiment of the present application, further includes: each slave device is further configured to start a timeout timer, if the number fed back by the slave device at the next stage is received within a threshold time, the timeout timer is closed, otherwise, the current slave device is judged to be the slave device at the last stage, and a number allocation completion instruction is sent to the bus; the master device is further configured to receive the number assignment complete instruction.
In an embodiment of the present application, the number allocation complete instruction includes a number of the slave device at the last stage and a message that all slave devices complete the number allocation.
In an embodiment of the present application, when the current slave device is the last-stage slave device, the first switch is controlled to be closed, and the second switch is controlled to be opened.
In an embodiment of the present application, the first switch and/or the second switch comprises a relay, an analog switch or a MOS transistor.
In an embodiment of the present application, the bus comprises a CAN bus or an RS485 bus.
The application further provides a slave device for solving the technical problem, including: the first switch is connected with the matching resistor in series and then is connected with the bus, and the second switch is connected on the serial path of the bus; a bus communication unit connected to the bus; the controller is connected with the first switch, the second switch and the bus communication unit, and is configured to receive a first request instruction, set the number of the controller and feed the number back to the bus, control the first switch to be opened, control the second switch to be closed and send a second request instruction to the bus, wherein the second request instruction comprises the number of the slave device and a message for requesting other slave devices to set the number of the controller.
In an embodiment of the present application, the initial state of the first switch is closed, and the initial state of the second switch is open.
In an embodiment of the present application, further includes: the controller is further configured to start a timeout timer, and if no number fed back by other slave devices is received within a threshold time, determine that the slave device is the slave device of the last stage, and send a number allocation completion instruction to the bus.
The present application further provides a number allocation method of a slave device for a system including a master device and a multi-stage slave device connected in series with the master device through a bus, to solve the above technical problem, including:
step S1: the master device sends a first request instruction to the bus;
step S2: the first-stage slave device receives the first request instruction, sets the number of the slave device, feeds back the number to the bus, disconnects the self matching resistor from the bus, accesses the second-stage slave device to the bus, and sends a second request instruction to the bus;
step S3: the second-stage slave device receives the second request instruction, sets the number of the second-stage slave device, feeds back the number to the bus, disconnects the matching resistor of the second-stage slave device from the bus, accesses the third-stage slave device to the bus, and sends a third request instruction to the bus;
step S4: each level of slave equipment judges whether the serial number fed back by the slave equipment at the next level is received within the threshold time, if not, the current slave equipment is judged to be the slave equipment at the last level, and a serial number distribution completion instruction is sent to the bus;
step S5: and the master device receives the number allocation completion instruction.
In an embodiment of the present application, when the current slave device is the last-stage slave device, the self matching resistor is connected to the bus, and the bus serial path after the current slave device is disconnected.
In an embodiment of the present application, the steps of the number allocation method further include: the master device receives the number allocation completion instruction and then sequentially sends a working instruction to each slave device, wherein the working instruction comprises the number of each slave device; each slave device enters a normal working mode after receiving the working instruction and sends a working mode feedback instruction, wherein the working mode feedback instruction comprises the number of each slave device; and the master equipment receives the working mode feedback instruction.
The present application also provides a computer readable medium storing computer program code which, when executed by a processor, implements the above method.
Compared with the prior art, the technical scheme of the application has the following beneficial effects:
the number distribution system of the slave device can effectively and automatically identify the terminal device and automatically distribute the number for the identified device, so that the problem of repeated number caused by manual number distribution is avoided, the convenience is high, and the complexity of installation is reduced; the number distribution system of the slave equipment does not need to additionally increase signal wires, so that the slave equipment has strong universality and wide application; in addition, when the bus device needs to be increased or decreased, only the cable needs to be connected or disconnected, and no additional matching resistor needs to be connected.
Drawings
In order to make the above objects, features and advantages of the present application more comprehensible, embodiments accompanied with figures are described in detail below, wherein:
FIG. 1 is a schematic diagram of the numbering distribution system of a slave device according to an embodiment of the present application;
FIG. 2 is an exemplary circuit diagram of a slave device number assignment system of an embodiment of the present application;
fig. 3 is a flow chart of a number allocation method of a slave device according to an embodiment of the present application.
Detailed Description
In order to make the above objects, features and advantages of the present application more comprehensible, embodiments accompanied with figures are described in detail below.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, but the present application may be practiced otherwise than as described herein, and therefore the present application is not limited to the specific embodiments disclosed below.
Flowcharts are used in this application to describe the operations performed by systems according to embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed in order precisely. Rather, the various steps may be processed in reverse order or simultaneously. At the same time, other operations are added to or removed from these processes.
Fig. 1 is a schematic structural diagram of a number assignment system 100 of a slave device according to an embodiment of the present application. As shown in fig. 1, the number assignment system 100 of the slave device includes a master device 11 and a multi-stage slave device. The master device 11 includes a transceiver 111 and a matching resistor 112. The matching resistor 112 is always connected to the bus 101 to meet the signal transmission requirement on the bus, and improve the signal quality. The multi-stage slave device includes a slave device 12, a slave device 13, and a slave device 14. The number of the slave devices included in the multi-stage slave device can be set as required, and the number of the slave devices is not limited in the application. The slave device 12 is connected to the master device 11 via a bus 101. Slave device 12 includes a first switch 121, a second switch 122, and a matching resistor 123. The first switch 121 is connected in series with the matching resistor 123, and the first switch 121 is used for controlling whether the matching resistor 123 is connected into the bus 101. When the first switch 121 is closed, the matching resistor 123 is connected into the bus 101; when the first switch 121 is turned off, the matching resistor 123 is not connected to the bus 101. A second switch 122 is directly connected to the bus 101 for controlling the switching on and off of the conductors 102 of the slave device 13. When the second switch 122 is closed, the wire 102 is connected to the bus 101, and the slave device 13 is connected to the bus 101; when the second switch 122 is turned off, the conductor 102 is disconnected from the bus 101, and the slave device 13 cannot access the bus 101. In this embodiment, the first switch 121 is turned on, the matching resistor 123 is connected to the bus 101, the second switch 122 is turned off, and the conductive wire 102 is not connected to the bus 101.
In this embodiment, the slave device 12 is a first-stage slave device, and after power-up, the slave device 12 is directly connected to the bus 101 of the master device 11. The master device 11 transmits a first number request instruction including a message requesting the slave device to set its own number to the bus 101. Only slave 12 is present on bus 101. The slave device 12 sets its own number after receiving the first number request instruction and transmits a first feedback instruction to the bus 101. For example, the slave device 12 may set its own number to 001, and the format of the number setting is not limited in this application. After receiving the first feedback instruction from the slave device 12, the master device 11 does not send any further instruction until receiving the number assignment completion instruction. The slave device 12 then controls the first switch 121 to open the matching resistor 123 and controls the second switch 122 to access the conductor 102 of the slave device 13. After the conductor 102 is connected to the bus 101, the slave device 12 sends a second number request instruction to the bus 101, where the second number request instruction includes the number of the slave device 12 and a message requesting the slave device 13 to set its own number. The master device 11 does not respond after receiving the second number request instruction, and the slave device 13 allocates its own number to 002 according to the number 001 of the slave device 12 after receiving the second number request instruction, and sends a second feedback instruction to the bus 101, where the second feedback instruction includes the number of the slave device 13 and a message that the setting of the number is completed.
In some embodiments, slave device 12 is further configured to start a timeout timer while slave device 12 transmits a second number request instruction onto bus 101, and close the timeout timer if slave device 12 receives a second feedback instruction transmitted from slave device 13 within a threshold time; otherwise, it is determined that the slave device 12 is the last-stage slave device, and the slave device 12 transmits a number assignment completion instruction to the bus 101.
As shown in fig. 1, the first-stage slave device 12 is also followed by a second-stage slave device 13 and a third-stage slave device 14. The slave device 12 is not the last-stage slave device. Thus, the slave device 12 receives the second feedback instruction sent by the slave device 13, and the slave device 12 closes the timeout timer. After the slave device 13 assigns its own number and sends a second feedback instruction, the first switch 131 is controlled to disconnect the matching resistor 133, and the second switch 132 is controlled to access the wire 103 of the slave device 14. After the conductor 103 is connected to the conductor 102 and the bus 101, the slave device 13 sends a third number request instruction to the bus 101, where the third number request instruction includes the number of the slave device 13 and a message requesting the slave device 14 to set its own number. The master device 11 does not respond after receiving the third number request command, and the slave device 14 allocates its own number 003 after receiving the third number request command and sends a third feedback command to the bus 101, where the third feedback command includes the number of the slave device 14 and a message that the setting of the number is completed.
In some embodiments, the slave device 13 is further configured to start a timeout timer while the slave device 13 sends a third number request instruction onto the bus 101, and close the timeout timer if the slave device 13 receives a third feedback instruction sent by the slave device 14 within a threshold time; otherwise, it is determined that the slave device 13 is the last-stage slave device, and the slave device 13 transmits a number assignment completion instruction to the bus 101.
As shown in fig. 1, the slave device 14 includes a first switch 141, a second switch 142, and a matching resistor 143. The slave device 14 is further configured to start the timeout timer while the slave device 14 transmits the fourth number request instruction onto the bus 101, and since there is no slave device at the subsequent stage after the slave device 14 starts the timeout timer, the slave device 14 cannot receive the feedback instruction transmitted by the slave device at the subsequent stage, and determines that the slave device 14 is the slave device at the final stage. The slave device 14 transmits a number assignment completion instruction to the bus 101. The number assignment complete instruction contains the number of slaves 14 to indicate the number of slaves on the bus, and also contains all the messages that the slaves complete the number assignment.
The master device 11 receives a number assignment complete instruction from the bus 101.
In some embodiments, when the slave device 14 is determined to be the last-stage slave device, the slave device 14 controls the first switch 141 to be connected to the matching resistor 143, and controls the second switch 142 to disconnect the conductor 104 of the subsequent-stage slave device.
In some embodiments, slave 12, slave 13, and slave 14 do not respond after receiving a number assignment complete instruction from bus 101. In some embodiments, the master device 11, upon receiving the number assignment complete instruction, sequentially transmits work instructions to the slave devices 12, 13, and 14, each of which includes the slave device's respective number. Specifically, the master device 11 transmits a work instruction to the slave device 12, the work instruction including the number 001 of the slave device 12. Upon receiving the operation command from the device 12, the normal operation mode is entered and an operation mode feedback command is sent, which includes the number 001 of the slave device 12. The master device 11 then transmits an operation instruction to the slave device 13, the operation instruction including the number 002 of the slave device 13, and upon receiving the operation instruction from the slave device 13, enters the normal operation mode and transmits an operation mode feedback instruction including the number 002 of the slave device 13. The workflow of other slave devices and so on are not described in detail. When the master device 11 sends a complete operation instruction to all slave devices and receives operation mode feedback instructions sent by all slave devices, the system starts to work normally.
Fig. 2 is an exemplary circuit diagram of a slave device number assignment system in accordance with an embodiment of the present application. As shown in fig. 2, the slave device 12 includes not only the first switch 121, the second switch 122, and the matching resistor 123, but also a 485 transceiver 124 and a control unit (Microcontroller Unit, MCU) 125.
In this embodiment, the bus 101 is a 485 bus, and in some embodiments, the bus 101 may also be a CAN bus, which is not limited in type herein.
In some embodiments, the first switch 121 and/or the second switch 122 comprise a relay, an analog switch, or a MOS transistor, and the types of the first switch 121 and the second switch 122 are not limited in the present application.
The matching resistor (not shown) on the master device 11 remains on, the bus 101 is on in the slave device 12, the first switch 121 is closed, the matching resistor 123 of the slave device 12 is on, and the conductor 102 of the slave device 13 is off. Accessed from the matching resistor 133 of the device 13. After power-up, the master device 11 sends a first code request instruction to the bus 101, the content of which is the number of the slave device. Only slave 12 is present on bus 101. The control unit 125 of the slave device 12, upon receiving the first encoding request instruction, sets its own number to 001, and sends a first feedback instruction whose content is to feedback the setting of the own completed encoding to the master device 11 to the bus 101. After receiving the first feedback instruction, the master device 11 does not perform subsequent transmission until receiving the code allocation completion instruction. After the control unit 125 distributes the self code and sends the first feedback instruction, the first switch 121 is controlled to be opened and the second switch 122 is controlled to be closed. At this time, the wire 102 is connected to the bus 101, and the control unit 125 sends a second number request instruction including the number of the slave device 12 and a message requesting the slave device 13 to set its own number to the bus 101. While the control unit 125 opens a timeout timer, which may be a hardware device, included in the slave device 12, or may be a software program, in which a timeout timer is defined, and the implementation of the timeout timer is not limited in this application. The master device 11 does not respond after receiving the second number request instruction, and the control unit 135 of the slave device 13 allocates its own number 002 after receiving the second number request instruction, and sends a second feedback instruction to the bus 101, where the second feedback instruction includes the number of the slave device 13 and a message that the setting of the number is completed. The control unit 125 closes the timeout timer after receiving the second feedback instruction.
After the control unit 135 assigns its own number and sends the second feedback command, it controls the first switch 131 to open and controls the second switch 132 to close. The workflow of the slave device 13 is similar to that of the slave device 12, and thus, reference is made to the workflow of the slave device 12 for the workflow of the slave device 13, and the description thereof will be omitted.
After the control unit 145 of the slave device 14 allocates its own number and sends the third feedback instruction, the first switch 141 is controlled to be opened and the second switch 142 is controlled to be closed. The wire 104 is connected to the bus 101, and the control unit 145 sends a fourth number request instruction to the bus 101, and opens the timeout timer, and since the slave device 14 does not have a slave device at a later stage, the slave device 14 cannot receive the feedback instruction, the timer will timeout, and after timeout, the control unit 145 of the slave device 14 controls the first switch 141 to be closed and controls the second switch 142 to be opened. The control unit 145 transmits a number assignment completion instruction to the bus 101. The master device 11 receives a number assignment complete instruction from the bus 101. In some embodiments, slave 12, slave 13, and slave 14 do not respond after receiving a number assignment complete instruction from bus 101. After receiving the number allocation completion instruction, the master device 11 sequentially sends working instructions to the slave devices 12, 13 and 14 through the bus 101, the slave devices 12, 13 and 14 respectively send working mode feedback instructions after receiving the working instructions, and when the master device 11 sends the completion working instructions to all the slave devices and receives the working mode feedback instructions sent by all the slave devices, the system starts to work normally.
The number distribution system of the slave device can effectively and automatically identify the terminal device and automatically distribute the number for the identified device, so that the problem of repeated number caused by manual number distribution is avoided, the convenience is high, and the complexity of installation is reduced; the number distribution system of the slave equipment does not need to additionally increase signal wires, so that the slave equipment has strong universality and wide application; in addition, when the bus device needs to be increased or decreased, only the cable needs to be connected or disconnected, and no additional matching resistor needs to be connected.
Fig. 3 is a flow chart of a method 300 for allocating numbers of slave devices according to an embodiment of the present application. The number assignment method 300 is used in a system that includes a master device and multiple slave devices connected to the master device via a bus. As shown in fig. 3, the number assignment method 300 includes:
step S1: the master device sends a first request instruction to the bus;
step S2: the first-stage slave device receives a first request instruction, sets the number of the slave device, feeds back the number to the bus, disconnects the self matching resistor from the bus, accesses the second-stage slave device to the bus, and sends a second request instruction to the bus;
step S3: the second-stage slave device receives a second request instruction, sets the number of the second-stage slave device, feeds back the number to the bus, disconnects the matching resistor of the second-stage slave device from the bus, accesses the third-stage slave device to the bus, and sends a third request instruction to the bus;
step S4: each level of slave equipment judges whether the serial number fed back by the slave equipment at the next level is received within the threshold time, if not, the current slave equipment is judged to be the slave equipment at the last level, and a serial number distribution completion instruction is sent to the bus;
step S5: the master device receives a number assignment complete instruction.
In some embodiments, when the current slave is the last stage slave, its matching resistor is switched on the bus and the bus series path after the current slave is disconnected.
In some embodiments, each slave device does not respond after receiving a number assignment complete instruction from the bus.
In some embodiments, the step of the number assignment method further comprises:
after receiving the number allocation completion instruction, the master device sequentially sends a working instruction to each slave device, wherein the working instruction comprises the number of each slave device;
each slave device enters a normal working mode after receiving a working instruction and sends a working mode feedback instruction, wherein the working mode feedback instruction comprises the number of each slave device;
and the main equipment receives the working mode feedback instruction.
The present application also includes a computer readable medium storing computer program code which, when executed by a processor, implements the number assignment method of a slave device as described above.
When the number assignment method of the slave device is implemented as a computer program, the number assignment method may be stored in a computer-readable storage medium as an article of manufacture. For example, computer-readable storage media may include, but are not limited to, magnetic storage devices (e.g., hard disk, floppy disk, magnetic strips), optical disks (e.g., compact Disk (CD), digital Versatile Disk (DVD)), smart cards, and flash memory devices (e.g., electrically erasable programmable read-only memory (EPROM), cards, sticks, key drives). Moreover, various storage media described herein can represent one or more devices and/or other machine-readable media for storing information. The term "machine-readable medium" can include, without being limited to, wireless channels and various other media (and/or storage media) capable of storing, containing, and/or carrying code and/or instructions and/or data.
It should be understood that the embodiments described above are illustrative only. The embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processors may be implemented within one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), processors, controllers, micro-controllers, microprocessors, and/or other electronic units designed to perform the functions described herein, or a combination thereof.
Some aspects of the present application may be performed entirely by hardware, entirely by software (including firmware, resident software, micro-code, etc.) or by a combination of hardware and software. The above hardware or software may be referred to as a "data block," module, "" engine, "" unit, "" component, "or" system. The processor may be one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital signal processing devices (DAPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or a combination thereof. Furthermore, aspects of the present application may take the form of a computer product, comprising computer-readable program code, embodied in one or more computer-readable media. For example, computer-readable media can include, but are not limited to, magnetic storage devices (e.g., hard disk, floppy disk, tape … …), optical disk (e.g., compact disk CD, digital versatile disk DVD … …), smart card, and flash memory devices (e.g., card, stick, key drive … …).
The computer readable medium may comprise a propagated data signal with the computer program code embodied therein, for example, on a baseband or as part of a carrier wave. The propagated signal may take on a variety of forms, including electro-magnetic, optical, etc., or any suitable combination thereof. A computer readable medium can be any computer readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code located on a computer readable medium may be propagated through any suitable medium, including radio, cable, fiber optic cable, radio frequency signals, or the like, or a combination of any of the foregoing.
While the basic concepts have been described above, it will be apparent to those skilled in the art that the foregoing application disclosure is by way of example only and is not intended to be limiting. Although not explicitly described herein, various modifications, improvements, and adaptations of the present application may occur to one skilled in the art. Such modifications, improvements, and modifications are intended to be suggested within this application, and are therefore within the spirit and scope of the exemplary embodiments of this application.
As used in this application and in the claims, the terms "a," "an," "the," and/or "the" are not specific to the singular, but may include the plural, unless the context clearly dictates otherwise. In general, the terms "comprises" and "comprising" merely indicate that the steps and elements are explicitly identified, and they do not constitute an exclusive list, as other steps or elements may be included in a method or apparatus.
The relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application unless it is specifically stated otherwise. Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not drawn in actual scale for convenience of description. Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but should be considered part of the authorization specification where appropriate. In all examples shown and discussed herein, any specific values should be construed as merely illustrative, and not a limitation. Thus, other examples of the exemplary embodiments may have different values. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
Furthermore, although terms used in the present application are selected from publicly known and commonly used terms, some terms mentioned in the specification of the present application may be selected by the applicant at his or her discretion, the detailed meanings of which are described in relevant parts of the description herein. Furthermore, it is required that the present application be understood, not simply by the actual terms used but by the meaning of each term lying within.
Meanwhile, the present application uses specific words to describe embodiments of the present application. Reference to "one embodiment," "an embodiment," and/or "some embodiments" means that a particular feature, structure, or characteristic is associated with at least one embodiment of the present application. Thus, it should be emphasized and should be appreciated that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various positions in this specification are not necessarily referring to the same embodiment. Furthermore, certain features, structures, or characteristics of one or more embodiments of the present application may be combined as suitable.
In some embodiments, numbers describing the components, number of attributes are used, it being understood that such numbers being used in the description of embodiments are modified in some examples by the modifier "about," approximately, "or" substantially. Unless otherwise indicated, "about," "approximately," or "substantially" indicate that the number allows for a 20% variation. Accordingly, in some embodiments, numerical parameters set forth in the specification and claims are approximations that may vary depending upon the desired properties sought to be obtained by the individual embodiments. In some embodiments, the numerical parameters should take into account the specified significant digits and employ a method for preserving the general number of digits. Although the numerical ranges and parameters set forth herein are approximations that may be employed in some embodiments to confirm the breadth of the range, in particular embodiments, the setting of such numerical values is as precise as possible.

Claims (12)

1. A slave device number assignment system comprising a master device and a plurality of slave devices connected in series with the master device via a bus, characterized in that:
each slave device comprises a first switch, a matching resistor and a second switch, wherein the first switch is connected with the bus after being connected in series with the matching resistor, the second switch is connected on a serial path of the bus, the initial state of the first switch is closed, and the initial state of the second switch is opened;
the first-stage slave device is configured to set the number of the first-stage slave device after receiving a first request instruction, feed back the number to the bus, control the first switch to be opened, control the second switch to be closed so that the second-stage slave device is connected to the bus, and send a second request instruction to the bus, wherein the second request instruction comprises the number of the first-stage slave device and a message for requiring the next-stage slave device to set the number of the first-stage slave device;
the master device is configured to send a first request instruction, wherein the first request instruction comprises a message for requiring the slave device to set a self number;
each slave device is further configured to start a timeout timer, and if the number fed back by the slave device at the next stage is not received within a threshold time, the current slave device is the slave device at the last stage, the first switch of the slave device at the last stage is controlled to be closed, and the second switch of the slave device at the last stage is controlled to be opened.
2. The numbering distribution system of claim 1, further comprising: the second-stage slave device is configured to set the number of the second-stage slave device after receiving the second request instruction, feed back the number to the bus, control the first switch to be opened, control the second switch to be closed so that the third-stage slave device is connected to the bus, and send a third request instruction to the bus, wherein the third request instruction comprises the number of the second-stage slave device and a message for requiring the next-stage slave device to set the number of the second-stage slave device.
3. The number distribution system according to claim 2, wherein the second-stage slave device sets its own number according to the number of the first-stage slave device in the second request instruction.
4. The numbering distribution system of claim 1, further comprising:
when the current slave device is the last-stage slave device, the device is further configured to send a number allocation completion instruction to the bus;
the master device is further configured to receive the number allocation completion instruction, send a working instruction to each slave device in turn, and receive working mode feedback instructions sent by all slave devices, where the working instruction and the working mode feedback instructions include respective numbers of each slave device.
5. The number assignment system as claimed in claim 4, wherein the number assignment complete instruction includes a number of a slave device of a last stage and a message that all slave devices complete the number assignment.
6. The numbering distribution system according to any one of claims 1-5, wherein the first switch and/or the second switch comprises a relay, an analog switch or a MOS transistor.
7. The numbering distribution system according to any one of claims 1 to 5, wherein the bus comprises a CAN bus or an RS485 bus.
8. A slave device, comprising:
the first switch is connected with the matching resistor in series and then is connected with the bus, and the second switch is connected on a serial path of the bus, wherein the initial state of the first switch is closed, and the initial state of the second switch is opened;
a bus communication unit connected to the bus;
the controller is configured to receive a first request instruction, set a number of the controller and feed the number back to the bus, control the first switch to be opened, control the second switch to be closed and send a second request instruction to the bus, wherein the second request instruction comprises the number of the slave device and a message for requiring the slave device at the next stage to set the number of the controller; the controller is further configured to start a timeout timer, and if the number fed back by the slave device at the next stage is not received within a threshold time, the current slave device is judged to be the slave device at the last stage, the first switch of the slave device at the last stage is controlled to be closed, and the second switch of the slave device at the last stage is controlled to be opened.
9. The slave device of claim 8, further comprising:
the controller is further configured to send a number assignment complete instruction to the bus when the slave device is a last-stage slave device.
10. A number allocation method of a slave device, for a system including a master device and a plurality of slave devices connected in series with the master device through a bus, wherein an initial state of a matching resistance of the slave device is an access bus, an initial state of a first slave device is an access bus, and initial states of the other slave devices are non-access buses, the number allocation method is characterized by comprising:
step S1: the master device sends a first request instruction to the bus;
step S2: the first-stage slave device receives the first request instruction, sets the number of the first-stage slave device, feeds back the number to the bus, disconnects the self matching resistor from the bus, accesses the second-stage slave device into the bus, and sends a second request instruction to the bus, wherein the second request instruction comprises the number of the first-stage slave device and a message for requiring the next-stage slave device to set the number of the first-stage slave device;
step S3: the second-stage slave device receives the second request instruction, sets the number of the second-stage slave device, feeds back the number to the bus, disconnects the matching resistor of the second-stage slave device from the bus, accesses the third-stage slave device into the bus, and sends a third request instruction to the bus, wherein the third request instruction comprises the number of the second-stage slave device and a message for requiring the next-stage slave device to set the number of the second-stage slave device;
step S4: each level of slave equipment judges whether the serial number fed back by the slave equipment at the next level is received within the threshold time, if not, the current slave equipment is judged to be the slave equipment at the last level, when the current slave equipment is the slave equipment at the last level, the self matching resistor is connected into the bus, the serial path of the bus behind the current slave equipment is disconnected, and a serial number distribution completion instruction is sent to the bus;
step S5: and the master device receives the number allocation completion instruction.
11. The number assignment method as claimed in claim 10, further comprising:
the master device receives the number allocation completion instruction and then sequentially sends a working instruction to each slave device, wherein the working instruction comprises the number of each slave device;
each slave device enters a normal working mode after receiving the working instruction and sends a working mode feedback instruction, wherein the working mode feedback instruction comprises the number of each slave device;
and the master equipment receives the working mode feedback instruction.
12. A computer readable medium storing computer program code which, when executed by a processor, implements the method of any of claims 10-11.
CN202211122961.0A 2022-09-15 2022-09-15 Number distribution system, method for slave device, slave device and readable medium Active CN115426214B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211122961.0A CN115426214B (en) 2022-09-15 2022-09-15 Number distribution system, method for slave device, slave device and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211122961.0A CN115426214B (en) 2022-09-15 2022-09-15 Number distribution system, method for slave device, slave device and readable medium

Publications (2)

Publication Number Publication Date
CN115426214A CN115426214A (en) 2022-12-02
CN115426214B true CN115426214B (en) 2023-07-04

Family

ID=84203820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211122961.0A Active CN115426214B (en) 2022-09-15 2022-09-15 Number distribution system, method for slave device, slave device and readable medium

Country Status (1)

Country Link
CN (1) CN115426214B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102582462A (en) * 2012-02-28 2012-07-18 华霆(合肥)动力技术有限公司 Electric vehicle battery management system
CN110995889A (en) * 2019-12-30 2020-04-10 珠海格力电器股份有限公司 Address allocation system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8380905B2 (en) * 2010-05-21 2013-02-19 National Semiconductor Corporation Isolated communication bus and related protocol

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102582462A (en) * 2012-02-28 2012-07-18 华霆(合肥)动力技术有限公司 Electric vehicle battery management system
CN110995889A (en) * 2019-12-30 2020-04-10 珠海格力电器股份有限公司 Address allocation system and method

Also Published As

Publication number Publication date
CN115426214A (en) 2022-12-02

Similar Documents

Publication Publication Date Title
US4672536A (en) Arbitration method and device for allocating a shared resource in a data processing system
CN115150222B (en) Method and system for automatically distributing node address by LIN bus and SOC
CN104540176A (en) Access method of wireless network, device and terminal
EP4155119A1 (en) Method for controlling charging of vehicle, and device, program, medium, and vehicle
CN115426214B (en) Number distribution system, method for slave device, slave device and readable medium
CN106385377A (en) Information processing method and system thereof
CN107770009A (en) A kind of control device, method, storage medium and equipment
CN108491337B (en) Method for realizing group control
CN104572485B (en) The distribution method and device of dual system common memory
CN106844266A (en) A kind of hardware address addresses circuit and its making, application method
CN106028303B (en) Intelligent device discovery method and device
CN114979974A (en) Wireless control method, device and equipment
CN113411796A (en) Audio transmission system, method and storage medium for group-by-group Bluetooth device
CN113852699A (en) System and method for automatically distributing bus address
CN112532759B (en) Automatic configuration method of bus node identifier and bus network system
CN219642236U (en) Master-slave machine system and energy storage equipment
CN109839903B (en) Multi-task online cutting control method and system and laser cutting equipment
CN113746731B (en) Ethernet communication system, ethernet communication redundancy method and device
CN106919461A (en) Broadcast recipients' queue regulation method, device and terminal device
CN114248703B (en) Method for using open interface in automobile and related device
CN115865866B (en) Address allocation method and device
CN114039950B (en) Method for automatically distributing address of RS485 bus slave device
CN117320118A (en) Intelligent system networking method and device, computer equipment and intelligent system
CN114301176B (en) Power supply method, system, equipment and storage medium based on Ethernet
JPH10136050A (en) Electric communication equipment

Legal Events

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