Equipment control system and method
By introducing controlled devices and microcontrollers without an operating system into the equipment control system, and utilizing serial buses and GPIO interfaces, the problem of high cost of equipment control systems is solved, achieving efficient control of complex and simple devices and reducing system costs.
Patent Information
- Application Number
- CN202510756986.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-11-04
AI Technical Summary
In existing equipment control systems, the controlled equipment requires an operating system, which leads to high costs.
The system employs a method where a portion of the master control device and the controlled device lacks an operating system. It communicates with a microcontroller via a serial bus and utilizes the microcontroller's GPIO to connect to the power and reset interfaces of the controlled device, thereby enabling control of both complex and simple devices.
It reduces the cost of equipment control systems while achieving effective control of both complex and simple equipment, approaching the control effect of network-based methods.
Smart Images

Figure CN120892364A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of serial communication, in particular to a device control system and method. BACKGROUND
[0002] In the scenario of controlling controlled devices through a serial bus, the device control system requires all controlled devices to have an operating system, which results in high cost of the controlled devices and the whole device control system. SUMMARY
[0003] The present application provides a device control system and method to solve the technical problem of high cost of the device control system in the prior art.
[0004] The present application provides a device control system, comprising a master device, a serial bus, a first controlled device, a second controlled device and a plurality of microcontrollers.
[0005] The master device and the first controlled device both have an operating system, and the second controlled device has no operating system.
[0006] The master device accesses the serial bus.
[0007] Each of the first controlled devices and each of the second controlled devices accesses the serial bus through different microcontrollers, and the microcontrollers are connected to the first controlled devices through a serial communication protocol interface.
[0008] According to the device control system provided by the present application, the microcontrollers are also connected to the power supply interface and the restart interface of the first controlled devices through GPIO.
[0009] The device control system provided by the present application further comprises a third controlled device, which has no operating system and directly accesses the serial bus.
[0010] The present application also provides a device control method applied to any of the above microcontrollers, comprising:
[0011] Obtaining a communication protocol initiated by the serial bus, the communication protocol comprising a bus address and command content.
[0012] If the bus address is consistent with the stored configuration address, controlling the corresponding target device based on the command content, the target device being the first controlled device or the second controlled device.
[0013] According to the device control method provided by the present application, the communication protocol further comprises the length of the command content.
[0014] controlling a corresponding target device based on the command content, comprising:
[0015] obtaining a first position of a write pointer of a cache ring;
[0016] writing the command content from the first position and moving the write pointer to a second position according to a length of the command content;
[0017] obtaining a third position of a read pointer of the cache ring;
[0018] if the third position is between the first position and the second position, moving the read pointer to a fourth position, the fourth position being a next position of the second position;
[0019] reading data from the fourth position and moving the read pointer according to a length of the read data;
[0020] controlling the target device based on the read data.
[0021] According to the device control method provided by the application, the reading data from the fourth position comprises:
[0022] obtaining a length of readable data;
[0023] if the length of the readable data is greater than a fixed length, reading data with the fixed length from the fourth position as the read data;
[0024] if the length of the readable data is less than or equal to the fixed length, reading all the readable data from the fourth position as the read data.
[0025] The application further provides a device control method, comprising:
[0026] a master device receiving command content and sending the command content and a corresponding bus address to a serial communication bus;
[0027] the serial communication bus initiating a communication protocol comprising the command content and the bus address;
[0028] a microcontroller obtaining the communication protocol and, in the case that the bus address is consistent with a stored configuration address, controlling a corresponding target device based on the command content, the target device being a first controlled device or a second controlled device.
[0029] The application further provides a device control apparatus applied to any one of the above microcontrollers, comprising:
[0030] An acquisition module is configured to acquire a communication protocol initiated by the serial bus, the communication protocol comprising a bus address and a command content.
[0031] A control module is configured to control a corresponding target device based on the command content if the bus address is consistent with a stored configuration address, the target device being the first controlled device or the second controlled device.
[0032] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the device control method according to any one of the preceding embodiments when executing the program.
[0033] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the device control method according to any one of the preceding embodiments.
[0034] The application further provides a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the device control method according to any one of the preceding embodiments.
[0035] The device control system and method provided by the application can control the first controlled device and the second controlled device through the microcontroller connected to the serial bus, that is, the control of complex devices and simple devices is simultaneously realized through the serial bus, the effect of network control is approached, and all controlled devices in the system do not need to have an operating system, so that the system cost is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0037] Figure 1 is one of the structural schematic diagrams of the device control system provided by the application.
[0038] Figure 2 is another structural schematic diagram of the device control system provided by the application.
[0039] Figure 3 is a software function framework schematic diagram of the microcontroller provided by the application.
[0040] Figure 4 is one of the flow schematic diagrams of the device control method provided by the application.
[0041] Figure 5 is a schematic diagram of the principle of the cache ring provided by the present application.
[0042] Figure 6 is a flowchart of a second device control method provided by the present application.
[0043] Figure 7 is a structural schematic diagram of a device control apparatus provided by the present application.
[0044] Figure 8 is a structural schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0045] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0046] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitation, the element defined by the statement “comprising a” does not exclude the presence of another identical element in the process, method, article or device comprising the element. The terms “upper”, “lower” and the like indicate the orientation or positional relationship shown in the drawings, and are only used to facilitate the description of the present application and simplify the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise specified and limited, the terms “mounting”, “connecting”, “connecting” should be understood broadly, for example, it can be fixedly connected, or detachably connected, or integrally connected; it can be mechanically connected, or electrically connected; it can be directly connected, or indirectly connected through an intermediate medium, or the communication between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0047] The terms "first", "second", and the like in the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally a class and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" means at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in a "or" relationship.
[0048] The following will be described in conjunction with Figures 1-8 The device control system and method provided by the present disclosure are described.
[0049] As Figure 1 shown, the device control system provided by the present disclosure includes a master device, a serial bus, a first controlled device, a second controlled device, and a plurality of microcontrollers;
[0050] The master device and the first controlled device each have an operating system, and the second controlled device has no operating system.
[0051] The master device accesses the serial bus.
[0052] Each first controlled device and each second controlled device accesses the serial bus through a different microcontroller, and the microcontroller connects the first controlled device through a serial communication protocol interface.
[0053] It can be understood that, since the master device and the first controlled device each have an operating system, they can directly drive the corresponding protocol bottom layer and support complex interactive instruction modes, so the master device and the first controlled device are complex devices; and the second controlled device has no operating system and does not support complex interactive instruction modes, so the second controlled device is a simple device.
[0054] The master device can control the corresponding first controlled device or second controlled device through the bus address. The communication protocol used by the serial bus can be a common bidirectional protocol such as UART, I2C, SPI, etc. The microcontroller can connect the first controlled device through a serial communication protocol interface such as UART, I2C, or SPI. The microcontroller can also connect the second controlled device through a serial communication protocol interface (such as an I2C interface) or a PWM method.
[0055] Exemplarily, the master control device is an rk3568 chip, the communication protocol adopted by the serial bus is I2C, the microcontroller of the first controlled device is an STM32g0x chip, the microcontroller of the second controlled device is an STM32f0x chip, the first controlled device is an rk3588s chip adopting a Linux operating system, and the second controlled device is a fan; the STM32g0x chip is connected to a tty0 port of the rk3588s chip through a UART interface, and the STM32f0x chip is connected to the fan through a PWM mode, and the fan address is configured as 0x77.
[0056] It can be understood that the master control device of the application can control the first controlled device and the second controlled device through the microcontroller connected to the serial bus, that is, the control of the complex device and the simple device is simultaneously realized through the serial bus, the effect close to the network control is achieved, all the controlled devices in the system do not need to have an operating system, and the system cost is reduced.
[0057] In some embodiments, as shown in Figure 2 The microcontroller of the application can also connect the power interface and the restart interface of the first controlled device through the GPIO.
[0058] Exemplarily, the STM32g0x chip can be connected to the power interface and the restart interface of the rk3588s chip through different GPIOs, for example, 0x02 is taken as the common address of the bus; if the restart command is sent to the 0x02 address on the serial bus, all the STM32g0x chips will restart all the rk3588s chips through the GPIO at the same time.
[0059] In this way, the microcontroller can restart the first controlled device through the GPIO when the first controlled device fails.
[0060] In some embodiments, as shown in Figure 2 The device control system of the application can also include a third controlled device, the third controlled device has no operating system, and the third controlled device is directly connected to the serial bus.
[0061] Exemplarily, the third controlled device can be a power supply; if the communication protocol adopted by the serial bus is I2C, the power supply can be directly connected to the serial bus through PMBUS (Power Management Bus) based on I2C, and the master control device directly reads the voltage, current, temperature and other data or switching power supply of the power supply through PMBUS.
[0062] In this way, the third controlled device can be directly connected to the serial bus through the same bus as the communication protocol of the serial bus, the bus can be reused, and the system cost is further reduced.
[0063] As shown inFigure 3 As shown, the software function of the microcontroller in the application mainly includes four parts: initialization part, bus interrupt processing, device interrupt processing and Main main flow.
[0064] The initialization part is used to fix different bus addresses for each microcontroller on the same serial bus by hardware configuration or firmware configuration, so as to distinguish them.
[0065] The bus interrupt processing corresponds to the serial bus and runs in an interrupt mode, including protocol verification and setting task. The protocol verification part is used to verify whether the protocol initiated on the serial bus conforms to the setting. The setting task part is used to analyze the corresponding protocol and set the state bit and task content in the program. After the protocol verification part passes the verification, it enters the setting task part. The setting task part is processed according to the following logic: judging the specific command and the corresponding command parameter, setting the corresponding flag bit, and waiting for the Main main flow processing, the corresponding task including turning off / on the power supply of the controlled device, restarting the controlled device, sending the command to the controlled device, reading out the cache ring content and sending, etc.
[0066] The device interrupt processing corresponds to the controlled device and runs in an interrupt mode, including writing the cache ring, setting the task and reading out the data. The writing cache ring part is mainly used to cache the returned content of the controlled device interaction. The reading out data part is mainly used to actively read out the corresponding submission content of the controlled device. The setting task part is mainly used to set the corresponding reporting data flag and related return content when the controlled device actively reports.
[0067] The Main main flow includes two parts of cache ring reading and executing task. The Main main flow mainly adopts a loop processing mode to judge whether there is a corresponding task. If a task that needs to be processed is detected in the loop, such as sending the command to the master device, returning the data, turning off / on the power supply of the controlled device, restarting the controlled device, etc., the corresponding code is executed, such as setting the GPIO, sending the UART data, etc. If the task is to read out the cache ring, the length of the cache ring is judged. If the readable interval is greater than the set size, it is truncated and sent; if the readable interval is less than the set size, it is sent according to the actual length; if there is no cache data, 0 length is sent.
[0068] In addition, for the host device, if it is a command of directly turning off the power supply of the controlled device and reading the state of the controlled device, the command can be directly sent out. For a single controlled device that needs to be controlled by an interactive command, two threads can be started according to the address of the corresponding controlled device, and lock mutual exclusion is performed between the threads to ensure serial control of the bus. The read thread continuously sends out the read cache ring command, and if a result with a return length of 0 is received, it indicates that the cache ring has no data, and the read-out can be continued after a period of sleep. The command receiving thread accepts the user input, judges the command input, and then calls the command sending instruction to be sent to the controlled device by the microcontroller for execution.
[0069] Since only one serial bus is used, the application cannot handle concurrent and conflict scenarios, so the microcontroller only passively receives instructions and does not actively send data, avoiding conflicts. Only the host device needs to be serially processed to improve the overall utilization of the bus bandwidth, and no additional mechanism is needed to judge and handle bus conflicts.
[0070] As shown in Figure 4 The device control method applied to any one of the above microcontrollers provided by the application comprises steps S1-S2.
[0071] In step S1, a communication protocol initiated by a serial bus is obtained, and the communication protocol comprises a bus address and a command content.
[0072] Before step S1, the application can use a hardware configuration or a firmware configuration to fix different bus addresses for each microcontroller on the same serial bus.
[0073] The communication protocol initiated by the serial bus comprises a bus address, a start specific identifier, a length of a command content, a command content, and an end specific identifier. After the microcontroller obtains the communication protocol, the communication protocol can be verified by a bus interrupt, including: judging whether the bus address is consistent with the stored configuration address, if the addresses are inconsistent, it means that the command is sent to other microcontrollers, and the microcontroller does not need to process it; if the addresses are consistent, it means that the command is sent to the microcontroller, and then the start specific identifier is verified; if the start specific identifier is verified, the length of the command content is read, and the end specific identifier is read according to the length of the command content, and the end specific identifier is verified; if the end specific identifier is verified, the command content is read for processing.
[0074] The command content can be turning on or off the power supply, restarting the first controlled device, etc.
[0075] In step S2, if the bus address is consistent with the stored configuration address, the corresponding target device is controlled based on the command content, and the target device is the first controlled device or the second controlled device.
[0076] If the microcontroller corresponding to the bus address is the microcontroller corresponding to the first controlled device, then the first controlled device is controlled based on the command content; if the microcontroller corresponding to the bus address is the microcontroller corresponding to the second controlled device, then the second controlled device is controlled based on the command content.
[0077] In this way, the microcontroller can control the corresponding first or second controlled device based on the bus address, realizing the function of controlling complex and simple devices simultaneously through a serial bus.
[0078] In some implementations, step S2, controlling the corresponding target device based on the command content, may further include:
[0079] Get the first position of the write pointer of the cache ring;
[0080] Start writing the command content from the first position, and move the write pointer to the second position according to the length of the command content;
[0081] Get the third position of the read pointer of the cache ring;
[0082] If the third position is between the first and second positions, then move the read pointer to the fourth position, which is the next position after the second position;
[0083] Start reading data from the fourth position and move the read pointer according to the length of the read data;
[0084] Control the target device based on the read data.
[0085] The microcontroller of this invention can use a cache ring to cache data. The cache ring is formed by concatenating the beginning and end of a memory buffer. Data is written to the cache ring via a write pointer and read from the cache ring via a read pointer. Data can be continuously written to the cache ring; after data reaches the end of the high-order bits, it continues to be written from the beginning of the low-order bits. After data reaches the end of the high-order bits, it continues to be read from the beginning of the low-order bits and the data is merged and output.
[0086] like Figure 5 As shown, the second position is the first empty space in the cache ring after the write command content; the third position is located between the first and second positions, indicating that the data write has undergone a circular overwrite; moving the read pointer to the fourth position means moving the read pointer to the position after the write pointer; starting to read data from the fourth position means abandoning the reading of the content overwritten by the write. Reading data starting from the fourth position can mean reading all readable data or reading only part of the readable data.
[0087] In this way, the microcontroller can cache command content through a cache ring, allowing write overwriting to ensure proper data caching.
[0088] In consideration of the situation that if the length of the readable data is too long, reading out all the readable data from the fourth position at one time will cause the next command waiting to be read out to have too long waiting time.
[0089] In order to avoid the situation that the time for reading out the cache ring data at one time is too long, in some embodiments, reading out the data from the fourth position can further include:
[0090] acquiring the length of the readable data;
[0091] if the length of the readable data is greater than the fixed length, reading out the data with the fixed length as the read-out data from the fourth position;
[0092] if the length of the readable data is less than or equal to the fixed length, reading out all the readable data as the read-out data from the fourth position.
[0093] wherein the length of the readable data is greater than the fixed length, which means that the time for reading out all the readable data at one time will be longer, and the data with the fixed length is read out from the fourth position, which is equivalent to reading out the data with a shorter length at one time, so as to avoid the situation that the time for reading out the data at one time is too long. The length of the readable data is less than or equal to the fixed length, which means that reading out all the readable data at one time will not cause the situation that the time for reading out the data is too long, and all the readable data can be directly read out.
[0094] In this way, the situation that the time for reading out the data at one time is too long can be avoided by limiting the length of the data read out at one time.
[0095] Further, the interaction speed between the bus speed and the controlled device of the present application is close, in order to avoid data write-over, the present application can set the size of the cache ring to be slightly larger than the commonly used command content, so that the write-over will not occur when the part of the command is executed at one time. As for the content that is written over, the content that is written over can be obtained through other instructions or the same command is executed again to ensure the complete execution of the command.
[0096] As shown in Figure 6 The present application also provides a device control method, which includes:
[0097] Step S3, the master control device receives the command content, and sends the command content and the corresponding bus address to the serial communication bus;
[0098] Step S4, the serial communication bus initiates the communication protocol including the command content and the bus address;
[0099] Step S5, the microcontroller acquires the communication protocol, and in the case that the bus address is consistent with the stored configuration address, controls the corresponding target device based on the command content, the target device being the first controlled device or the second controlled device.
[0100] Figure 6 Equipment control methods and Figure 4 The principle of the equipment control method is the same, so it will not be repeated here.
[0101] like Figure 7 As shown, the device control apparatus provided by the present invention, applicable to any of the microcontrollers described above, includes:
[0102] The acquisition module is used to acquire the communication protocol initiated by the serial bus, which includes the bus address and command content.
[0103] The control module is used to control the corresponding target device based on the command content if the bus address matches the stored configuration address. The target device is either the first controlled device or the second controlled device.
[0104] It should be noted that the device control device provided by the present invention can execute the device control method of any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0105] In some implementations, the communication protocol may also include the length of the command content;
[0106] The control module can also be used for:
[0107] Get the first position of the write pointer of the cache ring;
[0108] Start writing the command content from the first position, and move the write pointer to the second position according to the length of the command content;
[0109] Get the third position of the read pointer of the cache ring;
[0110] If the third position is between the first and second positions, then move the read pointer to the fourth position, which is the next position after the second position;
[0111] Start reading data from the fourth position and move the read pointer according to the length of the read data;
[0112] Control the target device based on the read data.
[0113] In some implementations, the control module can also be used for:
[0114] Get the length of the readable data;
[0115] If the length of the readable data is greater than the fixed length, then data of the fixed length is read from the fourth position as the read data;
[0116] If the length of the readable data is less than or equal to the fixed length, then all readable data is read from the fourth position as the readout data.
[0117] Figure 8 is a structural schematic diagram of an electronic device provided by the present application, as shown in Figure 8 The electronic device can include a processor, a communications interface, a memory and a communications bus, wherein the processor, the communications interface and the memory complete mutual communication through the communications bus. The processor can invoke a logical instruction in the memory to execute a device control method.
[0118] In addition, the logical instruction in the memory described above can be realized in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0119] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, when the program instructions are executed by a computer, the computer can execute the device control method provided by the above-mentioned embodiments.
[0120] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the device control method provided by the above-mentioned embodiments.
[0121] The device embodiments described above are only schematic, wherein the units shown as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement it without creative labor.
[0122] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0123] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A device control system, characterized in that, It includes a master control device, a serial bus, a first controlled device, a second controlled device, and multiple microcontrollers; Both the main control device and the first controlled device have operating systems, while the second controlled device does not have an operating system. The main control device is connected to the serial bus; Each of the first controlled devices and each of the second controlled devices is connected to the serial bus through a different microcontroller, and the microcontroller is connected to the first controlled device through a serial communication protocol interface.
2. The equipment control system according to claim 1, characterized in that, The microcontroller is also connected to the power interface and reset interface of the first controlled device via GPIO.
3. The equipment control system according to claim 1, characterized in that, It also includes a third controlled device, which has no operating system and is directly connected to the serial bus.
4. A device control method, applied to the microcontroller according to any one of claims 1-3, characterized in that, include: Obtain the communication protocol initiated by the serial bus, the communication protocol including the bus address and command content; If the bus address matches the stored configuration address, the corresponding target device is controlled based on the command content, and the target device is either the first controlled device or the second controlled device.
5. The equipment control method according to claim 4, characterized in that, The communication protocol also includes the length of the command content; The control of the corresponding target device based on the command content includes: Get the first position of the write pointer of the cache ring; The command content is written starting from the first position, and the write pointer is moved to the second position according to the length of the command content; Obtain the third position of the read pointer of the cache ring; If the third position is located between the first position and the second position, then the read pointer is moved to the fourth position, which is the position after the second position; Data is read from the fourth position, and the read pointer is moved according to the length of the read data; The target device is controlled based on the readout data.
6. The equipment control method according to claim 5, characterized in that, The process of reading data starting from the fourth position includes: Get the length of the readable data; If the length of the readable data is greater than the fixed length, then data of the fixed length is read from the fourth position as the read data; If the length of the readable data is less than or equal to the fixed length, then all the readable data is read out starting from the fourth position as the read data.
7. A device control method, characterized in that, include: The master control device receives the command content and sends the command content and the corresponding bus address to the serial communication bus; The serial communication bus initiates a communication protocol that includes the command content and the bus address; The microcontroller acquires the communication protocol and, if the bus address matches the stored configuration address, controls the corresponding target device based on the command content. The target device is either a first controlled device or a second controlled device.
8. A device control apparatus, applied to the microcontroller according to any one of claims 1-3, characterized in that, include: The acquisition module is used to acquire the communication protocol initiated by the serial bus, the communication protocol including the bus address and command content; The control module is configured to control the corresponding target device based on the command content if the bus address matches the stored configuration address, wherein the target device is the first controlled device or the second controlled device.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the device control method as described in any one of claims 4 to 6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the device control method as described in any one of claims 4 to 6.
