WO2023236051A1 - 抢占总线的方法、装置、电子设备、控制系统及存储介质 - Google Patents
抢占总线的方法、装置、电子设备、控制系统及存储介质 Download PDFInfo
- Publication number
- WO2023236051A1 WO2023236051A1 PCT/CN2022/097432 CN2022097432W WO2023236051A1 WO 2023236051 A1 WO2023236051 A1 WO 2023236051A1 CN 2022097432 W CN2022097432 W CN 2022097432W WO 2023236051 A1 WO2023236051 A1 WO 2023236051A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- slave device
- bus
- slave
- priority
- status
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 108
- 238000004891 communication Methods 0.000 claims description 43
- 238000012544 monitoring process Methods 0.000 claims description 32
- 238000004590 computer program Methods 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 230000003828 downregulation Effects 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/403—Bus networks with centralised control, e.g. polling
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40143—Bus networks involving priority mechanisms
Definitions
- the present application relates to the field of master-slave communication, and in particular to a method, device, electronic equipment, control system and storage medium for bus preemption.
- a feasible method is to manually adjust the line sequence of each slave device to determine the slave device currently occupying the bus; or, to select and determine the slave device currently occupying the bus by manually switching the switch. equipment; in addition, you can also set the bus occupancy priority of each slave device through a manual control module, and then determine the slave device currently occupying the bus based on the bus occupancy priority of each slave device.
- the above methods all require manual participation and are not highly automated. Therefore, once a certain slave device is selected for control, if you want to use other slave devices for control, you need to manually select it again, which brings great inconvenience to the user.
- This application provides a method, device, electronic equipment, control system and storage medium for bus preemption.
- a method for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- slave device the method includes: monitoring whether the status of the first slave device changes; when the status of the first slave device changes, the first slave device adjusts the bus occupancy priority The bus occupancy priority of the second slave device is higher than that of the second slave device to seize the bus.
- a method for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- slave device the method includes: monitoring whether the status of the second slave device changes; when the status of the second slave device changes, the first slave device adjusts the bus occupancy priority The bus occupancy priority of the second slave device is lower than that of the second slave device, so that the second slave device seizes the bus.
- a method for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- slave device the method includes: monitoring the status of the first slave device and whether the status of the second slave device changes; when the status of the first slave device changes, the third slave device A slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device to seize the bus; when the status of the second slave device changes, the first slave device The slave device adjusts the bus occupancy priority to be lower than the bus occupancy priority of the second slave device, so that the second slave device seizes the bus.
- a method for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- slave device the method includes: monitoring whether the status of the first slave device changes; when the status of the first slave device changes, adjusting the first slave device and the second slave device.
- the bus occupancy priority of the slave device is such that the bus occupancy priority of the first slave device is higher than the bus occupancy priority of the second slave device, so that the first slave device seizes the bus. ;
- the host device controls the designated device according to the control instruction of the first slave device.
- a device for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- Slave device the device is applied to the first slave device, and the device includes: a monitoring module for monitoring whether the status of the first slave device changes; a priority adjustment module for when the status of the first slave device changes;
- the first slave device is controlled to adjust the bus occupancy priority to be higher than the bus occupancy priority of the second slave device to seize the bus.
- a device for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- Slave device the device is applied to the first slave device, and the device includes: a monitoring module for monitoring whether the status of the second slave device changes; a priority adjustment module for when the status of the second slave device changes;
- the first slave device is controlled to adjust the bus occupancy priority to be lower than the bus occupancy priority of the second slave device, so that the second slave device The device seizes the bus.
- a device for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device. Slave device, the device is applied to the first slave device, and the device includes: a monitoring module for monitoring whether the status of the first slave device and the status of the second slave device change.
- Priority adjustment module used to: when the status of the first slave device changes, control the first slave device to adjust the bus occupancy priority to be higher than the bus occupancy of the second slave device priority to seize the bus; when the status of the second slave device changes, control the first slave device to adjust the bus occupancy priority to be lower than the bus occupancy of the second slave device priority so that the second slave device preempts the bus.
- a device for preempting a bus is provided.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- the device includes: a monitoring unit, used to monitor whether the status of the first slave device changes; a priority adjustment unit, used to adjust the priority when the status of the first slave device changes.
- the bus occupancy priority of the first slave device and the second slave device is such that the bus occupancy priority of the first slave device is higher than the bus occupancy priority of the second slave device, so that causing the first slave device to seize the bus; a control module configured to control the host device to control a designated device according to the control instruction of the first slave device.
- an electronic device is provided.
- the electronic device is mounted on a bus as a first slave device.
- a host device and other devices related to the first slave device are also mounted on the bus.
- the same second slave device; the electronic device includes a processor, a memory, and a computer program stored on the memory that can be executed by the processor.
- the processor executes the computer program, any one of the above aspects is implemented.
- an electronic device is provided.
- the electronic device is mounted on a bus as a first slave device.
- a host device and other devices related to the first slave device are also mounted on the bus.
- the same second slave device; the electronic device is used to: monitor whether the status of the local machine changes; and when the status of the local machine changes, adjust the bus occupation priority to be higher than that of the second slave device.
- the bus occupancy priority of the machine device is to seize the bus.
- an electronic device is provided.
- the electronic device is mounted on a bus as a first slave device.
- a host device and other devices related to the first slave device are also mounted on the bus.
- the same second slave device; the electronic device is used to: monitor whether the status of the second slave device changes; when the status of the second slave device changes, adjust the bus occupancy priority to The bus occupancy priority is lower than that of the second slave device, so that the second slave device seizes the bus.
- an electronic device is provided.
- the electronic device is mounted on a bus as a first slave device.
- a host device and other devices related to the first slave device are also mounted on the bus.
- the electronic device is used to: monitor the status of the local machine and whether the status of the second slave device changes; when the status of the local machine changes, adjust the bus occupancy priority to be higher than that of the second slave device.
- the bus occupancy priority of the device is to seize the bus; when the status of the second slave device changes, the bus occupancy priority is adjusted to be lower than the bus occupancy priority of the second slave device, so as to Cause the second slave device to seize the bus.
- a multi-slave device control system includes a host device and at least two identical slave devices, and the identical slave devices include a first The slave device and the second slave device, the host device and the slave device are mounted on the bus; the first slave device is used to monitor whether the status of the local machine changes; and when the status of the local machine changes When changing, adjust the bus occupancy priority of the local machine to be higher than the bus occupancy priority of the second slave device to seize the bus; the second slave device is used to operate on the first slave device. When the status of the device changes, adjust the bus occupancy priority of the local machine to be lower than the bus occupancy priority of the first slave device, so that the first slave device seizes the bus; the host device Used to control the designated device according to the control instruction of the first slave device.
- a computer-readable storage medium is provided.
- a number of computer instructions are stored on the computer-readable storage medium.
- the methods described in the embodiments of any of the above aspects are implemented. Ways to seize the bus.
- the present application can identify the slave device whose status has changed and automatically set the slave device as the slave device with the highest bus occupancy priority, so that the slave device The device occupies the bus. Therefore, this application does not need to add additional manual switches or manual control models, so that among multiple identical slave devices connected to the same bus, the slave device whose status is changing is the slave device that is outputting the control signal.
- the device seizes the bus, that is, it automatically switches among multiple identical slave devices, so that the slave device that outputs the control signal can automatically obtain control rights, which improves the automation of the entire system and brings convenience to users.
- Figure 1 is a schematic diagram of a scenario of a bus preemption method in this application.
- Figure 2a is a schematic flowchart of a first embodiment of a bus preemption method in this application
- Figure 2b is a schematic flowchart of a second embodiment of a bus preemption method in this application.
- Figure 2c is a schematic flow chart of a third embodiment of a method for bus preemption in this application.
- FIG. 3 is a schematic flow chart of another method of bus preemption in this application.
- Figure 4 is a schematic flow chart of a control method for automatically adjusting priority of a control module in this application
- Figure 5 is a schematic structural diagram of a device for bus preemption in this application.
- Figure 6 is a schematic structural diagram of an electronic device of the present application.
- Figure 7 is a schematic structural diagram of another electronic device of the present application.
- Figure 8 is a schematic structural diagram of a multi-slave device control system of the present application.
- master-slave communication such as RS485 communication
- RS485 communication since each slave device connected to the same bus is distinguished according to the type of the slave device, two identical slave devices cannot appear on the same bus. , otherwise there will be a situation where two slave devices compete for bus occupancy.
- multiple control devices can be used in a ship control system to control the movement and direction of the ship.
- one throttle device can be installed in the control room, and another throttle device can be installed on the deck so that the crew can The control room and deck control the operation of the ship.
- one solution is to manually adjust the line sequence of each slave device to select the slave device currently connected to the bus. For example, you can manually adjust the line sequence of each slave device to determine the slave device currently occupying the bus; or you can select and determine the slave device currently occupying the bus by manually switching a switch; in addition, you can also use a
- the manual control module sets the bus occupancy priority of each slave device, and then determines the slave device currently occupying the bus based on the bus occupancy priority of each slave device.
- this application provides a bus preemption method, device, electronic equipment, multi-slave equipment control system and storage medium to solve the above problems.
- Embodiment 1 and Embodiment 2 respectively illustrate the bus preemption method described in this application from the perspective of the slave device and the entire master-slave communication system.
- the bus 110 is simultaneously equipped with a host device 120 and at least two identical devices including a first slave device 131 and a second slave device 132. Slave device. Moreover, in this application, slave devices such as the first slave device 131 and the second slave device 132 are directly connected to the bus 110, and the slave devices such as the first slave device 131 and the second slave device 132 are The device can determine the slave device to access the bus 110 through the bus preemption method described in this application, without adding hardware modules such as switches or manual control modules.
- the first slave device 131 and the second slave device 132 do not refer to specific slave devices, but can be any slave device, and any slave device can be either the first slave device 131 or the second slave device 132 . It is the second slave device 132.
- the other slave devices can serve as the second slave device 132.
- This application does not limit this.
- slave device A1 When slave device A1 is regarded as the first slave device 131, slave device A2 can be regarded as the second slave device.
- the slave device A1 can be regarded as the second slave device 132.
- a master-slave communication system may include more than two identical slave devices, then any one of these slave devices may serve as the first slave device 131, and when the slave device After the slave device serves as the first slave device 131, all other slave devices in the master-slave communication system except the slave device serve as the second slave device 132, and all perform the steps provided by the embodiments of the present application. The method corresponds to the steps of the second slave device 132 .
- the method of preempting the bus may include three embodiments.
- the method of preempting the bus may include the following steps:
- S201a Monitor whether the status of the first slave device changes
- S202a When the status of the first slave device changes, the first slave device adjusts the bus occupation priority to be higher than the bus occupation priority of the second slave device to seize the bus.
- step S201a the first slave device will continue to monitor the first slave device, that is, whether the status of the first slave device changes, and when it monitors that the status of the first slave device changes, perform the same steps as in step S202a. Operations corresponding to changes in the status of the first slave device.
- the method of preempting the bus may include the following steps:
- S201b Monitor whether the status of the second slave device changes
- S202b When the status of the second slave device changes, the first slave device adjusts the bus occupation priority to be lower than the bus occupation priority of the second slave device, so that the second slave device seizes the bus.
- step S201b the first slave device will continue to monitor the second slave device, that is, whether the status of other slave devices except the own machine changes, and after monitoring the status of the second slave device changes, When, the operation corresponding to the change in the state of the second slave device in step S202b is performed.
- the method of preempting the bus may include the following steps:
- S201 Monitor whether the status of the first slave device and the second slave device changes
- S202c2 When the status of the second slave device changes, the first slave device adjusts the bus occupation priority to be lower than the bus occupation priority of the second slave device, so that the second slave device seizes the bus.
- step S201c the first slave device will continue to monitor the first slave device and the second slave device, that is, whether the status of all slave devices changes, and after monitoring the first slave device, that is, When the status of the local machine changes, the operation corresponding to the status change of the first slave device in step S202c1 is performed, and when the status of the second slave device, that is, the status of other slave devices other than the local machine changes, is monitored, , then perform the operation corresponding to the change in the state of the second slave device in step S202c2.
- the second slave device when the first slave device continues to monitor whether the status of the first slave device or the second slave device changes, the second slave device also continuously monitors whether the status of the first slave device changes. Whether the status of the slave device or the second slave device changes, and, from the perspective of the second slave device, when it first monitors different slave devices (including this machine or a slave device different from this machine) ) changes, it will also perform operations similar to those of the first slave device.
- the change in the status of the slave device may be a change of the slave device between the working state and the sleep state.
- starting the slave device means changing from the sleep state to the working state, and turning off the slave device
- the device changes from the startup state to the working state. If the status of the slave device is expressed in the form of a numerical value, then zero can be used to represent the sleep state and non-zero to represent the working state. Then the changes in the state of the slave device can include changes from zero to non-zero, and from Non-zero to zero change.
- the change in the status of the slave device may also be a change of the slave device between multiple working states, for example, the slave device changes from a state of controlling the ship to travel eastward to a state of controlling the ship to travel north. , and the slave device changes from the state of controlling the ship to travel at low speed to the state of controlling the ship to travel at high speed. If the status of the slave device is expressed in the form of a numerical value, the change in the status of the slave device may include a change from one non-zero state to another non-zero state, such as a change from one to two.
- the status change of the slave device can also be caused by other status changes, as long as the purpose of the status change of the slave device is to control the corresponding designated device to respond to changes, for example, the crew responds to changes in the ship control system.
- the throttle control device is operated to control the ship to travel in a specified direction and speed, etc., which can be considered as a change in the state of the slave device described in the above method of this application, and this application does not limit this.
- whether the status of the slave device changes can be determined based on whether the slave device receives a specified external instruction. For example, in step S201a or step S201c, if it is monitored that the first slave device receives a specified external instruction, it is determined that the state of the first slave device changes. Similarly, if it is monitored that the second slave device receives a specified external instruction, it can be determined that the status of the second slave device has changed.
- the specified external instruction received by the slave device may be an external instruction specifically used to instruct the switching state of the slave device, or it may be an external instruction used to adjust the state parameters of the slave device, or it may It is other external instructions, as long as the external instructions can objectively cause the status of the slave device to change.
- the above-specified external command can be a throttle control signal.
- the slave device that is, the throttle control device receives the throttle control signal, it can According to the throttle control signal, the status of the aircraft is changed and the ship is controlled to perform corresponding operations.
- the bus occupancy priority is a parameter used to indicate the priority of the slave device to seize the bus. According to the bus occupancy priority of each slave device, the slave device with the highest priority can be determined. And the slave device with the highest priority occupies the bus.
- the bus occupancy priority may be a value within a specified range, such as an integer from 1 to 3, to distinguish slave devices with different bus occupancy priorities.
- the bus occupation priority may also be one of two specified values, such as one of 0 and 1, to distinguish each slave device into a slave device that seizes the bus and a slave device that does not seize the bus. There are two levels of devices. For example, a bus occupancy priority of 1 means that the slave device can seize the bus, and a bus occupancy priority of 0 means that the slave device cannot seize the bus.
- the first slave device and the second slave device may carry a bus occupancy priority flag bit for indicating the current bus occupancy priority of the slave device.
- the bus occupancy priority of the first slave device and the second slave device can also be expressed in other ways, for example, a designated device is connected between the host device and the bus to centrally configure each The slave device has a bus occupancy priority, and the host device can determine the slave device with the highest bus occupancy priority based on the device. This application does not limit this.
- step S202a or step S202c1 after it is determined that the status of the first slave device has changed, the first slave device can be caused to increase the bus occupancy priority so that its bus occupancy priority is higher than that of the second slave device. Assume priority so that the first slave device seizes the bus. From the perspective of the second slave device, when the second slave device determines that the status of the first slave device has changed, the second slave device will lower the bus occupancy priority so that its bus occupancy priority is lower than that of the first slave device. The bus priority of a slave device so that the first slave device can seize the bus.
- step S202b or step S202c2 after it is determined that the status of the second slave device has changed, the first slave device can be caused to lower the bus occupancy priority so that its bus occupancy priority is lower than that of the second slave device. bus occupancy priority to enable the second slave device to seize the bus. From the perspective of the second slave device, when the second slave device determines that its own status has changed, the second slave device will increase the bus occupancy priority so that its bus occupancy priority is higher than that of the first slave device. bus priority of the slave device so that the second slave device preempts the bus.
- the slave device when the status of any slave device changes, the slave device will increase its bus occupation priority, while other slave devices will increase the priority of the slave device.
- the bus occupancy priority is lowered, which ultimately makes the bus occupancy priority of the slave device higher than that of other slave devices, that is, the slave device can seize the bus.
- slave device A1 when the status of slave device A1 changes, slave device A1 will increase its bus occupancy priority, such as changing its bus occupation priority.
- the bus occupancy priority is adjusted from 0 to 1, and the slave device A2 will lower its bus occupancy priority, for example, adjust its bus occupancy priority from 1 to 0, so that the bus occupancy priority of the slave device A1 is higher.
- the bus occupation priority of slave device A2 is therefore, slave device A1 can seize the bus, and the host device will perform corresponding operations according to the instructions issued by slave device A1.
- the slave device A1's adjustment of the bus priority to be higher than the bus occupation priority of the slave device A2 also includes the slave device A1 maintaining the bus.
- the occupation priority remains unchanged. Specifically, if the status of the slave device A1 changes and the bus occupancy priority of the slave device A1 is 1, that is, the bus occupancy priority of the slave device A1 is the highest priority, then the bus occupancy priority of the slave device A1 is already the highest priority. Machine device A1 keeps the bus occupation priority unchanged.
- the first slave device when the first slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device, its bus occupancy priority can be set to the highest, that is, the highest priority level, so that No matter what the bus occupancy priority of the second slave device is, the first slave device can seize the bus; and the first slave device can also notify the second slave device after setting its bus occupancy priority to the highest. Adjust the bus occupancy priority of the local machine so that the bus occupancy priority of the second slave device is adjusted to below the highest level so that only the first slave device can seize the bus.
- the first slave device when the first slave device adjusts the bus occupancy priority to be lower than the bus occupancy priority of the second slave device, its bus occupancy priority can be set to the lowest, so that regardless of whether the second slave device What is the bus occupancy priority of the slave device? The first slave device will not seize the bus to avoid sending conflicts with the second slave device.
- the first slave device may send bus preemption information to the bus, so that the second slave device receives the preemption bus information. Adjust the bus occupancy priority of this machine when receiving information.
- the bus preemption information may be a special information message, which may be used to notify a slave device to seize the bus, or to specify a slave device to seize the bus.
- the second slave device also connected to the bus can receive the bus preemption information.
- the second slave device can learn about other slave devices other than itself.
- the second slave device can timely Lower the bus occupancy priority of the local machine so that the bus occupancy priority of the first slave device can be higher than the bus occupancy priority of the second slave device, so that the first slave device can successfully seize the bus.
- the second slave device When the second slave device receives the bus preemption information sent by the first slave device, it can be determined that the status of the first slave device has changed and needs to seize the bus. Similarly, when the first slave device receives the bus preemption information When the second slave device sends the bus preemption information, it can be determined that the status of the second slave device has changed. Therefore, in some embodiments, in step S201b or step S201c, the status of the second slave device can be determined by monitoring whether the first slave device receives the preemption bus information sent by the second slave device. whether changes have occurred.
- step S202b or step S202c2 If it is monitored that the first slave device receives the bus preemption information sent by the second slave device, it can be determined that the status of the second slave device has changed, so that the first slave device enters step S202b or step S202c2, that is, down-regulation
- the local bus takes priority so that the second slave device can seize the bus.
- adjusting its bus occupancy priority to be lower than the bus occupancy priority of the second slave device includes: (1) If At this time, the bus occupancy priority of the first slave device is higher than the bus occupancy priority of the second slave device, then the first slave device lowers the bus occupancy priority of its own device so that its bus occupancy priority is Lower than the bus occupancy priority of the second slave device; (2) If the bus occupancy priority of the first slave device is already lower than the bus occupancy priority of the second slave device, the first slave device remains The current bus occupation priority remains unchanged.
- step S202a or step S202c1 after the first slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device, the bus occupancy priority of the first slave device may also be adjusted.
- the first slave device is allowed to receive information and send information on the bus, and the second slave device cannot send information, so that the host connected to the bus The device will only receive the information sent by the first slave device and perform corresponding operations based on the information sent by the first slave device, avoiding the host device being unable to operate due to conflicts between information sent by multiple slave devices.
- allowing the first slave device to receive and send information on the bus may be when the first slave device detects that its bus occupancy priority is the highest or higher than other slave devices. Information can be sent to the bus; but the second slave device cannot send information, it may be that when the second slave device detects that its bus occupancy priority is the lowest or lower than other slave devices, it cannot Information is sent to the bus.
- step S202b or step S202c2 after the first slave device adjusts the bus occupancy priority to be lower than the bus occupancy priority of the second slave device, the bus occupancy priority of the second slave device may also be adjusted.
- the bus occupancy priority of the second slave device may also be adjusted.
- the first slave device is not allowed to send information, and the second slave device can receive information and send information on the bus, thereby making the host connected to the bus
- the device will only receive the information sent by the second slave device and perform corresponding operations based on the information sent by the second slave device, avoiding the host device being unable to operate due to conflicts between information sent by multiple slave devices.
- the first slave device is not allowed to send information. This may be because the first slave device cannot send information to the device when it detects that its bus occupancy priority is the lowest or lower than other slave devices. on the bus; the second slave device can receive and send information on the bus. When the second slave device detects that its bus occupancy priority is the highest or higher than other slave devices, it can Information is sent to the bus.
- the bus preemption method described in this application can be used when multiple control devices are used in a ship control system to control the operation and direction of the ship. That is, the above-mentioned master-slave communication system can be a marine multi-throttle control system. system.
- the above-mentioned slave device including the first slave device and the second slave device, may be a throttle control device in a marine multi-throttle control system.
- the host device may be a communication adapter board of the marine multi-throttle control system.
- the slave device and the host device in the marine multi-throttle control system can also be other devices, which is not limited in this application.
- the above-mentioned bus may be an RS485 bus, and each device connected to the RS485 bus communicates in a master-slave polling manner.
- the above-mentioned bus can also be a communication bus using other communication standards, such as CAN bus and RS422 bus, as long as it also communicates in a master-slave polling manner, this application does not limit this .
- the slave device when the status of any slave device changes, the slave device will increase its bus occupancy priority and preempt bus information. Other slave devices will After receiving the bus preemption information, the bus occupancy priority of the local machine is lowered. Eventually, the bus occupancy priority of the slave device whose status changes will be higher than the bus occupancy priority of other slave devices, causing the status to change.
- the slave device can automatically seize the bus, ensuring that the host device can promptly control the corresponding designated device according to the status change of the slave device, so that regardless of the operation on any slave device, the operation result can be executed.
- the method of bus preemption described in this application does not require additional logic control circuits such as manual switching switches or manual control modules, nor does it require manual adjustment of the bus occupation priority of each slave device, so that the entire master-slave communication system has Higher degree of automation.
- the method described in this application is applicable to any slave device in the master-slave communication system.
- Each slave device only needs to execute each step of the above method through a built-in program, so that the bus occupation priority of the slave device can be realized. auto-adjust. Therefore, as long as the corresponding program is built into the new slave device, after the new slave device joins the existing master-slave communication system, the bus occupancy priority of each slave device can still be automatically adjusted. Adjustment. Therefore, multiple identical slave devices can be plug-and-play on the same bus, providing the possibility for later expansion of the number of slave devices and the realization of an uncontrolled master-slave communication system.
- the method of preempting the bus may include the following steps:
- S301 Monitor whether the status of the first slave device changes
- S302 When the status of the first slave device changes, adjust the bus occupancy priority of the first slave device and the second slave device so that the bus occupancy priority of the first slave device is higher than that of the second slave device.
- the bus occupancy priority is such that the first slave device seizes the bus
- S303 The host device controls the designated device according to the control instruction of the first slave device.
- the first slave device can be any slave device in the master-slave communication system.
- the slave device can be the first slave device.
- slave device, and slave devices other than the slave device serve as second slave devices.
- step S301 the master-slave communication system will continuously monitor whether the status of the first slave device changes, that is, continuously monitor whether the status of any slave device changes, and when monitoring any slave device, When the status of the slave device changes, the slave device is regarded as the first slave device, and step S302 is entered.
- the change in the status of the slave device may be a change of the slave device between the working state and the sleep state.
- starting the slave device means changing from the sleep state to the working state, and turning off the slave device
- the device changes from the startup state to the working state. If the status of the slave device is expressed in the form of a numerical value, then zero can be used to represent the sleep state and non-zero to represent the working state. Then the changes in the state of the slave device can include changes from zero to non-zero, and from Non-zero to zero change.
- the change in the status of the slave device may also be a change of the slave device between multiple working states, for example, the slave device changes from a state of controlling the ship to travel eastward to a state of controlling the ship to travel north. , and the slave device changes from the state of controlling the ship to travel at low speed to the state of controlling the ship to travel at high speed. If the status of the slave device is expressed in the form of a numerical value, the change in the status of the slave device may include a change from one non-zero state to another non-zero state, such as a change from one to two.
- the status change of the slave device can also be caused by other status changes, as long as the purpose of the status change of the slave device is to control the corresponding designated device to respond to changes, for example, the crew responds to changes in the ship control system.
- the throttle control device is operated to control the ship to travel in a specified direction and speed, etc., which can be considered as a change in the state of the slave device described in the above method of this application, and this application does not limit this.
- whether the status of the slave device changes can be determined based on whether the slave device receives a specified external instruction. For example, if it is monitored that the first slave device receives a specified external instruction, it is determined that the state of the first slave device has changed.
- the specified external instruction received by the slave device may be an external instruction specifically used to instruct the switching state of the slave device, or it may be an external instruction used to adjust the state parameters of the slave device, or it may It is other external instructions, as long as the external instructions can objectively cause the status of the slave device to change. This application does not limit the specific form of the external instructions.
- the above-specified external command can be a throttle control signal.
- the slave device that is, the throttle control device receives the throttle control signal, it can According to the throttle control signal, the status of the aircraft is changed and the ship is controlled to perform corresponding operations.
- the bus occupancy priority is a parameter used to indicate the priority of the slave device to seize the bus. According to the bus occupancy priority of each slave device, the slave device with the highest priority can be determined. And the slave device with the highest priority occupies the bus.
- the bus occupancy priority may be a value within a specified range, such as an integer from 1 to 3, to distinguish slave devices with different bus occupancy priorities.
- the bus occupation priority may also be one of two specified values, such as one of 0 and 1, to distinguish each slave device into a slave device that seizes the bus and a slave device that does not seize the bus. There are two levels of devices. For example, a bus occupancy priority of 1 means that the slave device can seize the bus, and a bus occupancy priority of 0 means that the slave device cannot seize the bus.
- the first slave device and the second slave device may carry a bus occupancy priority flag bit for indicating the current bus occupancy priority of the slave device.
- the bus occupancy priority of the first slave device and the second slave device can also be expressed in other ways, for example, a designated device is connected between the host device and the bus to centrally configure each The slave device has a bus occupancy priority, and the host device can determine the slave device with the highest bus occupancy priority based on the device. This application does not limit this.
- step S302 after it is determined that the status of the first slave device has changed, the first slave device can be made to increase the bus occupancy priority, and the second slave device can be made to lower the bus occupancy priority, so that the first slave device can be made to lower the bus occupancy priority.
- the bus occupancy priority of the master device is higher than the bus occupancy priority of the second slave device, so that the first slave device can successfully seize the bus.
- the first slave device adjusts the bus occupancy priority up, and the second slave device adjusts the bus occupancy priority down, such that the bus occupancy priority of the first slave device is higher than that of the second slave device.
- the bus occupancy priority of the first slave device can be set to the highest, that is, the highest priority level, so that no matter what the bus occupancy priority of the second slave device is, the first slave device can Seize the bus; and after the first slave device sets its bus occupancy priority to the highest, it can also notify the second slave device to adjust its bus occupancy priority so that the bus occupancy priority of the first slave device is high.
- the bus occupation priority of the second slave device is such that only the first slave device can seize the bus.
- the first slave device may send bus preemption information to the bus, so that the second slave device receives the preemption bus information. Adjust the bus occupancy priority of this machine when receiving information.
- the bus preemption information may be a special information message, which may be used to notify a slave device to seize the bus, or to specify a slave device to seize the bus.
- the second slave device also connected to the bus can receive the bus preemption information.
- the second slave device can learn about other slave devices other than itself.
- the second slave device can timely Lower the bus occupancy priority of the local machine so that the bus occupancy priority of the first slave device can be higher than the bus occupancy priority of the second slave device, so that the first slave device can successfully seize the bus.
- step S302 after the first slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device, the bus occupancy priority of the first slave device may also be adjusted.
- the first slave device is allowed to receive and send information on the bus, but the second slave device cannot send information, so that the host device connected to the bus will only Receives the information sent by the first slave device, and performs corresponding operations based on the information sent by the first slave device, avoiding the host device being unable to determine which one to base on due to conflicts between information sent by multiple slave devices.
- the information sent by the slave device performs corresponding operations, causing the system to fail to work or malfunction.
- allowing the first slave device to receive and send information on the bus may be when the first slave device detects that its bus occupancy priority is the highest or higher than other slave devices. Information can be sent to the bus; but the second slave device cannot send information, it may be that when the second slave device detects that its bus occupancy priority is the lowest or lower than other slave devices, it cannot Information is sent to the bus.
- step S303 after the first slave device seizes the bus, the host device can control the designated device according to the control instructions of the first slave device, and the host device will not receive the control instructions of the second slave device at this time. Avoid conflicting control instructions from multiple slave devices.
- the bus preemption method described in this application can be used when multiple control devices are used in a ship control system to control the operation and direction of the ship. That is, the above-mentioned master-slave communication system can be a marine multi-throttle control system. system.
- the above-mentioned slave device including the first slave device and the second slave device, may be a throttle control device in a marine multi-throttle control system.
- the host device may be a communication adapter board of the marine multi-throttle control system.
- the slave device and the host device in the marine multi-throttle control system can also be other devices, which is not limited in this application.
- the above-mentioned bus may be an RS485 bus, and each device connected to the RS485 bus communicates in a master-slave polling manner.
- the above-mentioned bus can also be a communication bus using other communication standards, such as CAN bus and RS422 bus, as long as it also communicates in a master-slave polling manner, this application does not limit this .
- the first slave device when the status of the first slave device changes, the first slave device will increase its bus occupancy priority and preempt bus information, and the second slave device will After receiving the bus preemption information, the device lowers the bus occupancy priority of the local device. Eventually, the bus occupancy priority of the first slave device will be higher than the bus occupancy priority of the second slave device, so that the bus occupancy priority of the first slave device will be higher.
- the host device can automatically seize the bus, ensuring that the host device can promptly designate the device according to the control of the first slave device, so that the operations performed on the first slave device can be executed in time.
- the method of bus preemption described in this application does not require additional logic control circuits such as manual switching switches or manual control modules, nor does it require manual adjustment of the bus occupation priority of each slave device, so that the entire master-slave communication system has Higher degree of automation.
- Figure 4 is a schematic flow chart of a control method for automatically adjusting the priority of a control module in this application.
- the control method includes the following steps:
- S401 Power on the system; the system includes multiple identical control modules connected to the same RS485 bus;
- step S403 Determine whether there is a control module instruction to change from zero to non-zero; if so, proceed to step S405 to specify the control module; if not, proceed to step S404 to determine whether another situation occurs.
- step S404 Determine whether there is a control module instruction that changes from non-zero to zero; if so, proceed to step S405 to specify the control module; if not, return to step S402 and continue to wait for the control module status switching logic trigger;
- S405 Designate this control module (that is, the control module whose instructions change from zero to non-zero or the control module whose instructions change from non-zero to zero) as the highest priority control module.
- This control module can send and receive normally on the RS485 bus; when the control module When it can send and receive normally on the RS485 bus, the control instructions of the control module can be executed;
- S406 Send a priority preemption message to the RS485 bus; the priority preemption message is used to notify other control modules to lower their priority;
- control modules can only receive but not send; among them, other control modules are other control modules at the same level as the above-mentioned control module set as the highest priority; when the control module can only receive but not send on the RS485 bus, the control module's The control instructions will not be executed; after completing the setting of the priorities of each control module, the process will return to step S402 and continue to wait for the next control module state switching logic trigger to readjust the priorities of each control module.
- control module In the above control method, all the same control modules are connected to the RS485 bus at the same time. After the entire system is powered on, the first control module that changes from zero to non-zero or non-zero to zero will be output as the device with the highest current priority. control information and send preemption priority information to the bus. At the same time, other level control modules only receive bus information and no longer send any information to the bus after receiving the preemption information.
- the low-priority device when it changes from zero to non-zero or non-zero to zero, it automatically increases its priority to the highest and sends preemption priority information to the bus.
- Other equal-level control devices on the bus lower their priority after receiving the information. own priority and change to a state of only receiving but not sending.
- the change in the control module may not be limited to the change from zero to non-zero or non-zero to zero, but may also be other changes, as long as a change occurs, this application does not limit this. .
- the control module can be a throttle handle or a throttle lever, etc., both of which have zero position, forward gear, reverse gear, etc.
- the throttle handle controls the drive operation by rotating the handle, and the throttle lever pushes forward and backward.
- the throttle handle and throttle lever are set at different positions of the ship for convenient operation.
- the throttle handle and the throttle lever are both connected to the same bus.
- preemption priority information will be sent to the bus.
- the throttle handle has the highest priority, and The priority of the throttle stick becomes lower, and the drive operates according to the instructions of the throttle handle.
- the preemption priority information When the throttle stick is pushed from the zero position to a non-zero position, the preemption priority information will be sent to the bus. At this time, the throttle stick has the highest priority, and the throttle handle The priority is reduced, and the drive operates according to the instructions of the throttle lever. When you want to control it through the throttle handle again, first turn the throttle handle and return to the zero position from the non-zero position, and the preemption priority information will be sent to the bus. At this time, the throttle The handle has the highest priority, while the priority of the throttle lever becomes lower, and the drive operates according to the instructions of the throttle lever. When you want to control via the throttle stick again, the control method is the same as above and will not be described again.
- this application can complete the automatic adjustment of the control module priority from system power-on to normal operation in one cycle, and successfully realizes the parallel processing logic of multiple control modules on the RS485 bus.
- control modules are completely consistent, and the control logic of automatic priority adjustment can be built into each control module, which facilitates the plug-and-play of later equipment and also satisfies any expansion of the control module. Not affected by other peer devices of the same type.
- this application provides a device for preempting a bus.
- the bus is equipped with a host device and at least two identical slave devices.
- the identical slave devices include a first slave device and a second slave device.
- Devices that seize the bus may include the following modules:
- the monitoring module 501 is used to monitor whether the status of the first slave device changes
- the priority adjustment module 502 is used to control the first slave device to adjust the bus occupancy priority to be higher than the bus occupancy priority of the second slave device to seize the bus when the status of the first slave device changes.
- the above-mentioned listening module 501 can determine whether the status of the first slave device changes based on whether the first slave device receives a specified external instruction. If it is monitored that the first slave device receives a specified external instruction, it is determined that the state of the first slave device has changed.
- the external command may be a throttle control signal.
- the priority adjustment module 502 when the priority adjustment module 502 adjusts the bus occupation priority of the first slave device to be higher than the bus occupation priority of the second slave device, the first slave device may occupy the bus.
- the priority is set to the highest, and the second slave device is notified to adjust its own bus occupation priority.
- the above-mentioned priority adjustment module 502 is also used to control the first slave device to send bus preemption information to the bus, so that when the second slave device receives the bus preemption information, it adjusts its own bus occupation priority. .
- the first slave device and the second slave device may carry a bus occupancy priority flag bit, which is used to identify the bus occupancy priority of the first slave device and the second slave device.
- the above priority adjustment module 502 can also be used to adjust the bus occupancy priority of the first slave device after the first slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device. During the period when the bus occupancy priority is higher than the bus occupancy priority of the second slave device, the first slave device is allowed to receive information and send information on the bus, but the second slave device cannot send information.
- the above-mentioned priority adjustment module 502 can also adjust the bus occupancy priority of the second slave device. During the period when the bus with a higher priority than the first slave device occupies the priority, the first slave device is not allowed to send information, and the second slave device can receive and send information on the bus.
- the first slave device and the second slave device may be throttle control devices of a marine multi-throttle control system.
- the host device may be a communication adapter board of a marine multi-throttle control system.
- the bus may be an RS485 bus.
- This application also provides a device for preempting the bus.
- a master device and at least two identical slave devices are mounted on the bus.
- the identical slave devices include a first slave device and a second slave device, and the device is applied to the first slave device.
- Devices that seize the bus include:
- the monitoring module is used to monitor whether the status of the second slave device changes
- a priority adjustment module configured to control the first slave device to adjust the bus occupancy priority to be lower than the bus occupancy priority of the second slave device when the status of the second slave device changes, so that the second slave device The machine device seizes the bus.
- the monitoring module may determine whether the status of the second slave device changes based on whether the preemption bus information sent by the second slave device is received. If it is monitored that the first slave device receives the preemption bus information sent by the second slave device, it can be determined that the status of the second slave device has changed.
- the first slave device and the second slave device carry bus occupation priority flag bits.
- the priority adjustment module is also configured to not allow the first slave device to send information during a period when the bus occupancy priority of the second slave device is higher than the bus occupancy priority of the first slave device.
- Slave devices are capable of receiving and sending information on the bus.
- the external command is a throttle control signal.
- the first slave device and the second slave device are throttle control devices of a marine multi-throttle control system.
- the host device is a communication adapter board of a marine multi-throttle control system.
- the bus is an RS485 bus.
- This application also provides a device for preempting the bus.
- a master device and at least two identical slave devices are mounted on the bus, and the identical slave devices include a first slave device and a second slave device. This device is applied to the first slave device.
- Devices that seize the bus include:
- a monitoring module used to monitor the status of the first slave device and whether the status of the second slave device changes
- a priority adjustment module used to: when the status of the first slave device changes, control the first slave device to adjust the bus occupancy priority to be higher than the bus occupancy priority of the second slave device to seize the bus; When the status of the second slave device changes, the first slave device is controlled to adjust the bus occupancy priority to be lower than the bus occupancy priority of the second slave device, so that the second slave device seizes the bus.
- the listening module may determine whether the status of the first slave device changes based on whether the first slave device receives a specified external instruction. If it is monitored that the first slave device receives a specified external instruction, it is determined that the state of the first slave device has changed.
- the external command may be a throttle control signal.
- the priority adjustment module may be: the first slave device adjusts the bus occupancy priority to Set to the highest; and notify the second slave device to adjust its bus occupation priority.
- the above-mentioned priority adjustment module 502 is also used to control the first slave device to send bus preemption information to the bus, so that when the second slave device receives the bus preemption information, it adjusts its own bus occupation priority. .
- the monitoring module may determine whether the status of the second slave device changes based on whether the preemption bus information sent by the second slave device is received. If it is monitored that the first slave device receives the preemption bus information sent by the second slave device, it can be determined that the status of the second slave device has changed.
- the first slave device and the second slave device may carry a bus occupancy priority flag bit, which is used to identify the bus occupancy priority of the first slave device and the second slave device.
- the above priority adjustment module 502 can also be used to adjust the bus occupancy priority of the first slave device after the first slave device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device. During the period when the bus occupancy priority is higher than the bus occupancy priority of the second slave device, the first slave device is allowed to receive information and send information on the bus, but the second slave device cannot send information.
- the above-mentioned priority adjustment module 502 can also adjust the bus occupancy priority of the second slave device. During the period when the bus with a higher priority than the first slave device occupies the priority, the first slave device is not allowed to send information, and the second slave device can receive and send information on the bus.
- the first slave device and the second slave device may be throttle control devices of a marine multi-throttle control system.
- the host device may be a communication adapter board of a marine multi-throttle control system.
- the bus may be an RS485 bus.
- This application also provides a device for preempting the bus.
- a master device and at least two identical slave devices are mounted on the bus, and the identical slave devices include a first slave device and a second slave device.
- the device that seizes the bus is used in a system consisting of a master and at least two slave devices.
- Devices that seize the bus include:
- the monitoring module is used to monitor whether the status of the first slave device changes
- a priority adjustment module used to adjust the bus occupancy priority of the first slave device and the second slave device when the status of the first slave device changes, so that the bus occupancy priority of the first slave device is higher than The bus occupation priority of the second slave device is such that the first slave device seizes the bus;
- the control module is used to control the host device to control the designated device according to the control instructions of the first slave device.
- the priority adjustment module is used to: set the bus occupancy priority of the first slave device to the highest; notify the second slave device to adjust its bus occupancy priority so that the bus occupancy priority of the first slave device is the highest.
- the bus occupancy priority is higher than the bus occupancy priority of the second slave device.
- the priority adjustment module is used to: control the first slave device to send bus preemption information to the bus; control the second slave device to adjust its own bus occupation priority when it receives the bus preemption information.
- the first slave device and the second slave device carry bus occupation priority flag bits.
- the priority adjustment module is configured to: allow the first slave device to receive information on the bus during a period when the bus occupancy priority of the first slave device is higher than the bus occupancy priority of the second slave device. Send information and do not allow the second slave device to send information.
- the external command is a throttle control signal.
- the first slave device and the second slave device are throttle control devices of a marine multi-throttle control system.
- the host device is a communication adapter board of a marine multi-throttle control system.
- the bus is an RS485 bus.
- Embodiment 4 to Embodiment 7 of the present application is only for illustration and does not limit the embodiments of the bus preemption device of the present application.
- the specific execution of each module of the bus preemption device described in Embodiment 4 to Embodiment 7 of the present application For the method, reference may be made to the bus preemption method described in Embodiment 1 or Embodiment 2 of this application, which will not be described in detail here.
- the present application also provides an electronic device 140.
- the electronic device 140 can be mounted on the bus 110 as a first slave device.
- the bus 110 is also mounted with a host device 120 and other devices related to the first slave device.
- the same second slave device 132; the electronic device 140 includes a processor 1401, a memory 1402, and a computer program 1403 stored on the memory 1402 that can be executed by the processor 1401.
- the processor 1401 executes the computer program 1403
- the external command may be a throttle control signal.
- the first slave device and the second slave device 132 may carry a bus occupancy priority flag bit for identifying the bus occupancy priority of the first slave device and the second slave device 132 .
- the first slave device and the second slave device 132 may be throttle control devices of a marine multi-throttle control system.
- the host device 120 may be a communication adapter board of a marine multi-throttle control system.
- bus 110 may be an RS485 bus.
- the present application also provides an electronic device 140.
- the electronic device 140 can be mounted on the bus 110 as a first slave device.
- the bus 110 is also mounted with a host device 120 and other devices related to the first slave device.
- the same second slave device 132; electronic device 140 may be used for:
- the bus occupancy priority is adjusted to be higher than the bus occupancy priority of the second slave device 132 to seize the bus 110 .
- whether the status of the first slave device changes can be determined based on whether the local machine receives a specified external instruction. If it is monitored that the machine receives the specified external command, it is determined that the status of the machine has changed.
- the external command may be a throttle control signal.
- the local machine when the local machine adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device 132, the local machine sets the bus occupancy priority to the highest and notifies the second slave device 132. Device 132 adjusts the bus occupancy priority of this machine.
- the above-mentioned notification to the second slave device 132 to adjust its own bus occupation priority may be that the first slave device sends bus preemption information to the bus 110 so that the second slave device 132 receives Adjust the local bus occupation priority when seizing bus information.
- the first slave device and the second slave device 132 may carry a bus occupancy priority flag bit for identifying the bus occupancy priority of the first slave device and the second slave device 132 .
- the bus occupancy priority of the local device may also be higher than the bus occupancy priority of the second slave device 132.
- the local device is allowed to receive and send information on the bus 110, and the second slave device 132 cannot send information.
- the first slave device and the second slave device 132 may be throttle control devices of a marine multi-throttle control system.
- the host device 120 may be a communication adapter board of a marine multi-throttle control system.
- bus 110 may be an RS485 bus.
- This application also provides an electronic device.
- the electronic device is mounted on the bus as the first slave device.
- the bus is also mounted with a host device and other second slave devices that are the same as the first slave device.
- the bus occupancy priority is adjusted to be lower than the bus occupancy priority of the second slave device, so that the second slave device seizes the bus.
- the second slave device when monitoring whether the status of the second slave device changes, it may be determined whether the status of the second slave device changes based on whether the preemption bus information sent by the second slave device is received. If it is monitored that the first slave device receives the preemption bus information sent by the second slave device, it can be determined that the status of the second slave device has changed.
- the first slave device and the second slave device carry bus occupation priority flag bits.
- the electronic device is further configured to not allow the first slave device to send information during a period when the bus occupancy priority of the second slave device is higher than the bus occupancy priority of the first slave device, and the second slave device Devices are able to receive and send information on the bus.
- the external command is a throttle control signal.
- the first slave device and the second slave device are throttle control devices of a marine multi-throttle control system.
- the host device is a communication adapter board of a marine multi-throttle control system.
- the bus is an RS485 bus.
- This application also provides an electronic device.
- the electronic device is mounted on the bus as a first slave device, and a host device and other second slave devices that are the same as the first slave device are also mounted on the bus.
- the bus occupancy priority is adjusted to be lower than the bus occupancy priority of the second slave device, so that the second slave device seizes the bus.
- the electronic device can determine whether the status of the device changes based on whether the device receives a specified external instruction. If it is monitored that the machine receives the specified external command, it is determined that the status of the first slave device has changed.
- the external command may be a throttle control signal.
- the electronic device when the electronic device adjusts the bus occupancy priority of the local device to be higher than the bus occupancy priority of the second slave device, the electronic device may set the bus occupancy priority of the local device to the highest; And notify the second slave device to adjust its bus occupation priority.
- the electronic device is also configured to send bus preemption information to the bus, so that the second slave device adjusts its own bus occupation priority when receiving the bus preemption information.
- the electronic device when the electronic device monitors whether the status of the second slave device changes, it may determine whether the status of the second slave device changes based on whether it receives the preemption bus information sent by the second slave device. If the electronic device monitors that the first slave device receives the preemption bus information sent by the second slave device, it can determine that the status of the second slave device has changed.
- the first slave device and the second slave device may carry a bus occupancy priority flag bit, which is used to identify the bus occupancy priority of the first slave device and the second slave device.
- the electronic device after the electronic device adjusts the bus occupancy priority to be higher than the bus occupancy priority of the second slave device, it can also be used to adjust the bus occupancy priority of the electronic device to be higher than the bus occupancy priority of the second slave device.
- the local device is allowed to receive and send information on the bus, and the second slave device cannot send information.
- the electronic device may also adjust the bus occupancy priority of the second slave device to be higher than the first slave device.
- the local device is not allowed to send information, and the second slave device can receive and send information on the bus.
- the first slave device and the second slave device may be throttle control devices of a marine multi-throttle control system.
- the host device may be a communication adapter board of a marine multi-throttle control system.
- the bus may be an RS485 bus.
- the present application also provides a multi-slave device control system 100.
- the system 100 includes a host device 120 and at least two identical slave devices.
- the same slave device includes a first slave device 131 and The second slave device 132, the master device 120 and the slave device are mounted on the bus 110;
- the first slave device 131 is used to monitor whether the status of the local machine changes; and when the status of the local machine changes, adjust the bus occupancy priority of the local machine to be higher than the bus occupancy of the second slave device 132 Priority to seize bus 110;
- the second slave device 132 is used to adjust its bus occupancy priority to be lower than the bus occupancy priority of the first slave device 131 when the status of the first slave device 131 changes, so that the first slave device 132 Machine device 131 seizes bus 110;
- the host device 120 is used to control the designated device according to the control instructions of the first slave device 131 .
- the first slave device 131 when the first slave device 131 monitors whether the status of the first slave device 131 changes, it can determine whether the status of the first slave device 131 changes based on whether the first slave device 131 receives a specified external instruction. Variety. If it is monitored that the first slave device 131 receives a specified external instruction, it is determined that the state of the first slave device 131 has changed.
- the external command may be a throttle control signal.
- the first slave device 131 when the first slave device 131 adjusts its bus occupation priority to be higher than the bus occupation priority of the second slave device 132, the first slave device 131 may occupy the bus.
- the priority is set to the highest; and the second slave device 132 is notified to adjust the bus occupation priority of the local device.
- the above-mentioned notification to the second slave device 132 to adjust its own bus occupation priority may be that the first slave device 131 sends bus preemption information to the bus 110 so that the second slave device 132 receives Adjust the local bus occupation priority when it comes to seizing bus information.
- the first slave device 131 and the second slave device 132 may carry a bus occupancy priority flag bit for identifying the bus occupancy priority of the first slave device 131 and the second slave device 132 .
- the first slave device 131 when the first slave device 131 adjusts the bus occupancy priority of the local device to be higher than the bus occupancy priority of the second slave device 132, and the second slave device 132 adjusts the bus occupancy priority of the local device. After the priority is adjusted to be lower than the bus occupancy priority of the first slave device 131, the first slave device 131 may also have a bus occupancy priority higher than the bus occupancy priority of the second slave device 132. Slave device 131 is able to receive information and send information on bus 110, and second slave device 132 is not able to send information.
- the above-mentioned multi-slave device control system 100 may be a multi-throttle control system.
- the first slave device 131 and the second slave device 132 may be throttle control devices of a multi-throttle control system.
- the host device 120 may be a communication adapter board of a marine multi-throttle control system.
- bus 110 may be an RS485 bus.
- the above-mentioned multi-slave device control system 100 can be applied on ships.
- the above-mentioned embodiments of the present application are only examples and cannot limit the embodiments of the multi-slave device control system of the present application.
- the first slave device 131 and the second slave device 132 of the multi-slave device control system 100 of the present application are For the specific execution method of the host device 120, please refer to the bus preemption method described in Embodiment 2 of this application, which will not be described in detail here.
- the present application also provides a computer-readable storage medium.
- the computer-readable storage medium stores a number of computer instructions.
- the methods described in any one of the above-mentioned Embodiment 1 or Embodiment 2 are implemented. Steps of the method to seize the bus.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Bus Control (AREA)
Abstract
本申请提供一种抢占总线的方法、装置、电子设备、控制系统及存储介质,总线上搭载有主机设备和至少两个相同的从机设备,相同的从机设备包括第一从机设备和第二从机设备,方法包括:监听第一从机设备的状态是否发生变化;当第一从机设备的状态发生变化时,第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线。
Description
本申请涉及主从机通信领域,尤其涉及一种抢占总线的方法、装置、电子设备、控制系统及存储介质。
在主从机通信中,同一根总线上不能出现两个完全相同的从机设备,否则会出现两个从机设备之间争抢总线占用的情况。因此,当同一根总线上出现多个相同的从机设备时,需要选择决定当前占用总线的从机设备。对此,一种可行的方法是,可以通过手动调整各个从机设备的线序来决定当前占用总线的从机设备;或者是,可以通过手动切换开关的方式来选择决定当前占用总线的从机设备;此外,还可以通过一个手动控制模块来设置各个从机设备的总线占用优先级,再根据各个从机设备的总线占用优先级确定当前占用总线的从机设备。然而,上述方法都需要人工参与,自动化程度不高。因此,一旦选择由某一个从机设备进行控制后,若想要再利用其他的从机设备进行控制,则需要重新手动进行选择,为用户带来极大的不便。
发明内容
本申请提供一种抢占总线的方法、装置、电子设备、控制系统及存储介质。
依据本申请的第一方面,提供一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述方法包括:监听所述第一从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
依据本申请的第二方面,提供一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述方法包括:监听所述第二从机设备的状态是否发生变化;当所述第二从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第三方面,提供一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述方法包括:监听所述第一从机设备的状态及所述第二从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第四方面,提供一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述方法包括:监听所述第一从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;所述主机设备根据所述第一从机设备的控制指令控制指定设备。
依据本申请的第五方面,提供一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第一从机设备的状态是否发生变化;优先级调整模块,用于当所述第一从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
依据本申请的第五方面,提供一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第二从机设备的状态是否发生变化;优先级调整模块,用于当所述第二从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第六方面,提供一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第一从机设备的状态及所述第二从机设备的状态是否发生变化;优先级调整模块,用于:当所述第一从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第七方面,提供一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述装置包括:监听单元,用于监听所述第一从机设备的状态是否发生变化;优先级调整单元,用于当所述第一从机设备的状态发生变化时,调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;控制模块,用于控制所述主机设备根据所述第一从机设备的控制指令控制指定设备。
依据本申请的第八方面,提供一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;所述电子设备包括处理器、存储器、存储在所述存储器上可被所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现上述任一方面的实施例所述的抢占总线的方法。
依据本申请的第九方面,提供一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;所述电子设备用于:监听所述本机的状态是否发生变化;以及当本机的状态发生变化时,将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
依据本申请的第十方面,提供一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;所述电子设备用于:监听所述第二从机设备的状态是否发生变化;当所述第二从机设备的状态发生变化时,将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第十一方面,提供一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备。所述电子设备用于:监听本机的状态及所述第二从机设备的状态是否发生变化;当本机的状态发生变化时,将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,将总线占用优先级调整成低于所述第二 从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
依据本申请的第十二方面,提供一种多从机设备控制系统,所述多从机设备控制系统包括主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述主机设备和所述从机设备搭载在总线上;所述第一从机设备用于监听本机的状态是否发生变化;以及当本机的状态发生变化时,将本机的总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;所述第二从机设备用于在所述第一从机设备的状态发生变化时,将本机的总线占用优先级调整成低于所述第一从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;所述主机设备用于根据所述第一从机设备的控制指令控制指定设备。
依据本申请的第十三方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有若干计算机指令,所述计算机指令被执行时实现上述任一方面的实施例所述的抢占总线的方法。
由以上本申请实施例提供的技术方案可见,本申请可以通过识别出状态发生变化的从机设备,并自动地将该从机设备设置为总线占用优先级最高的从机设备,使该从机设备占用总线。因此,本申请不需要额外增加手动切换开关或手动控制模型,即可使得连接在同一总线上的多个相同从机设备中,状态正在发生变化的从机设备,即正在输出控制信号的从机设备抢占总线,即实现了自动地在多个相同从机设备中进行切换,使得输出控制信号地从机设备能够自动地获得控制权,提高了整个系统的自动化程度,为用户带来便利。
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一种抢占总线的方法的场景示意图;
图2a是本申请一种抢占总线的方法的第一种实施例的流程示意图;
图2b是本申请一种抢占总线的方法的第二种实施例的流程示意图;
图2c是本申请一种抢占总线的方法的第三种实施例的流程示意图;
图3是本申请另一种抢占总线的方法的流程示意图;
图4是本申请一种控制模块自动调整优先级的控制方法的流程示意图;
图5是本申请一种抢占总线的装置的结构示意图;
图6是本申请一种电子设备的结构示意图;
图7是本申请另一种电子设备的结构示意图;
图8是本申请一种多从机设备控制系统的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。另外,在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
在主从机通信,例如RS485通信中,由于连接在同一根总线上的各个从机设备是根据从机设备的类型进行区分的,因此,同一根总线上不能出现两个完全相同的从机设备,否则会出现两个从机设备之间争抢总线占用的情况。例如,在一个船舶控制系统中可以使用多个 控制设备来控制船舶的运行及方向,例如,可以将一个油门设备安装在控制室,而将另一个油门设备安装在甲板上,以使得船员可以在控制室和甲板两个位置控制船舶运行,而当多个控制设备通过例如RS485总线等主从机轮询式的通信总线进行通信时,若直接将这多个相同控制设备均接入同一根总线上,则当多个控制设备发出控制指令时,船舶的运行控制中心将无法判断根据哪个控制设备的控制指令进行操作。
针对以上情况,一种解决方案是手动调整各个从机设备的线序,从而选择当前接入总线的从机设备。例如,可以通过手动调整各个从机设备的线序来决定当前占用总线的从机设备;或者是,可以通过手动切换开关的方式来选择决定当前占用总线的从机设备;此外,还可以通过一个手动控制模块来设置各个从机设备的总线占用优先级,再根据各个从机设备的总线占用优先级确定当前占用总线的从机设备。
然而,无论上述的任意一种方案都存在自动化程度不高,需要人工参与其中的问题。因此,一旦选择由某一个从机设备进行控制后,若想要再利用其他的从机设备进行控制,则需要重新手动进行选择,为用户带来极大的不便。
对此,本申请提供一种抢占总线的方法、装置、电子设备、多从机设备控制系统及存储介质,用以解决上述问题。
下面结合附图,对本申请的一些实施方式进行详细说明。
结合图1至图3,本申请实施例提供一种抢占总线的方法。其中,实施例一和实施例二分别从从机设备的角度和整个主从机通信系统的角度来对本申请所述的抢占总线的方法进行阐述。
如图1所示,在本申请的主从机通信系统中,总线110上同时搭载有主机设备120、以及包括第一从机设备131和第二从机设备132在内的至少两个相同的从机设备。而且,在本申请中,第一从机设备131和第二从机设备132等从机设备是直接接入总线110上的,而第一从机设备131和第二从机设备132等从机设备可以通过本申请所述抢占总线的方法来决定接入总线110的从机设备,不需要添加例如开关或手动控制模块等硬件模块。
其中,第一从机设备131和第二从机设备132并不是指特定的从机设备,而可以是任意一个从机设备,且任意一个从机设备既可以是第一从机设备131也可以是第二从机设备132,当其中一个从机设备作为第一从机设备131时,其他的从机设备则可以作为第二从机设备132,本申请对此不做限制。例如,在一个主从机通信系统中,同时存在从机设备A1和从机设备A2,则将从机设备A1当作第一从机设备131时,可以将从机设备A2当作第二从机设备132;而将从机设备A2当作第一从机设备131时,则可以将从机设备A1当作第二从机设备132。
在一些实施例中,一个主从机通信系统中可以包括两个以上的相同的从机设备,则这些从机设备中的任意一个从机设备都可以作为第一从机设备131,而当该从机设备作为第一从机设备131后,主从机通信系统中除了该从机设备以外的其他所有的从机设备则都作为第二从机设备132,均执行本申请实施例所提供的方法与第二从机设备132对应的步骤。
实施例一
参见图2a-图2c,从第一从机设备的角度来看,所述抢占总线的方法可包括三种实施例。
其中,如图2a所示,在第一种实施例中,所述抢占总线的方法可以包括以下步骤:
S201a:监听第一从机设备的状态是否发生变化;
S202a:当第一从机设备的状态发生变化时,第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线。
其中,在步骤S201a中,第一从机设备会持续的监听第一从机设备,即本机的状态是否变化,并且在监听到第一从机设备的状态发生变化时,执行步骤S202a中与第一从机设备的状态发生变化对应的操作。
如图2b所示,在第二种实施例中,所述抢占总线的方法可以包括以下步骤:
S201b:监听第二从机设备的状态是否发生变化;
S202b:当第二从机设备的状态发生变化时,第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
其中,在步骤S201b中,第一从机设备会持续的监听第二从机设备,即除本机以外的其他从机设备的状态是否变化,并且在监听到第二从机设备的状态发生变化时,执行步骤S202b中与第二从机设备的状态发生变化对应的操作。
如图2c所示,在第三种实施例中,所述抢占总线的方法可以包括以下步骤:
S201:监听第一从机设备和第二从机设备的状态是否发生变化;
S202c1:当第一从机设备的状态发生变化时,第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线;
S202c2:当第二从机设备的状态发生变化时,第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
其中,在步骤S201c中,第一从机设备会持续的监听第一从机设备和第二从机设备,即所有的从机设备的状态是否变化,并且在监听到第一从机设备,即本机的状态发生变化时,执行步骤S202c1中与第一从机设备的状态发生变化对应的操作,而在监听到第二从机设备,即除本机以外的其他从机设备的状态发生变化时,则执行步骤S202c2中与第二从机设备的状态发生变化对应的操作。
值得注意的是,在一些实施例中,当第一从机设备在持续监听第一从机设备或第二从机设备的状态是否发生变化时,第二从机设备也会持续地监听第一从机设备或第二从机设备地状态是否发生变化,而且,以第二从机设备的角度出发,当其先监听到不同的从机设备(包括本机或与本机不同的从机设备)的状态发生变化时,其同样会执行与第一从机设备类似的操作。
在一些实施例中,从机设备的状态发生变化可以是从机设备在工作状态和休眠状态等状态之间的变化,例如启动从机设备即为从休眠状态转变为工作状态,而关闭从机设备则为从启动状态转变为工作状态。若以数值的形式来表示从机设备的状态,则可以用零来表示休眠状态,非零来表示工作状态,则上述从机设备的状态发生变化可以包括从零到非零的变化,以及从非零到零的变化。
在一些实施例中,从机设备的状态发生变化也可以是从机设备在多个工作状态之间的变化,例如从机设备从控制船舶向东行驶的状态转变为控制船舶向北行驶的状态,以及从机设备从控制船舶低速行驶的状态转变为控制船舶高速行驶的状态。若以数值的形式来表示从机设备的状态,则上述从机设备的状态发生变化可以包括从一个非零状态到另一个非零状态的变化,例如从一到二的变化。
在一些实施例中,从机设备的状态发生变化也可以是其他的状态变化情况,只要从机设备的状态变化的目的是为了控制对应的指定设备进行响应的变化,例如船员对船舶控制系统中的油门控制设备进行操作以控制船舶按指定的方向和速度行驶等,即可以认为是本申请上述方法中所述的从机设备的状态发生变化,本申请对此不做限制。
在一些实施例中,可以根据从机设备是否接收到指定的外部指令,来判断该从机设备的状态是否发生变化。例如,在步骤S201a或步骤S201c中,如果监听到第一从机设备接收到指定的外部指令,则确定第一从机设备的状态发生变化。同样地,如果监听到第二从机设备接收到指定的外部指令,则可以确定第二从机设备的状态发生变化。在一些实施例中,从机设备接收到的指定的外部指令可以是专用于指示该从机设备切换状态的外部指令,也可以是用于调整该从机设备的状态参数的外部指令,还可以是其他的外部指令,只要该外部指令可以在客观上导致该从机设备的状态发生变化即可, 本申请对外部指令的具体形式不做限制。例如,在使用多个控制设备来控制船舶的运行及方向的船舶控制系统中,上述指定的外部指令可以是油门控制信号,当从机设备,即油门控制设备接收到该油门控制信号时,可以根据该油门控制信号改变本机的状态,并控制船舶执行对应的操作。
在本申请中,总线占用优先级是用于指示从机设备抢占总线的优先级的一个参数,根据各个从机设备的总线占用优先级的高低,可以判定出具有最高优先级的从机设备,并由具有最高优先级的从机设备占用总线。
在一些实施例中,总线占用优先级可以是指定范围内的一个值,例如1-3中的一个整数,以区别总线占用优先级不同的各个从机设备。在一些实施例中,总线占用优先级也可以是两个指定值中的一个,例如0和1中的一个,以将各个从机设备区分为抢占总线的从机设备和不抢占总线的从机设备两个级别,例如总线占用优先级为1表示该从机设备可以抢占总线,而总线占用优先级为0则表示该从机设备不可以抢占总线。
在一些实施例中,第一从机设备和第二从机设备可以携带总线占用优先级标志位,用于指示该从机设备当前的总线占用优先级。在一些实施例中,第一从机设备和第二从机设备的总线占用优先级还可以以其他的方式进行表示,例如在主机设备和总线之间接入一个指定的设备用于集中地配置各个从机设备的总线占用优先级,而主机设备则可以根据该设备确定总线占用优先级最高的从机设备,本申请对此不做限制。
在步骤S202a或步骤S202c1中,当确定第一从机设备的状态发生变化后,可以使第一从机设备将总线占用优先级上调,使得其总线占用优先级高于第二从机设备的总线占用优先级,以使第一从机设备抢占总线。从第二从机设备角度看,当第二从机设备确定第一从机设备的状态发生变化时,第二从机设备则会将总线占用优先级下调,使得其总线占用优先级低于第一从机设备的总线优先级,以使得第一从机设备能够抢占总线。
而在步骤S202b或步骤S202c2中,当确定第二从机设备的状态发生变化后,则可以使第一从机设备将总线占用优先级下调,使得其总线占用优先级低于第二从机设备的总线占用优先级,以使第二从机设备能够抢占总线。从第二从机设备角度看,当第二从机设备确定其本机的状态发生变化时,第二从机设备则会将总线占用优先级上调,使得其总线占用优先级高于第一从机设备的总线优先级,以使得第二从机设备抢占总线。
因此,可以理解的是,在上述主从机通信系统中,任意一个从机设备的状态发生变化时,该从机设备会将其总线占用优先级上调,而其他从机设备则会将本机的总线占用优先级下调,最终使得该从机设备的总线占用优先级高于其他从机设备的总线占用优先级,即使得该从机设备可以抢占总线。
例如,在一个主从机通信系统中,包括从机设备A1和从机设备A2,当从机设备A1的状态发生变化时,从机设备A1将上调本机的总线占用优先级,例如将其总线占用优先级从0调整为1,而从机设备A2则将下调本机的总线占用优先级,例如将其总线占用优先级从1调整为0,使得从机设备A1的总线占用优先级高于从机设备A2的总线占用优先级,因此,从机设备A1可以抢占总线,主机设备将根据从机设备A1发出的指令进行对应的操作。需要说明的是,从机设备A1将总线优先级调整成高于从机设备A2的总线占用优先级除了包括将其总线占用优先级从0调整为1以外,还包括从机设备A1保持该总线占用优先级不变。具体的,若从机设备A1的状态发生变化,且此时从机设备A1的总线占用优先级已为1,也即此时从机设备A1的总线占用优先级已是最高优先级,则从机设备A1保持该总线占用优先级不变。
在一些实施例中,第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级时,可以将其总线占用优先级设置为最高,即最优先的级别,使得无论第二从机设备的总线占用优先级为多少,第一从机设备都能够抢占总线;而第一从机设备在将其总线占用 优先级设置为最高后,还可以通知第二从机设备调整本机的总线占用优先级,使得第二从机设备的总线占用优先级调整至最高以下,使得只有第一从机设备能够抢占总线。
同样地,在一些实施例中,第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级时,可以将其总线占用优先级设置为最低,使得无论第二从机设备的总线占用优先级为多少,第一从机设备都不会抢占总线,避免与第二从机设备发送冲突。
在一些实施例中,在通知第二从机设备调整本机的总线占用优先级时,可以是第一从机设备发送抢占总线信息到总线上,以使得第二从机设备接收到该抢占总线信息时调整本机的总线占用优先级。在本申请中,抢占总线信息可以是一种特殊的信息报文,其可以用于通知有从机设备抢占总线,或者指定抢占总线的从机设备。当第一从机设备将抢占总线信息发送到总线上后,同样连接在该总线上的第二从机设备则可以接收到该抢占总线信息。而当第二从机设备接收到抢占总线信息后,第二从机设备即能够了解到本机以外的其他从机设备,如第一从机设备正在抢占总线,则第二从机设备能够适时地下调本机地总线占用优先级,以使得第一从机设备的总线占用优先级能够高于第二从机设备的总线占用优先级,使得第一从机设备能够成功抢占总线。
当第二从机设备接收到第一从机设备发送的抢占总线信息时即可以确定第一从机设备的状态发生了变化,需要抢占总线,同样地,当第一从机设备在接收到第二从机设备发送的抢占总线信息时,则可以确定第二从机设备的状态发生了变化。因此,在一些实施例中,在步骤S201b或步骤S201c中,中,可以通过监听第一从机设备是否接收到第二从机设备所发送的抢占总线信息,来确定第二从机设备的状态是否发生变化。如果监听到了第一从机设备接收到第二从机设备发送的抢占总线信息,则可以确定第二从机设备的状态发生变化,从而使第一从机设备进入步骤S202b或步骤S202c2,即下调本机的总线占用优先级,以使得第二从机设备可以抢占总线。
需要说明的是,第一从机设备确定第二从机设备的状态发生变化时,将本机的总线占用优先级调整成低于第二从机设备的总线占用优先级包括:(1)若此时第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级,则第一从机设备调低本机的总线占用优先级,以使得本机的总线占用优先级低于第二从机设备的总线占用优先级;(2)若此时第一从机设备的总线占用优先级已经低于第二从机设备的总线占用优先级,则第一从机设备保持当前的总线占用优先级不变。
在一些实施例中,在步骤S202a或步骤S202c1中,当第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级之后,还可以在第一从机设备的总线占用有优先级高于第二从机设备的总线占用优先级期间,允许第一从机设备在总线上接收信息和发送信息,第二从机设备不能发送信息,以使得与总线连接的主机设备只会接收到第一从机设备发送的信息,并根据第一从机设备所发送的信息进行对应的操作,避免了主机设备由于多个从机设备发送的信息之间产生冲突,而无法判定根据哪个从机设备所发送的信息进行对应的操作,以致系统无法工作或出现故障等情况的发生。在一些实施例中,允许第一从机设备在总线上接收信息和发送信息,可以是第一从机设备在检测到本机的总线占用优先级为最高或高于其他的从机设备时,可以将信息发送到总线上;而第二从机设备不能发送信息,则可以是第二从机设备在检测到本机的总线占用优先级为最低或低于其他的从机设备时,无法将信息发送到总线上。
在一些实施例中,在步骤S202b或步骤S202c2中,当第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级之后,还可以在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许第一从机设备发送信息,第二从机设备能够在总线上接收信息和发送信息,从而使得与总线连接的主机设备只会接收到第二从机设备发送的信息,并根据第二从机设备所发送的信息进行对应的操作,避免了主机设备由于多个 从机设备发送的信息之间产生冲突,而无法判定根据哪个从机设备所发送的信息进行对应的操作,以致系统无法工作或出现故障等情况的发生。在一些实施例中,不允许第一从机设备发送信息,可以是第一从机设备在检测到本机的总线占用优先级为最低或低于其他的从机设备时,无法将信息发送到总线上;第二从机设备能够在总线上接收信息和发送信息,则可以是第二从机设备在检测到本机的总线占用优先级为最高或高于其他的从机设备时,可以将信息发送到总线上。
在一些实施例中,可以在一个船舶控制系统中使用多个控制设备来控制船舶的运行及方向时使用本申请所述抢占总线的方法,即上述主从机通信系统,可以是船用多油门控制系统。其中,在一些实施例中,上述从机设备,包括第一从机设备和第二从机设备,可以是船用多油门控制系统的中的油门控制设备。在一些实施例中,上述主机设备则可以是该船用多油门控制系统的通信转接板。在一些实施例中,船用多油门控制系统中的从机设备和主机设备也可以是其他的设备,本申请对此不做限制。
在一些实施例中,上述总线可以是RS485总线,连接在RS485总线上的各个设备以主从机轮询的方式进行通信。在其他的实施例中,上述总线也可以是使用其他通信标准的通信总线,例如CAN总线、RS422总线,只要其也是以主从机轮询的方式进行通信即可,本申请对此不做限制。
通过上述方法,在主从机通信系统中,任一从机设备的的状态发生变化时,该从机设备会上调本机的总线占用优先级,并发生抢占总线信息,其他的从机设备在接收到该抢占总线信息后,则下调本机的总线占用优先级,最终使得状态发生变化的从机设备的总线占用优先级将高于其他从机设备的总线占用优先级,使得状态发生变化的从机设备能够自动的抢占总线,保证了主机设备能够及时地根据发生状态变化的从机设备控制对应地指定设备,使得不管对任一从机设备进行操作,能够使得该操作结果得到执行。而且,本申请所述抢占总线的方法不需要额外增加手动切换的开关或手动控制模块等逻辑控制电路,也不需要手动调整各个从机设备的总线占用优先级,使得整个主从机通信系统具有较高的自动化程度。
本申请所述方法适用于主从机通信系统中的任意一个从机设备,各个从机设备只需要通过内置的程序执行上述方法的各个步骤,即可以实现对从机设备的总线占用优先级的自动调整。因此,只要将对应的程序内置在新的从机设备中,即可以使得新的从机设备加入现有的主从机通信系统后,仍然能够实现对各个从机设备的总线占用优先级的自动调整。因此,多个相同的从机设备可以在同一个总线上即插即用,为后期方便扩展从机设备的数量和实现无人控制的主从机通信系统提供了可能性。
实施例二
参见图3,从整个主从机通信系统的角度来看,所述抢占总线的方法可包括以下步骤:
S301:监听第一从机设备的状态是否发生变化;
S302:当第一从机设备的状态发生变化时,调整第一从机设备和第二从机设备的总线占用优先级,使第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级,以使第一从机设备抢占总线;
S303:主机设备根据第一从机设备的控制指令控制指定设备。
其中,第一从机设备可以是主从机通信系统中的任意一个从机设备,当主从机通信系统中的任意一个从机设备的状态发生了变化时,该从机设备即可作为第一从机设备,而除了该从机设备以外的其他从机设备则作为第二从机设备。
其中,在步骤S301中,主从机通信系统会持续的监听第一从机设备的状态是否发生变化,即持续的监听是否存在任一从机设备的状态发生变化,而当监听到任一从机设备的状态发生变化时,则将该从机设备作为第一从机设备,并进入步骤S302。
在一些实施例中,从机设备的状态发生变化可以是从机设备在工作状态和休眠状态等状 态之间的变化,例如启动从机设备即为从休眠状态转变为工作状态,而关闭从机设备则为从启动状态转变为工作状态。若以数值的形式来表示从机设备的状态,则可以用零来表示休眠状态,非零来表示工作状态,则上述从机设备的状态发生变化可以包括从零到非零的变化,以及从非零到零的变化。
在一些实施例中,从机设备的状态发生变化也可以是从机设备在多个工作状态之间的变化,例如从机设备从控制船舶向东行驶的状态转变为控制船舶向北行驶的状态,以及从机设备从控制船舶低速行驶的状态转变为控制船舶高速行驶的状态。若以数值的形式来表示从机设备的状态,则上述从机设备的状态发生变化可以包括从一个非零状态到另一个非零状态的变化,例如从一到二的变化。
在一些实施例中,从机设备的状态发生变化也可以是其他的状态变化情况,只要从机设备的状态变化的目的是为了控制对应的指定设备进行响应的变化,例如船员对船舶控制系统中的油门控制设备进行操作以控制船舶按指定的方向和速度行驶等,即可以认为是本申请上述方法中所述的从机设备的状态发生变化,本申请对此不做限制。
在一些实施例中,可以根据从机设备是否接收到指定的外部指令,来判断该从机设备的状态是否发生变化。例如,如果监听到第一从机设备接收到指定的外部指令,则确定第一从机设备的状态发生变化。在一些实施例中,从机设备接收到的指定的外部指令可以是专用于指示该从机设备切换状态的外部指令,也可以是用于调整该从机设备的状态参数的外部指令,还可以是其他的外部指令,只要该外部指令可以在客观上导致该从机设备的状态发生变化即可,本申请对外部指令的具体形式不做限制。例如,在使用多个控制设备来控制船舶的运行及方向的船舶控制系统中,上述指定的外部指令可以是油门控制信号,当从机设备,即油门控制设备接收到该油门控制信号时,可以根据该油门控制信号改变本机的状态,并控制船舶执行对应的操作。
在本申请中,总线占用优先级是用于指示从机设备抢占总线的优先级的一个参数,根据各个从机设备的总线占用优先级的高低,可以判定出具有最高优先级的从机设备,并由具有最高优先级的从机设备占用总线。
在一些实施例中,总线占用优先级可以是指定范围内的一个值,例如1-3中的一个整数,以区别总线占用优先级不同的各个从机设备。在一些实施例中,总线占用优先级也可以是两个指定值中的一个,例如0和1中的一个,以将各个从机设备区分为抢占总线的从机设备和不抢占总线的从机设备两个级别,例如总线占用优先级为1表示该从机设备可以抢占总线,而总线占用优先级为0则表示该从机设备不可以抢占总线。
在一些实施例中,第一从机设备和第二从机设备可以携带由总线占用优先级标志位,用于指示该从机设备当前的总线占用优先级。在一些实施例中,第一从机设备和第二从机设备的总线占用优先级还可以以其他的方式进行表示,例如在主机设备和总线之间接入一个指定的设备用于集中地配置各个从机设备的总线占用优先级,而主机设备则可以根据该设备确定总线占用优先级最高的从机设备,本申请对此不做限制。
在步骤S302中,当确定第一从机设备的状态发生变化后,可以使第一从机设备将总线占用优先级上调,而使第二从机设备将总线占用优先级下调,使得第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级,以使第一从机设备能够成功抢占总线。
在一些实施例中,第一从机设备将总线占用优先级上调,而第二从机设备将总线占用优先级下调,使得第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级时,可以将第一从机设备的总线占用优先级设置为最高,即最优先的级别,使得无论第二从机设备的总线占用优先级为多少,第一从机设备都能够抢占总线;而第一从机设备在将其总线占用优先级设置为最高后,还可以通知第二从机设备调整本机的总线占用优先级,使得第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级,使得只有第一从机设备能够抢 占总线。
在一些实施例中,在通知第二从机设备调整本机的总线占用优先级时,可以是第一从机设备发送抢占总线信息到总线上,以使得第二从机设备接收到该抢占总线信息时调整本机的总线占用优先级。在本申请中,抢占总线信息可以是一种特殊的信息报文,其可以用于通知有从机设备抢占总线,或者指定抢占总线的从机设备。当第一从机设备将抢占总线信息发送到总线上后,同样连接在该总线上的第二从机设备则可以接收到该抢占总线信息。而当第二从机设备接收到抢占总线信息后,第二从机设备即能够了解到本机以外的其他从机设备,如第一从机设备正在抢占总线,则第二从机设备能够适时地下调本机地总线占用优先级,以使得第一从机设备的总线占用优先级能够高于第二从机设备的总线占用优先级,使得第一从机设备能够成功抢占总线。
在一些实施例中,在步骤S302中,当第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级之后,还可以在第一从机设备的总线占用有优先级高于第二从机设备的总线占用优先级期间,允许第一从机设备在总线上接收信息和发送信息,第二从机设备不能发送信息,以使得与总线连接的主机设备只会接收到第一从机设备发送的信息,并根据第一从机设备所发送的信息进行对应的操作,避免了主机设备由于多个从机设备发送的信息之间产生冲突,而无法判定根据哪个从机设备所发送的信息进行对应的操作,以致系统无法工作或出现故障等情况的发生。在一些实施例中,允许第一从机设备在总线上接收信息和发送信息,可以是第一从机设备在检测到本机的总线占用优先级为最高或高于其他的从机设备时,可以将信息发送到总线上;而第二从机设备不能发送信息,则可以是第二从机设备在检测到本机的总线占用优先级为最低或低于其他的从机设备时,无法将信息发送到总线上。
在步骤S303中,当第一从机设备抢占总线后,主机设备则可以根据第一从机设备的控制指令控制指定设备,而且主机设备此时不会接收到第二从机设备的控制指令,避免出现多个从机设备的控制指令出现冲突的情况。
在一些实施例中,可以在一个船舶控制系统中使用多个控制设备来控制船舶的运行及方向时使用本申请所述抢占总线的方法,即上述主从机通信系统,可以是船用多油门控制系统。其中,在一些实施例中,上述从机设备,包括第一从机设备和第二从机设备,可以是船用多油门控制系统的中的油门控制设备。在一些实施例中,上述主机设备则可以是该船用多油门控制系统的通信转接板。在一些实施例中,船用多油门控制系统中的从机设备和主机设备也可以是其他的设备,本申请对此不做限制。
在一些实施例中,上述总线可以是RS485总线,连接在RS485总线上的各个设备以主从机轮询的方式进行通信。在其他的实施例中,上述总线也可以是使用其他通信标准的通信总线,例如CAN总线、RS422总线,只要其也是以主从机轮询的方式进行通信即可,本申请对此不做限制。
通过上述方法,在主从机通信系统中,当第一从机设备的的状态发生变化时,第一从机设备会上调本机的总线占用优先级,并发生抢占总线信息,第二从机设备在接收到该抢占总线信息后,则下调本机的总线占用优先级,最终使得第一从机设备的总线占用优先级将高于第二从机设备的总线占用优先级,使得第一从机设备能够自动的抢占总线,保证了主机设备能够及时地根据第一从机设备控制对应地指定设备,使得对第一从机设备进行的操作,能够及时得到执行。而且,本申请所述抢占总线的方法不需要额外增加手动切换的开关或手动控制模块等逻辑控制电路,也不需要手动调整各个从机设备的总线占用优先级,使得整个主从机通信系统具有较高的自动化程度。
接下来,本申请将通过上述抢占总线方法的一个具体的应用实施例对本申请所述方法进一步进行阐述。
实施例三
如图4所示,图4是本申请一种控制模块自动调整优先级的控制方法的流程示意图,所述控制方法包括以下步骤:
S401:系统上电;其中,该系统包括多个相同的接入在同一根RS485总线上的控制模块;
S402:在刚上电或正常运行中,等待控制模块状态切换逻辑触发;当任意控制模块受到外部的控制时,会触发对应的状态切换逻辑,以示该控制模块的状态发生了变换;
S403:判断是否有有控制模块指令从零到非零变换;若有则进入步骤S405,对该控制模块进行指定;若没有则进入步骤S404,判断另外一种情况是否发生。
S404:判断是否有控制模块指令从非零到零变化;若有则进入步骤S405,对该控制模块进行指定;若没有则返回步骤S402,继续等待控制模块状态切换逻辑触发;
S405:指定该控制模块(即指令从零到非零变换的控制模块或指令从非零到零变换的控制模块)为最高优先级控制模块,该控制模块在RS485总线上正常收发;当控制模块能够在RS485总线上正常收发时,该控制模块的控制指令能够得到执行;
S406:发送优先级抢占报文到RS485总线;其中,优先级抢占报文用于通知其他的控制模块降低优先级;
S407:其他控制模块只收不发;其中,其他控制模块是与上述设置为最高优先级控制模块平级的其他控制模块;当控制模块能够在RS485总线上只收不发时,该控制模块的控制指令将不会被执行;当完成对各个控制模块的优先级的设置后,将返回步骤S402,继续等待下一次控制模块状态切换逻辑触发,以重新调整各个控制模块的优先级。
在上述控制方法中,所有相同的控制模块都同时接入RS485总线,整个系统上电后将首个控制模块发生从零到非零或者非零到零变化的控制模块作为当前优先级最高设备输出控制信息,并发送抢占优先级信息到总线上,同时其它平级控制模块收到抢占信息后只接收总线信息不再发送任何信息到总线。
接着当低优先级设备发生从零到非零或者非零到零变化时开始自动提高自己的优先级到最高同时发送抢占优先级信息到总线上,总线上其他平级控制设备收到信息后降低自己的优先级并转变为只收不发的状态。
在一些实施例中,控制模块发生的变化也可以不限定于从零到非零或者非零到零的变化,也可以是其他的变化,只要发生了变化即可,本申请对此不做限制。
具体地,接下来以一个具体的例子说明上述过程。在上述控制方法中,控制模块可以为油门把手或者油门杆等,均具有零位、前进挡以及后退档等,其中,油门把手以旋转手柄的方式控制驱动运行,油门杆则以前后推动的方式控制驱动运行,油门把手以及油门杆设置在船舶的不同位置上,方便操作。油门把手和油门杆均连接在同一总线上,当操作人员转动油门把手时,从零位转动到非零的位置,会发送抢占优先级信息到总线上,此时油门把手的优先级最高,而油门杆的优先级变低,驱动根据油门把手的指令运行,当油门杆从零位推动到非零位置时,会发送抢占优先级信息到总线上,此时油门杆的优先级最高,油门把手的优先级降低,驱动根据油门杆的指令运行,当再次想通过油门把手进行控制时,先转动油门把手,从非零位回到零位,会发送抢占优先级信息到总线上,此时油门把手的优先级最高,而油门杆的优先级变低,驱动根据油门把手的指令运行。当再次想通过油门杆进行控制时,控制方法与上述相同,在此不再赘述。
上述例子仅为举例说明,并不限制于在油门把手或油门杆上,应当理解的是,适配该逻辑的设备模块上也可以使用上述控制方法。
通过上述控制方法,本申请可以通过一个循环就完成了从系统上电到正常运行过程中的控制模块优先级自动调整的工作,成功实现了RS485总线上多控制模块的并行处理逻辑。
而且,在上述控制方法中,所有的控制模块完全一致,而且优先级自动调整的控制逻辑可以内置于各个控制模块中,方便了后期设备的即插即用,同时也满足了控制模块的任意扩展不受相同的其他平级设备的影响。
实施例四
参见图5,本申请提供一种抢占总线的装置,总线上搭载有主机设备和至少两个相同的从机设备,相同的从机设备包括第一从机设备和第二从机设备。抢占总线的装置可包括以下模块:
监听模块501,用于监听第一从机设备的状态是否发生变化;
优先级调整模块502,用于当第一从机设备的状态发生变化时,控制第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线。
在一些实施例中,上述监听模块501可以根据第一从机设备是否接收到指定的外部指令,确定第一从机设备的状态是否发生变化。如果监听到第一从机设备接收到指定的外部指令,则确定第一从机设备的状态发生变化。
在一些实施例中,若上述第一从机设备和第二从机设备为船用多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,上述优先级调整模块502在第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级时,可以是,第一从机设备将总线占用优先级设置为最高,并通知第二从机设备调整本机的总线占用优先级。
在一些实施例中,上述优先级调整模块502还用于控制第一从机设备发送抢占总线信息到总线上,以使第二从机设备接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,第一从机设备和第二从机设备可以携带有总线占用优先级标志位,用于标识第一从机设备和第二从机设备的总线占用优先级。
在一些实施例中,上述优先级调整模块502在第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级之后,还可以用于在第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级期间,允许第一从机设备在总线上接收信息和发送信息,第二从机设备不能发送信息。
在一些实施例中,上述优先级调整模块502在第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级之后,还可以在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许第一从机设备发送信息,第二从机设备能够在总线上接收信息和发送信息。
在一些实施例中,第一从机设备和第二从机设备可以是船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线可以是RS485总线。
实施例五
本申请还提供一种抢占总线的装置。总线上搭载有主机设备和至少两个相同的从机设备,相同的从机设备包括第一从机设备和第二从机设备,装置应用于第一从机设备。抢占总线的装置包括:
监听模块,用于监听第二从机设备的状态是否发生变化;
优先级调整模块,用于当第二从机设备的状态发生变化时,控制第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
在一些实施例中,监听模块在监听第二从机设备的状态是否发生变化时,可以根据是否接收到第二从机设备发送的抢占总线信息确定第二从机设备的状态是否发生变化。如果监听到第一从机设备接收到第二从机设备发送的抢占总线信息,则可以确定第二从机设备的 状态发生变化。
在一些实施例中,第一从机设备和第二从机设备携带有总线占用优先级标志位。
在一些实施例中,优先级调整模块还用于在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许第一从机设备发送信息,第二从机设备能够在总线上接收信息和发送信息。
在一些实施例中,外部指令为油门控制信号。
在一些实施例中,第一从机设备和第二从机设备为船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备为船用多油门控制系统的通信转接板。
在一些实施例中,总线为RS485总线。
实施例六
本申请还提供一种抢占总线的装置。总线上搭载有主机设备和至少两个相同的从机设备,相同的从机设备包括第一从机设备和第二从机设备。该装置应用于第一从机设备。抢占总线的装置包括:
监听模块,用于监听第一从机设备的状态及第二从机设备的状态是否发生变化;
优先级调整模块,用于:当第一从机设备的状态发生变化时,控制第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线;当第二从机设备的状态发生变化时,控制第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
在一些实施例中,监听模块可以根据第一从机设备是否接收到指定的外部指令,确定第一从机设备的状态是否发生变化。如果监听到第一从机设备接收到指定的外部指令,则确定第一从机设备的状态发生变化。
在一些实施例中,若上述第一从机设备和第二从机设备为船用多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,优先级调整模块在第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级时,可以是,第一从机设备将总线占用优先级设置为最高;并通知第二从机设备调整本机的总线占用优先级。
在一些实施例中,上述优先级调整模块502还用于控制第一从机设备发送抢占总线信息到总线上,以使第二从机设备接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,监听模块在监听第二从机设备的状态是否发生变化时,可以根据是否接收到第二从机设备发送的抢占总线信息确定第二从机设备的状态是否发生变化。如果监听到第一从机设备接收到第二从机设备发送的抢占总线信息,则可以确定第二从机设备的状态发生变化。
在一些实施例中,第一从机设备和第二从机设备可以携带有总线占用优先级标志位,用于标识第一从机设备和第二从机设备的总线占用优先级。
在一些实施例中,上述优先级调整模块502在第一从机设备将总线占用优先级调整成高于第二从机设备的总线占用优先级之后,还可以用于在第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级期间,允许第一从机设备在总线上接收信息和发送信息,第二从机设备不能发送信息。
在一些实施例中,上述优先级调整模块502在第一从机设备将总线占用优先级调整成低于第二从机设备的总线占用优先级之后,还可以在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许第一从机设备发送信息,第二从机设备能够在总线上接收信息和发送信息。
在一些实施例中,第一从机设备和第二从机设备可以是船用多油门控制系统的油门 控制设备。
在一些实施例中,主机设备可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线可以是RS485总线。
实施例七
本申请还提供一种抢占总线的装置。总线上搭载有主机设备和至少两个相同的从机设备,相同的从机设备包括第一从机设备和第二从机设备。抢占总线的装置用于主机及至少两个从机设备组成的系统。抢占总线的装置包括:
监听模块,用于监听第一从机设备的状态是否发生变化;
优先级调整模块,用于当第一从机设备的状态发生变化时,调整第一从机设备和第二从机设备的总线占用优先级,使第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级,以使第一从机设备抢占总线;
控制模块,用于控制主机设备根据第一从机设备的控制指令控制指定设备。
在一些实施例中,优先级调整模块用于:将第一从机设备的总线占用优先级设置为最高;通知第二从机设备调整本机的总线占用优先级,使第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级。
在一些实施例中,优先级调整模块用于:控制第一从机设备发送抢占总线信息到总线上;控制第二从机设备接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,第一从机设备和第二从机设备携带有总线占用优先级标志位。
在一些实施例中,优先级调整模块用于:在第一从机设备的总线占用优先级高于第二从机设备的总线占用优先级期间,允许第一从机设备在总线上接收信息和发送信息,且不允许第二从机设备发送信息。
在一些实施例中,外部指令为油门控制信号。
在一些实施例中,第一从机设备和第二从机设备为船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备为船用多油门控制系统的通信转接板。
在一些实施例中,总线为RS485总线。
本申请实施例四至实施例七中的各个实施例仅为举例说明,并不能限制本申请的抢占总线装置实施例,本申请实施例四至实施例七所述的抢占总线装置的各个模块的具体执行方式可参考本申请实施例一或实施例二所述的抢占总线方法,本申请在此不再赘述。
实施例八
参见图6,本申请还提供一种电子设备140,该电子设备140可以作为第一从机设备挂载于总线110上,总线110上还挂载有主机设备120以及其他与第一从机设备相同的第二从机设备132;电子设备140包括处理器1401、存储器1402、存储在存储器1402上可被处理器1401执行的计算机程序1403,处理器1401执行计算机程序1403时可以实现实施例一及实施例二中任一实施例所述的抢占总线的方法。
在一些实施例中,若上述第一从机设备和第二从机设备132为船用多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,第一从机设备和第二从机设备132可以携带有总线占用优先级标志位,用于标识第一从机设备和第二从机设备132的总线占用优先级。
在一些实施例中,第一从机设备和第二从机设备132可以是船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备120可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线110可以是RS485总线。
本申请上述各个实施例仅为举例说明,并不能限制本申请的电子设备实施例,本申 请的电子设备140的处理器1401执行计算机程序1403时的具体执行方式可参考本申请实施例一或实施例二所述的抢占总线方法,本申请在此不再赘述。
实施例九
参见图7,本申请还提供一种电子设备140,该电子设备140可以作为第一从机设备挂载于总线110上,总线110上还挂载有主机设备120以及其他与第一从机设备相同的第二从机设备132;电子设备140可以用于:
监听本机的状态是否发生变化;
以及当本机的状态发生变化时,将总线占用优先级调整成高于第二从机设备132的总线占用优先级,以抢占总线110。
在一些实施例中,在监听本机的状态是否发生变化时,可以根据本机是否接收到指定的外部指令,确定第一从机设备的状态是否发生变化。如果监听到本机接收到指定的外部指令,则确定本机的状态发生变化。
在一些实施例中,若上述第一从机设备和第二从机设备132为船用多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,本机将总线占用优先级调整成高于第二从机设备132的总线占用优先级时,可以是,本机将总线占用优先级设置为最高,并通知第二从机设备132调整本机的总线占用优先级。
在一些实施例中,上述通知第二从机设备132调整本机的总线占用优先级,可以是,第一从机设备发送抢占总线信息到总线110上,以使第二从机设备132接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,第一从机设备和第二从机设备132可以携带有总线占用优先级标志位,用于标识第一从机设备和第二从机设备132的总线占用优先级。
在一些实施例中,在将总线占用优先级调整成高于第二从机设备132的总线占用优先级之后,还可以在本机的总线占用优先级高于第二从机设备132的总线占用优先级期间,允许本机在总线110上接收信息和发送信息,第二从机设备132不能发送信息。
在一些实施例中,第一从机设备和第二从机设备132可以是船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备120可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线110可以是RS485总线。
实施例十
本申请还提供一种电子设备。电子设备作为第一从机设备挂载于总线上。总线上还挂载有主机设备以及其他与第一从机设备相同的第二从机设备。电子设备用于:
监听第二从机设备的状态是否发生变化;
当第二从机设备的状态发生变化时,将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
在一些实施例中,在监听第二从机设备的状态是否发生变化时,可以根据是否接收到第二从机设备发送的抢占总线信息确定第二从机设备的状态是否发生变化。如果监听到第一从机设备接收到第二从机设备发送的抢占总线信息,则可以确定第二从机设备的状态发生变化。
在一些实施例中,第一从机设备和第二从机设备携带有总线占用优先级标志位。
在一些实施例中,电子设备还用于在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许第一从机设备发送信息,第二从机设备能够在总线上接收信息和发送信息。
在一些实施例中,外部指令为油门控制信号。
在一些实施例中,第一从机设备和第二从机设备为船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备为船用多油门控制系统的通信转接板。
在一些实施例中,总线为RS485总线。
实施例十一
本申请还提供一种电子设备。电子设备作为第一从机设备挂载于总线上,总线上还挂载有主机设备以及其他与第一从机设备相同的第二从机设备。电子设备用于:
监听本机的状态及第二从机设备的状态是否发生变化;
当本机的状态发生变化时,将总线占用优先级调整成高于第二从机设备的总线占用优先级,以抢占总线;
当第二从机设备的状态发生变化时,将总线占用优先级调整成低于第二从机设备的总线占用优先级,以使第二从机设备抢占总线。
在一些实施例中,电子设备可以根据本机是否接收到指定的外部指令,确定本机的状态是否发生变化。如果监听到本机接收到指定的外部指令,则确定第一从机设备的状态发生变化。
在一些实施例中,若本机和第二从机设备为船用多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,电子设备在将本机的总线占用优先级调整成高于第二从机设备的总线占用优先级时,可以是,电子设备将本机的总线占用优先级设置为最高;并通知第二从机设备调整本机的总线占用优先级。
在一些实施例中,电子设备还用于发送抢占总线信息到总线上,以使第二从机设备接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,电子设备在监听第二从机设备的状态是否发生变化时,可以根据是否接收到第二从机设备发送的抢占总线信息确定第二从机设备的状态是否发生变化。如果电子设备监听到第一从机设备接收到第二从机设备发送的抢占总线信息,则可以确定第二从机设备的状态发生变化。
在一些实施例中,第一从机设备和第二从机设备可以携带有总线占用优先级标志位,用于标识第一从机设备和第二从机设备的总线占用优先级。
在一些实施例中,电子设备在将总线占用优先级调整成高于第二从机设备的总线占用优先级之后,还可以用于在本机的总线占用优先级高于第二从机设备的总线占用优先级期间,允许本机在总线上接收信息和发送信息,第二从机设备不能发送信息。
在一些实施例中,电子设备在将总线占用优先级调整成低于第二从机设备的总线占用优先级之后,还可以在第二从机设备的总线占用优先级高于第一从机设备的总线占用优先级期间,不允许本机发送信息,第二从机设备能够在总线上接收信息和发送信息。
在一些实施例中,第一从机设备和第二从机设备可以是船用多油门控制系统的油门控制设备。
在一些实施例中,主机设备可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线可以是RS485总线。
本申请上述各个实施例仅为举例说明,并不能限制本申请的电子设备实施例,本申请的电子设备的具体作用可参考本申请实施例一或实施例二所述的抢占总线方法,本申请在此不再赘述。
实施例十二
本申请还提供一种多从机设备控制系统100,如图8所示,该系统100包括主机设备120和至少两个相同的从机设备,相同的从机设备包括第一从机设备131和第二从机设备 132,主机设备120和从机设备搭载在总线110上;
其中,第一从机设备131用于监听本机的状态是否发生变化;以及当本机的状态发生变化时,将本机的总线占用优先级调整成高于第二从机设备132的总线占用优先级,以抢占总线110;
第二从机设备132用于在第一从机设备131的状态发生变化时,将本机的总线占用优先级调整成低于第一从机设备131的总线占用优先级,以使第一从机设备131抢占总线110;
主机设备120用于根据第一从机设备131的控制指令控制指定设备。
在一些实施例中,第一从机设备131在监听本机的状态是否发生变化时,可以根据第一从机设备131是否接收到指定的外部指令,确定第一从机设备131的状态是否发生变化。如果监听到所述第一从机设备131接收到指定的外部指令,则确定所述第一从机设备131的状态发生变化。
在一些实施例中,若上述第一从机设备131和第二从机设备132为多油门控制系统的油门控制设备时,上述外部指令可以是油门控制信号。
在一些实施例中,第一从机设备131在将本机的总线占用优先级调整成高于第二从机设备132的总线占用优先级时,可以是,第一从机设备131将总线占用优先级设置为最高;并通知第二从机设备132调整本机的总线占用优先级。
在一些实施例中,上述通知第二从机设备132调整本机的总线占用优先级,可以是,第一从机设备131发送抢占总线信息到总线110上,以使第二从机设备132接收到抢占总线信息时调整本机的总线占用优先级。
在一些实施例中,第一从机设备131和第二从机设备132可以携带有总线占用优先级标志位,用于标识第一从机设备131和第二从机设备132的总线占用优先级。
在一些实施例中,在第一从机设备131将本机的总线占用优先级调整成高于第二从机设备132的总线占用优先级,以及第二从机设备132将本机的总线占用优先级调整成低于第一从机设备131的总线占用优先级之后,还可以在第一从机设备131的总线占用优先级高于第二从机设备132的总线占用优先级期间,第一从机设备131能够在总线110上接收信息和发送信息,且第二从机设备132不能够发送信息。
在一些实施例中,上述多从机设备控制系统100可以是多油门控制系统。
在一些实施例中,第一从机设备131和第二从机设备132可以是多油门控制系统的油门控制设备。
在一些实施例中,主机设备120可以是船用多油门控制系统的通信转接板。
在一些实施例中,总线110可以是RS485总线。
在一些实施例中,上述多从机设备控制系统100可以应用于船舶上。
本申请上述各个实施例仅为举例说明,并不能限制本申请的多从机设备控制系统实施例,本申请的多从机设备控制系统100的第一从机设备131、第二从机设备132和主机设备120的具体执行方式可参考本申请实施例二所述的抢占总线方法,本申请在此不再赘述。
实施例十三
本申请还提供一种计算机可读存储介质,该计算机可读存储介质上存储有若干计算机指令,该计算机指令被处理器执行时实现上述实施例一或实施例二中任一实施例所述的抢占总线的方法的步骤。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且 还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
虽然本说明书包含许多具体实施细节,但是这些不应被解释为限制任何发明的范围或所要求保护的范围,而是主要用于描述特定发明的具体实施例的特征。本说明书内在多个实施例中描述的某些特征也可以在单个实施例中被组合实施。另一方面,在单个实施例中描述的各种特征也可以在多个实施例中分开实施或以任何合适的子组合来实施。此外,虽然特征可以如上所述在某些组合中起作用并且甚至最初如此要求保护,但是来自所要求保护的组合中的一个或多个特征在一些情况下可以从该组合中去除,并且所要求保护的组合可以指向子组合或子组合的变型。
类似地,虽然在附图中以特定顺序描绘了操作,但是这不应被理解为要求这些操作以所示的特定顺序执行或顺次执行、或者要求所有例示的操作被执行,以实现期望的结果。在某些情况下,多任务和并行处理可能是有利的。此外,上述实施例中的各种系统模块和组件的分离不应被理解为在所有实施例中均需要这样的分离,并且应当理解,所描述的程序组件和系统通常可以一起集成在单个软件产品中,或者封装成多个软件产品。
以上对本申请实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。
Claims (38)
- 一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述方法包括:监听所述第一从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
- 一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述方法包括:监听所述第二从机设备的状态是否发生变化;当所述第二从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述方法包括:监听所述第一从机设备的状态及所述第二从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 根据权利要求1或3所述的方法,其特征在于,所述监听所述第一从机设备的状态是否发生变化,包括:如果监听到所述第一从机设备接收到指定的外部指令,则确定所述第一从机设备的状态发生变化。
- 根据权利要求4所述的方法,其特征在于,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,包括:所述第一从机设备将总线占用优先级设置为最高;通知所述第二从机设备调整本机的总线占用优先级。
- 根据权利要求5所述的方法,其特征在于,所述通知所述第二从机设备调整本机的总线占用优先级,包括:所述第一从机设备发送抢占总线信息到所述总线上,以使所述第二从机设备接收到所述抢占总线信息时调整本机的总线占用优先级。
- 根据权利要求2或3所述的方法,其特征在于,所述监听所述第二从机设备的状态是否发生变化,包括:如果监听到所述第一从机设备接收到所述第二从机设备发送的抢占总线信息,则确定所述第二从机设备的状态发生变化。
- 根据权利要求1至3任一项所述的方法,其特征在于,所述第一从机设备和所述第二从机设备携带有总线占用优先级标志位。
- 根据权利要求1或3所述的方法,其特征在于,所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级之后,所述方法还包括步骤:在所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级期间,允许所述第一从机设备在所述总线上接收信息和发送信息,所述第二从机设备不能发送信息。
- 根据权利要求2或3所述的方法,其特征在于,所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级之后,所述方法还包括步骤:在所述第二从机设备的总线占用优先级高于所述第一从机设备的总线占用优先级期间,不允许所述第一从机设备发送信息,所述第二从机设备能够在所述总线上接收信息和发送信息。
- 根据权利要求4所述的方法,其特征在于,所述外部指令为油门控制信号。
- 根据权利要求11所述的方法,其特征在于,所述第一从机设备和所述第二从机设备为船用多油门控制系统的油门控制设备。
- 根据权利要求12所述的方法,其特征在于,所述主机设备为所述船用多油门控制系统的通信转接板。
- 根据权利要求1至3任一项所述的方法,其特征在于,所述总线为RS485总线。
- 一种抢占总线的方法,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述方法包括:监听所述第一从机设备的状态是否发生变化;当所述第一从机设备的状态发生变化时,调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;所述主机设备根据所述第一从机设备的控制指令控制指定设备。
- 根据权利要求15所述的方法,其特征在于,所述监听所述第一从机设备的状态是否发生变化,包括:如果监听到所述第一从机设备接收到指定的外部指令,则确定所述第一从机设备的状态发生变化。
- 根据权利要求16所述的方法,其特征在于,所述调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级,包括:将所述第一从机设备的总线占用优先级设置为最高;通知所述第二从机设备调整本机的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级。
- 根据权利要求17所述的方法,其特征在于,通知所述第二从机设备调整本机的总线占用优先级,包括:使所述第一从机设备发送抢占总线信息到所述总线上;所述第二从机设备接收到所述抢占总线信息时调整本机的总线占用优先级。
- 根据权利要求15所述的方法,其特征在于,所述第一从机设备和所述第二从机设备携带有总线占用优先级标志位。
- 根据权利要求15所述的方法,其特征在于,调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级之后,所述方法还包括步骤:在所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级期间,允许所述第一从机设备在所述总线上接收信息和发送信息,且不允许所述第二从机设备发送信息。
- 根据权利要求16所述的方法,其特征在于,所述外部指令为油门控制信号。
- 根据权利要求21所述的方法,其特征在于,所述第一从机设备和所述第二 从机设备为船用多油门控制系统的油门控制设备。
- 根据权利要求22所述的方法,其特征在于,所述主机设备为所述船用多油门控制系统的通信转接板。
- 根据权利要求15所述的方法,其特征在于,所述总线为RS485总线。
- 一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第一从机设备的状态是否发生变化;优先级调整模块,用于当所述第一从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
- 一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第二从机设备的状态是否发生变化;优先级调整模块,用于当所述第二从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述装置应用于所述第一从机设备,所述装置包括:监听模块,用于监听所述第一从机设备的状态及所述第二从机设备的状态是否发生变化;优先级调整模块,用于:当所述第一从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,控制所述第一从机设备将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 一种抢占总线的装置,所述总线上搭载有主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,其特征在于,所述装置包括:监听模块,用于监听所述第一从机设备的状态是否发生变化;优先级调整模块,用于当所述第一从机设备的状态发生变化时,调整所述第一从机设备和所述第二从机设备的总线占用优先级,使所述第一从机设备的总线占用优先级高于所述第二从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;控制模块,用于控制所述主机设备根据所述第一从机设备的控制指令控制指定设备。
- 一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;其特征在于,所述电子设备包括处理器、存储器、存储在所述存储器上可被所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现权利要求1至24任一项所述的抢占总线的方法。
- 一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上 还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;其特征在于,所述电子设备用于:监听本机的状态是否发生变化;以及当本机的状态发生变化时,将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线。
- 一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;其特征在于,所述电子设备用于:监听所述第二从机设备的状态是否发生变化;当所述第二从机设备的状态发生变化时,将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 一种电子设备,所述电子设备作为第一从机设备挂载于总线上,所述总线上还挂载有主机设备以及其他与所述第一从机设备相同的第二从机设备;其特征在于,所述电子设备用于:监听本机的状态及所述第二从机设备的状态是否发生变化;当本机的状态发生变化时,将总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;当所述第二从机设备的状态发生变化时,将总线占用优先级调整成低于所述第二从机设备的总线占用优先级,以使所述第二从机设备抢占所述总线。
- 一种多从机设备控制系统,包括主机设备和至少两个相同的从机设备,所述相同的从机设备包括第一从机设备和第二从机设备,所述主机设备和所述从机设备搭载在总线上;其特征在于,所述第一从机设备用于监听本机的状态是否发生变化;以及当本机的状态发生变化时,将本机的总线占用优先级调整成高于所述第二从机设备的总线占用优先级,以抢占所述总线;所述第二从机设备用于在所述第一从机设备的状态发生变化时,将本机的总线占用优先级调整成低于所述第一从机设备的总线占用优先级,以使所述第一从机设备抢占所述总线;所述主机设备用于根据所述第一从机设备的控制指令控制指定设备。
- 根据权利要求33所述的系统,其特征在于,所述多从机设备控制系统为多油门控制系统。
- 根据权利要求34所述的系统,其特征在于,所述第一从机设备和第二从机设备为所述多油门控制系统的油门控制设备。
- 根据权利要求35所述的系统,其特征在于,所述主机设备为所述多油门控制系统的通信转接板。
- 根据权利要求34所述的系统,其特征在于,所述系统应用于船舶上。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有若干计算机指令,所述计算机指令被执行时实现权利要求1至24任一项所述的抢占总线的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202280001712.8A CN115191105B (zh) | 2022-06-07 | 2022-06-07 | 抢占总线的方法、装置、电子设备、控制系统及存储介质 |
PCT/CN2022/097432 WO2023236051A1 (zh) | 2022-06-07 | 2022-06-07 | 抢占总线的方法、装置、电子设备、控制系统及存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2022/097432 WO2023236051A1 (zh) | 2022-06-07 | 2022-06-07 | 抢占总线的方法、装置、电子设备、控制系统及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023236051A1 true WO2023236051A1 (zh) | 2023-12-14 |
Family
ID=83524705
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/097432 WO2023236051A1 (zh) | 2022-06-07 | 2022-06-07 | 抢占总线的方法、装置、电子设备、控制系统及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115191105B (zh) |
WO (1) | WO2023236051A1 (zh) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080052716A1 (en) * | 2006-08-22 | 2008-02-28 | Theurer Andrew Matthew | Method and apparatus to control priority preemption of tasks |
CN103106164A (zh) * | 2011-11-09 | 2013-05-15 | 深圳市德赛微电子技术有限公司 | 一种高效dma控制器 |
CN105610662A (zh) * | 2015-12-29 | 2016-05-25 | 北京理工大学 | 电动汽车的反馈式综合动态调度网络化控制装置 |
CN110764689A (zh) * | 2018-07-27 | 2020-02-07 | 虞加考 | 一种基于级联架构固态硬盘的实现方法 |
CN111682992A (zh) * | 2020-06-03 | 2020-09-18 | 西安奇维科技有限公司 | 一种动态优先级的串行总线设计方法 |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6088751A (en) * | 1998-02-12 | 2000-07-11 | Vlsi Technology, Inc. | Highly configurable bus priority arbitration system |
DE19827337A1 (de) * | 1998-06-19 | 1999-12-23 | Philips Patentverwaltung | Anordnung und Verfahren zum Übertragen von Adreß-, Befehls- und/oder Datentelegrammen |
US6516379B1 (en) * | 1999-11-08 | 2003-02-04 | International Business Machines Corporation | Method and apparatus for transaction pacing to reduce destructive interference between successive transactions in a distributed symmetric multiprocessor system |
JP2002007227A (ja) * | 2000-06-20 | 2002-01-11 | Nec Corp | ユニバーサルスロット装置、デバイス装置、スロット優先方法、およびデバイス優先方法 |
US7448036B2 (en) * | 2002-05-02 | 2008-11-04 | International Business Machines Corporation | System and method for thread scheduling with weak preemption policy |
JP2009251783A (ja) * | 2008-04-03 | 2009-10-29 | Koyo Electronics Ind Co Ltd | マルチcpuバス占有方式 |
US9798688B1 (en) * | 2013-03-15 | 2017-10-24 | Bitmicro Networks, Inc. | Bus arbitration with routing and failover mechanism |
CN106294236B (zh) * | 2016-08-25 | 2018-12-04 | 广东迪奥技术有限公司 | 一种基于rs485的通信方法、装置以及通信系统 |
CN106569897B (zh) * | 2016-11-07 | 2019-11-12 | 许继集团有限公司 | 基于协作式多任务调度机制的共享总线的轮询方法与装置 |
CN109992549A (zh) * | 2019-03-27 | 2019-07-09 | 上海冉能自动化科技有限公司 | 基于二总线的低功耗数据同步方法及系统 |
CN112231260B (zh) * | 2020-10-21 | 2022-08-02 | 中煤科工集团重庆研究院有限公司 | 一种基于动态优先级的抢占式多主rs485总线通讯方法 |
CN112689028B (zh) * | 2020-12-15 | 2023-03-24 | 上海宏力达信息技术股份有限公司 | 一种基于rs485实现自动分配地址的方法 |
CN113626365A (zh) * | 2021-07-23 | 2021-11-09 | 石家庄科林电气股份有限公司 | 一种基于spi总线的通信方法 |
-
2022
- 2022-06-07 WO PCT/CN2022/097432 patent/WO2023236051A1/zh unknown
- 2022-06-07 CN CN202280001712.8A patent/CN115191105B/zh active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080052716A1 (en) * | 2006-08-22 | 2008-02-28 | Theurer Andrew Matthew | Method and apparatus to control priority preemption of tasks |
CN103106164A (zh) * | 2011-11-09 | 2013-05-15 | 深圳市德赛微电子技术有限公司 | 一种高效dma控制器 |
CN105610662A (zh) * | 2015-12-29 | 2016-05-25 | 北京理工大学 | 电动汽车的反馈式综合动态调度网络化控制装置 |
CN110764689A (zh) * | 2018-07-27 | 2020-02-07 | 虞加考 | 一种基于级联架构固态硬盘的实现方法 |
CN111682992A (zh) * | 2020-06-03 | 2020-09-18 | 西安奇维科技有限公司 | 一种动态优先级的串行总线设计方法 |
Non-Patent Citations (1)
Title |
---|
XI YUAN, LIU ZHI-HUI, WU ZHI-GIANG, HAN WEN-XING: "Study and Simulation of a New Dynamic Priority Strategy of CAN", JOURNAL OF UNIVERSITY OF SOUHT CHINA(SCIENCE & TECHNOLOGY), vol. 29, no. 2, 1 June 2015 (2015-06-01), pages 97 - 102, XP093113669 * |
Also Published As
Publication number | Publication date |
---|---|
CN115191105A (zh) | 2022-10-14 |
CN115191105B (zh) | 2024-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9270482B2 (en) | Method for activating a network component of a vehicle network system | |
US6329794B1 (en) | Information processing device and method for controlling power consumption thereof | |
JP2006285758A (ja) | 制御装置の表示システム | |
US8964779B2 (en) | Device and method for electronic controlling | |
JP2011109433A (ja) | マイクロコンピュータ、ヒステリシスコンパレータ回路、及び電圧監視装置 | |
WO2023236051A1 (zh) | 抢占总线的方法、装置、电子设备、控制系统及存储介质 | |
US8166330B2 (en) | Controlling auxiliary power to logic devices | |
JP5451327B2 (ja) | 電源制御装置 | |
JP2010129042A (ja) | 電源切り換え制御回路、画像形成装置、電源切り換え制御方法、及びコンピュータプログラム | |
CN102769522A (zh) | 一种框式设备主备倒换方法及系统 | |
CN207790395U (zh) | 一种电动汽车电机的智能控制系统 | |
CN115085758A (zh) | 一种双收发器多模式rs-485通信主机及工作方法 | |
EP3176674A1 (en) | Method for power control of a control unit and control unit | |
CN110262215A (zh) | 一种基于非相似冗余技术的控制方法、装置及系统 | |
KR102523651B1 (ko) | 잠수함 축전지 관리 장치 및 그 방법 | |
JP2019114073A (ja) | プログラマブルコントローラ及び二重化システム | |
JP2014024178A (ja) | ロボット制御装置 | |
JP6642990B2 (ja) | 通信装置、制御方法、および、プログラム | |
CN103605481B (zh) | 磁盘控制方法、装置及设备 | |
JP3003396B2 (ja) | 計算機システム | |
US9684365B2 (en) | Responding device and responding method | |
JP7455239B2 (ja) | 数値制御システム、タスク割り当て変更装置及び数値制御方法 | |
CN218481826U (zh) | 一种三串口开关电路 | |
KR101353919B1 (ko) | 알에스485 통신용 호스트,슬래이브 자동 전환시스템 | |
US20050055107A1 (en) | Real-time control process for a controller of an industrial technical process, and a real-time operating process for a computing device |
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: 22945198 Country of ref document: EP Kind code of ref document: A1 |