Single-chip microcomputer load soft start method and system
Through the serial interface function in the microcontroller, pulse width modulation signals with different duty cycles are realized, which solves the problems of hardware module complexity and cost in the existing soft start methods, and realizes a simpler and more economical soft start method.
Patent Information
- Application Number
- CN202510057629.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-30
AI Technical Summary
The existing soft start method requires that the microcontroller must have corresponding hardware modules, resulting in high implementation complexity and high cost.
Through the serial interface function in the microcontroller, different pulse width modulation (PWM) duty cycles are realized, reducing hardware costs and simplifying soft start implementation. The specific method includes comparing the pre-stored frequency reference data and the pre-set frequency range comparison table when the power supply is detected to be powered on, selecting the pulse width modulation frequency range, calculating the baud rate, and sending the pre-stored send data through the serial interface to achieve the required PWM frequency and duty cycle.
It realizes soft start through the serial interface of the microcontroller, reduces hardware costs, simplifies the implementation process, and avoids the complexity of the hardware module.
Smart Images

Figure CN120065810A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of soft start, and in particular, to a method and system for soft starting a single-chip microcomputer load. Background Art
[0002] A microcontroller unit (MCU) is an integrated circuit chip integrating a central processing unit, memory, input / output interfaces, and function modules such as timers or counters. When the MCU controls a high-power load or there is a large capacitor on the pin control circuit, due to the power supply capacity problem, the starting current is very large instantaneously, and then the power supply voltage is pulled down, which may cause problems such as power supply voltage short-circuit protection or MCU reset, making the system unable to start normally. The traditional solution to such problems is to use soft start, that is, to control the corresponding drive pin of the MCU to generate PWM (Pulse Width Modulation), and the duty cycle of the PWM is slowly adjusted from 0% to 100% to let the large capacitor be slowly charged and reduce the instantaneous large current.
[0003] In the related art, it is required that the corresponding drive pin of the MCU can generate PWM. Different ways for the MCU to generate PWM may be a timer or a PWM module, or software-simulated IO flipping and timer implementation. These soft start methods require the MCU to have corresponding hardware modules, resulting in a high implementation complexity and cost. Summary of the Invention
[0004] The embodiments of the present application provide a method and system for soft starting a single-chip microcomputer load, which solve the problem that the existing soft start methods require the MCU to have corresponding hardware modules, resulting in a high implementation complexity and cost. It can realize different duty cycles through the serial interface function in the MCU, reduce the hardware cost, and make the soft start implementation simpler.
[0005] In a first aspect, the embodiments of the present application provide a method for soft starting a single-chip microcomputer load, including:
[0006] When it is detected that the power supply starts to supply power, perform comparison processing according to the pre-stored frequency reference data and the associated preset frequency range comparison table to obtain the selection range of the pulse width modulation frequency;
[0007] Based on the pulse width modulation frequency range, select the frequency of the pulse width modulation signal, and calculate the corresponding baud rate according to the frequency and a preset ratio;
[0008] Based on the baud rate, control the transmitting pin of the serial interface to send each different pre-stored transmission data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to different pre-stored transmission data. Among them, the pulse width modulation signal is sent to a load driver to implement the soft start of the load controlled by the single-chip microcomputer, and the load driver is connected to the transmitting pin of the serial interface and the load.
[0009] Optionally, the pre-stored frequency reference data includes load characteristics, control accuracy, and the baud rate range supported by the serial interface. The comparison process based on the pre-stored frequency reference data and the associated preset frequency range comparison table to obtain the pulse width modulation frequency selection range includes:
[0010] Respectively query the corresponding associated preset frequency range comparison tables according to the load characteristics, the control accuracy, and the baud rate range supported by the serial interface to obtain a first pulse width modulation frequency range, a second pulse width modulation frequency range, and a third pulse width modulation frequency range;
[0011] Based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, perform a comparison to obtain the pulse width modulation frequency selection range.
[0012] Optionally, the comparison based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range to obtain the pulse width modulation frequency selection range includes:
[0013] Determine the overlapping frequency range among the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, and determine the overlapping frequency range as the pulse width modulation frequency selection range.
[0014] Optionally, the selection of the frequency of the pulse width modulation signal based on the pulse width modulation frequency range includes:
[0015] Obtain the preset weight of the control accuracy in the pre-stored frequency reference data, determine the frequency selection position in the pulse width modulation frequency range according to the preset weight, and determine the value corresponding to the frequency selection position as the frequency of the pulse width modulation signal.
[0016] Optionally, the selection of the frequency of the pulse width modulation signal based on the pulse width modulation frequency range includes:
[0017] Randomly select any value in the pulse width modulation frequency range and determine it as the frequency of the pulse width modulation signal.
[0018] Optionally, each of the different pre-stored transmission data includes each hexadecimal number corresponding to each duty cycle number, and controlling the transmission pin of the serial interface to transmit each different pre-stored transmission data in a preset order based on the baud rate includes:
[0019] Controlling the transmission pin of the serial interface to transmit each of the hexadecimal numbers in ascending order based on the baud rate.
[0020] Optionally, after the soft start of the load is completed, it includes:
[0021] Restoring the communication logic between the serial interface and other devices to prevent the soft start of the load from monopolizing the serial interface.
[0022] In a second aspect, an embodiment of the present application further provides a single-chip microcomputer load soft start device, including:
[0023] A range determination module, configured to, when detecting that the power supply is turned on for power supply, perform comparison processing according to pre-stored frequency reference data and an associated preset frequency range comparison table to obtain a pulse width modulation frequency selection range;
[0024] A frequency determination module, configured to select the frequency of the pulse width modulation signal based on the pulse width modulation frequency range,
[0025] A baud rate determination module, configured to calculate a corresponding baud rate according to the frequency and a preset ratio;
[0026] A data transmission module, configured to control the transmission pin of the serial interface to transmit each different pre-stored transmission data in a preset order based on the baud rate, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and different duty cycles of the pulse width modulation signal corresponding to different pre-stored transmission data, wherein the pulse width modulation signal is sent to a load driver to implement the soft start of the load controlled by the single-chip microcomputer, and the load driver is connected to the transmission pin of the serial interface and the load.
[0027] In a third aspect, an embodiment of the present application further provides a single-chip microcomputer load soft start device, and the device includes:
[0028] One or more processors;
[0029] A storage device, configured to store one or more programs,
[0030] When the one or more programs are executed by the one or more processors, the one or more processors implement the single-chip microcomputer load soft start method described in the embodiments of the present application.
[0031] In a fourth aspect, an embodiment of the present application further provides a storage medium storing computer-executable instructions, and the computer-executable instructions are used to execute the single-chip microcomputer load soft start method described in the embodiments of the present application when executed by a computer processor.
[0032] In an embodiment of the present application, when it is detected that the power supply starts to supply power, a comparison process is performed according to pre-stored frequency reference data and an associated preset frequency range comparison table to obtain a pulse width modulation frequency selection range. Based on the pulse width modulation frequency range, the frequency of the pulse width modulation signal is selected. According to the frequency and a preset ratio, the corresponding baud rate is calculated. Based on the baud rate, the transmission pin of the serial interface is controlled to send each different pre-stored transmission data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and different duty cycles of the pulse width modulation signals corresponding to different pre-stored transmission data. Among them, the pulse width modulation signal is sent to the load driver to implement the soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the transmission pin of the serial interface and the load. This solution solves the problem that in the existing soft start method, it is required that the single-chip microcomputer must be equipped with corresponding hardware modules, resulting in a high complexity and cost of implementation. It can achieve different duty cycles through the serial interface function in the single-chip microcomputer, reduce the hardware cost, and make the soft start implementation simpler. Description of the Drawings
[0033] Figure 1 It is a flowchart of a single-chip microcomputer load soft start method provided by an embodiment of the present application;
[0034] Figure 2 It is a flowchart of another single-chip microcomputer load soft start method provided by an embodiment of the present application;
[0035] Figure 3 It is a flowchart of another single-chip microcomputer load soft start method provided by an embodiment of the present application;
[0036] Figure 4 It is a flowchart of another single-chip microcomputer load soft start method provided by an embodiment of the present application;
[0037] Figure 5 It is a schematic diagram of data transmission by a serial interface provided by an embodiment of the present application;
[0038] Figure 6 It is a block diagram of the module structure of a single-chip microcomputer load soft start device provided by an embodiment of the present application;
[0039] Figure 7 It is a schematic diagram of the structure of a single-chip microcomputer load soft start device provided by an embodiment of the present application. Detailed Embodiments
[0040] The following further elaborates on the embodiments of the present application in conjunction with the accompanying drawings and examples. It can be understood that the specific embodiments described herein are merely used to explain the embodiments of the present application, rather than limiting the embodiments of the present application. Additionally, it should be noted that for ease of description, only parts related to the embodiments of the present application are shown in the drawings, rather than all structures.
[0041] The terms "first", "second", etc. in the description and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein. Moreover, the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the description and claims indicates at least one of the connected objects, and the character "or" generally indicates an "or" relationship between the associated objects before and after.
[0042] A single-chip microcomputer load soft-start method provided by an embodiment of the present application can be applied to the start-up scenario of high-power loads. For example, when a compressor starts, it can be started by using the single-chip microcomputer load soft-start method provided by an embodiment of the present application.
[0043] Figure 1 is a flowchart of a single-chip microcomputer load soft-start method provided by an embodiment of the present application, as Figure 1 shown, and specifically includes:
[0044] Step S101: When it is detected that the power supply starts to supply power, perform a comparison process according to the pre-stored frequency reference data and the associated preset frequency range comparison table to obtain the pulse width modulation frequency selection range.
[0045] Among them, there is a power control logic inside the single-chip microcomputer, which is used to detect whether the power supply has started to supply power. When the power control logic detects that the power supply is turned on, the determination of the selection range of the pulse width modulation frequency can be performed. The pre-stored frequency reference data is used to represent the pre-stored reference data for determining the selection range of the pulse width modulation frequency. The preset frequency range comparison table can be a comparison table of the pre-stored frequency reference data and the frequency range of the pulse width modulation signal that is preset. Using the pre-stored frequency reference data and the associated preset frequency range comparison table, the selection range of the pulse width modulation can be determined. The selection range of the pulse width modulation frequency is used to represent the selection range of the frequency of the pulse width modulation signal. In one embodiment, the pre-stored frequency reference data is the load characteristic. A method for determining the selection range of the pulse width modulation frequency can be to query the preset comparison table of the load characteristic and different pulse width modulation frequency ranges according to the load characteristic to obtain the corresponding pulse width modulation frequency range, and determine the pulse width modulation frequency range as the selection range of the pulse width modulation frequency. Among them, the load characteristic can be the type of the load.
[0046] Optionally, the pre-stored frequency reference data includes the load characteristic, the control accuracy, and the baud rate range supported by the serial interface. A method for determining the selection range of the pulse width modulation frequency can be to query the corresponding associated preset frequency range comparison tables according to the load characteristic, the control accuracy, and the baud rate range supported by the serial interface to obtain the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, and compare them based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range to obtain the selection range of the pulse width modulation frequency. Determining the selection range of the pulse width modulation frequency through the load characteristic, the control accuracy, and the baud rate range supported by the serial interface can make the selection range of the pulse width modulation frequency more accurate.
[0047] Step S102: Select the frequency of the pulse width modulation signal based on the pulse width modulation frequency range, and calculate the corresponding baud rate according to the frequency and the preset ratio.
[0048] Among them, Pulse Width Modulation (PWM) signal is a technology that controls or simulates a signal by changing the pulse width. It consists of a series of periodic pulses, and each pulse is composed of a high level and a low level. The high level usually refers to a higher voltage state, representing logic "1", and the low level is a lower voltage state, representing logic "0". The frequency of the pulse width modulation signal refers to the number of times the signal changes from high level to low level and then back to high level within 1 second. Using the selected frequency of the pulse width modulation signal and a preset ratio, the corresponding baud rate can be calculated. The preset ratio can be a fixed ratio of the pre-set frequency of the pulse width modulation signal to the baud rate, or a fixed ratio of the pre-set baud rate to the frequency of the pulse width modulation signal. The baud rate represents the number of symbol characters transmitted per unit time and is a measure of the symbol transmission rate. In serial interface communication, the baud rate determines the number of binary digits transmitted per second. An exemplary example can be that the selected frequency of the pulse width modulation signal is 2000 Hz, and the fixed ratio of the pre-set baud rate to the frequency of the pulse width modulation signal is a. Then, calculate the product of 2000 Hz and the preset ratio a, which is the value of the baud rate corresponding to the pulse width modulation signal with a frequency of 2000 Hz.
[0049] In one embodiment, a method for selecting the frequency of a pulse width modulation signal can be to obtain the preset weight of the control accuracy in the pre-stored frequency reference data, determine the frequency selection position in the pulse width modulation frequency range according to the preset weight, and determine the value corresponding to the frequency selection position as the frequency of the pulse width modulation signal. By selecting the frequency of the pulse width modulation signal according to the importance of the control accuracy, the adaptability and accuracy of the frequency of the pulse width modulation signal can be improved. In another embodiment, a method for selecting the frequency of a pulse width modulation signal can be to randomly select any value in the pulse width modulation frequency range as the frequency of the pulse width modulation signal.
[0050] Step S103: Based on the baud rate, control the transmitting pin of the serial interface to send each different pre-stored transmission data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signal corresponding to the different pre-stored transmission data. Among them, the pulse width modulation signal is sent to the load driver to implement the soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the transmitting pin of the serial interface and the load.
[0051] Among them, the serial interface is an interface that uses serial communication. Data is transmitted sequentially bit by bit. The data sent by this serial interface is binary data. Whether it is ASCII code or hexadecimal data, it is ultimately sent in binary form at the underlying layer. The transmit pin of this serial interface (i.e., TXD) is the pin used to send data. The preset order can be the order preset for sending each different pre-stored transmit data. The pre-stored transmit data is used to represent the data sent by the transmit pin of the pre-stored serial interface. The duty cycle is used to represent the ratio of the high-level time to the entire cycle time in the pulse width modulation signal, usually expressed as a percentage. For example, if the cycle of a pulse width modulation signal is 10 milliseconds and the high-level time is 5 milliseconds, then the duty cycle is 50%. The load driver is an electronic device used to control and drive various loads. The pulse width modulation signal needs to control the load through a drive circuit. Therefore, this load driver is connected to the transmit pin of the serial interface and the load controlled by the single-chip microcomputer. The load driver controls the current of the load by receiving the pulse width modulation signal generated by the transmit pin of the serial interface to achieve soft start.
[0052] In one embodiment, each different pre-stored transmit data includes each hexadecimal number corresponding to each duty cycle number and is arranged from small to large. The preset order includes the positive order. A way for the serial interface to send data can be to control the transmit pin of the serial interface to send each hexadecimal number arranged from small to large in the positive order based on the determined baud rate. Optionally, each different pre-stored transmit data includes each hexadecimal number corresponding to each duty cycle number. A way for the serial interface to send data can be to control the transmit pin of the serial interface to send each hexadecimal number in the order from small to large. By using the determined baud rate to make the serial interface send each hexadecimal number corresponding to each duty cycle number, the relevant PWM frequency and different duty cycles can be achieved, and the duty cycle can be slowly adjusted from 0% to 100%, reducing the instantaneous large current.
[0053] In one embodiment, after the soft start of the load is completed, the communication logic between the serial interface and other devices is restored to avoid the soft start of the load monopolizing the serial interface.
[0054] As can be seen from the above, when it is detected that the power supply is turned on and supplying power, the pulse width modulation frequency selection range is obtained through comparison processing based on the pre-stored frequency reference data and the associated preset frequency range comparison table. The frequency of the pulse width modulation signal is selected based on the pulse width modulation frequency range, and the corresponding baud rate is calculated according to the frequency and the preset ratio. Based on the baud rate, the transmission pin of the serial interface is controlled to send each different pre-stored transmission data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to different pre-stored transmission data. Among them, the pulse width modulation signal is sent to the load driver to implement the soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the transmission pin of the serial interface and the load. This solution solves the problem in the existing soft start method that the single-chip microcomputer must be equipped with corresponding hardware modules, resulting in high implementation complexity and cost. It can implement different duty cycles through the serial interface function in the single-chip microcomputer, reducing the hardware cost and making the soft start implementation simpler.
[0055] Figure 2 FIG. is a flowchart of another single-chip microcomputer load soft start method provided by an embodiment of the present application, which gives an optional specific method for determining the pulse width modulation frequency selection range, as Figure 2 shown, specifically including:
[0056] Step S201, when it is detected that the power supply is turned on and supplying power, respectively query the corresponding associated preset frequency range comparison table according to the load characteristics, the control accuracy, and the baud rate range supported by the serial interface to obtain the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range.
[0057] Among them, the pre-stored frequency reference data includes load characteristics, control accuracy, and the baud rate range supported by the serial interface. The load characteristics can be the type of the load, such as load types like motors, LED lights, capacitors, etc. The control accuracy refers to the control degree of the pulse width modulation signal on the average value of the output voltage or current of the load. The higher the pulse width modulation frequency, the higher the corresponding control accuracy. The baud rate range supported by the serial interface is used to characterize the range of the baud rate supported by the serial interface. The first pulse width modulation frequency range can be the pulse width modulation frequency range corresponding to the load characteristics. The second pulse width modulation frequency range can be the pulse width modulation frequency range corresponding to the control accuracy. The third pulse width modulation frequency range can be the pulse width modulation frequency range corresponding to the baud rate range supported by the serial interface. An exemplary example can be that the load characteristic in the pre-stored frequency reference data is a motor, the control accuracy is the second control level, and the baud rate range supported by the serial interface is from 500 bps to 9600 bps. A preset frequency range comparison table associated with one load characteristic is as shown in the following table:
[0058] Load characteristic First pulse width modulation frequency range Motor [6 kHz, 16 kHz] LED lamp [200 Hz, 25 kHz] Display [3125 Hz, 25 kHz]
[0059] The above comparison table describes the correspondence between different load characteristics and different first pulse width modulation frequency ranges, and the specific description is as follows: when the load characteristic is a motor, the first pulse width modulation frequency range is [6 kHz, 16 kHz]; when the load characteristic is an LED lamp, the first pulse width modulation frequency range is [200 Hz, 25 kHz]; when the load characteristic is a display, the first pulse width modulation frequency range is [3125 Hz, 25 kHz].
[0060] If the load characteristic in the pre-stored frequency reference data is a motor, then query the above comparison table to obtain the corresponding first pulse width modulation frequency range of [6 kHz, 16 kHz]. Determine the second pulse width modulation frequency range corresponding to this control accuracy as [6 kHz, 12 kHz] in the same way, and the third pulse width modulation frequency range corresponding to the baud rate range supported by this serial interface is [500 Hz, 10 kHz].
[0061] Step S202: Compare based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range to obtain a pulse width modulation frequency selection range.
[0062] Among them, optionally, a method for determining a pulse width modulation frequency selection range may be to determine the overlapping frequency range among the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, and determine the overlapping frequency range as the pulse width modulation frequency selection range. An exemplary example may be to determine that the first pulse width modulation frequency range is [6 kHz, 16 kHz], the second pulse width modulation frequency range is [6 kHz, 12 kHz], and the third pulse width modulation frequency range is [500 Hz, 10 kHz]. The overlapping frequency range of the three pulse width modulation frequency ranges is [6 kHz, 10 kHz], then [6 kHz, 10 kHz] is determined as the pulse width modulation frequency selection range. In another embodiment, randomly select one from the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range and determine it as the pulse width modulation frequency selection range.
[0063] Step S203: Select the frequency of the pulse width modulation signal based on the pulse width modulation frequency range, and calculate the corresponding baud rate according to the frequency and a preset ratio.
[0064] Step S204: Based on the baud rate, control the transmission pin of the serial interface to send each different pre-stored transmission data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to the different pre-stored transmission data. The pulse width modulation signal is sent to a load driver to implement soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the transmission pin of the serial interface and the load.
[0065] As can be seen from the above, according to the load characteristics, control accuracy, and the baud rate range supported by the serial interface, query the corresponding associated preset frequency range look-up table to obtain the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range. Compare based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range to obtain the pulse width modulation frequency selection range. This solution determines the pulse width modulation frequency selection range through the load characteristics, control accuracy, and the baud rate range supported by the serial interface, which can make the pulse width modulation frequency selection range more accurate.
[0066] Figure 3 It is a flowchart of another single-chip microcomputer load soft start method provided by an embodiment of the present application, which gives an optional specific method for selecting the frequency of the pulse width modulation signal, as Figure 3 shown, specifically including:
[0067] Step S301: When it is detected that the power supply starts to supply power, perform a comparison process according to the pre-stored frequency reference data and the associated preset frequency range look-up table to obtain the pulse width modulation frequency selection range.
[0068] Step S302: Obtain the preset weight of the control accuracy in the pre-stored frequency reference data, determine the frequency selection position in the pulse width modulation frequency range according to the preset weight, determine the value corresponding to the frequency selection position as the frequency of the pulse width modulation signal, and calculate the corresponding baud rate according to the frequency and the preset ratio.
[0069] Among them, the preset weight can be the importance degree of controlling precision. Using this preset weight, the frequency selection position in the pulse width modulation frequency range can be determined. The frequency selection position is used to represent the specific position of selecting the frequency of the pulse width modulation signal in the pulse width modulation frequency range. For example, when the preset weight is 0.8, the corresponding frequency selection position is the 80% position point in the pulse width modulation frequency range. Using this frequency selection position, the frequency of the pulse width modulation signal can be determined. An exemplary example is that the pulse width modulation frequency range is [6 kHz, 10 kHz], and the preset weight of the control precision in the pre-stored frequency reference data is 0.75. Then the frequency selection position is the 75% position point in [6 kHz, 10 kHz], and the value corresponding to this position point is 9 kHz. Then 9 kHz is determined as the frequency of the pulse width modulation signal.
[0070] Step S303: Based on the baud rate, control the sending pin of the serial interface to send each different pre-stored sending data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to the different pre-stored sending data. Among them, the pulse width modulation signal is sent to the load driver to implement the soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the sending pin of the serial interface and the load.
[0071] As can be seen from the above, obtain the preset weight of the control precision in the pre-stored frequency reference data, determine the frequency selection position in the pulse width modulation frequency range according to the preset weight, and determine the value corresponding to the frequency selection position as the frequency of the pulse width modulation signal. This solution selects the frequency of the pulse width modulation signal according to the importance degree of the control precision, which can improve the adaptability and accuracy of the frequency of the pulse width modulation signal.
[0072] Figure 4 This is a flowchart of another method for soft starting a single-chip microcomputer load provided by an embodiment of the present application, which gives a specific method for sending data by an optional serial interface. As Figure 4 shown, it specifically includes:
[0073] Step S401: When it is detected that the power supply starts to supply power, perform a comparison process according to the pre-stored frequency reference data and the associated preset frequency range comparison table to obtain the pulse width modulation frequency selection range.
[0074] Step S402: Based on the pulse width modulation frequency range, select the frequency of the pulse width modulation signal, and calculate the corresponding baud rate according to the frequency and the preset ratio.
[0075] Step S403: Based on the baud rate, control the transmitting pin of the serial interface to transmit each of the hexadecimal numbers in ascending order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to different pre-stored transmitted data. The pulse width modulation signal is sent to a load driver to implement the soft start of the load controlled by the single-chip microcomputer. The load driver is connected to the transmitting pin of the serial interface and the load.
[0076] Among them, each different pre-stored transmitted data includes each hexadecimal number corresponding to each duty cycle digit. The duty cycle digit can be the decimal digit corresponding to the duty cycle. Exemplarily, in an 8-bit pulse width modulation system, the range of the duty cycle digit is 0 - 255. The hexadecimal number 0x55 is converted to decimal as 85, which is in the middle position in 0 - 255, so the corresponding duty cycle is 50%. An exemplary example can be that it is calculated that the output baud rate of the serial interface is 10M, and currently it is an 8-bit pulse width modulation system, that is, the range of the duty cycle digit is 0 - 255. Then control the serial interface to sequentially send the hexadecimal numbers corresponding to 0 - 255 at a baud rate of 10M. Each hexadecimal number is finally output in binary form, realizing the adjustment of the duty cycle from 0% to 100%. As Figure 5 shown, Figure 5 is a schematic diagram of a serial interface transmitting data provided by an embodiment of the present application. 01 represents time, 02 represents the transmitted data, and 03 represents the generated pulse width modulation waveform. Figure 5 The serial interface in it is transmitting the hexadecimal number 0x55 at a baud rate of 10M.
[0077] As can be seen from the above, based on the determined baud rate, control the transmitting pin of the serial interface to transmit each hexadecimal number in ascending order. This solution enables the serial interface to transmit each hexadecimal number corresponding to each duty cycle digit through the determined baud rate, can implement the relevant PWM frequency and different duty cycles, and enables the duty cycle to be slowly adjusted from 0% to 100%, reducing the instantaneous large current.
[0078] Figure 6 is a module structure block diagram of a single-chip microcomputer load soft start device provided by an embodiment of the present application. This system is used to execute a single-chip microcomputer load soft start method provided by the above embodiment, and has the corresponding functional modules and beneficial effects for executing the method. As Figure 6 shown, this system specifically includes:
[0079] Range determination module 101, configured to, when detecting that the power supply starts to supply power, perform comparison processing according to the pre-stored frequency reference data and the associated preset frequency range comparison table to obtain the pulse width modulation frequency selection range;
[0080] A frequency determination module 102 is configured to select the frequency of a pulse width modulation signal based on the pulse width modulation frequency range.
[0081] A baud rate determination module 103 is configured to calculate a corresponding baud rate according to the frequency and a preset ratio.
[0082] A data sending module 104 is configured to control a sending pin of the serial interface to send each different pre-stored sending data in a preset order based on the baud rate, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and different duty cycles of the pulse width modulation signals corresponding to different pre-stored sending data. Wherein, the pulse width modulation signal is sent to a load driver to implement soft start of a load controlled by the single-chip microcomputer, and the load driver is connected to the sending pin of the serial interface and the load.
[0083] As can be seen from the above solution, when it is detected that the power supply starts to supply power, a comparison process is performed according to pre-stored frequency reference data and an associated preset frequency range comparison table to obtain a pulse width modulation frequency selection range. The frequency of the pulse width modulation signal is selected based on the pulse width modulation frequency range, a corresponding baud rate is calculated according to the frequency and a preset ratio, and a sending pin of the serial interface is controlled based on the baud rate to send each different pre-stored sending data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and different duty cycles of the pulse width modulation signals corresponding to different pre-stored sending data. Wherein, the pulse width modulation signal is sent to a load driver to implement soft start of a load controlled by the single-chip microcomputer, and the load driver is connected to the sending pin of the serial interface and the load. This solution solves the problem that in the existing soft start method, it is required that the single-chip microcomputer must be equipped with corresponding hardware modules, resulting in high complexity and cost in implementation. It can implement different duty cycles through the serial interface function in the single-chip microcomputer, reduce the hardware cost, and make the soft start implementation simpler.
[0084] In a possible embodiment, the range determination module 101 is specifically configured to:
[0085] Respectively query the corresponding associated preset frequency range comparison tables according to the load characteristics, the control accuracy, and the baud rate range supported by the serial interface to obtain a first pulse width modulation frequency range, a second pulse width modulation frequency range, and a third pulse width modulation frequency range.
[0086] Based on the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, a comparison is performed to obtain a pulse width modulation frequency selection range.
[0087] In a possible embodiment, the range determination module 101 is further configured to:
[0088] Determine the overlapping frequency range among the first pulse width modulation frequency range, the second pulse width modulation frequency range, and the third pulse width modulation frequency range, and determine the overlapping frequency range as the pulse width modulation frequency selection range.
[0089] In a possible embodiment, the frequency determination module 102 is specifically configured to:
[0090] Obtain the preset weight of the control accuracy in the pre-stored frequency reference data, determine the frequency selection position in the pulse width modulation frequency range according to the preset weight, and determine the value corresponding to the frequency selection position as the frequency of the pulse width modulation signal.
[0091] In a possible embodiment, the frequency determination module 102 is further configured to:
[0092] Randomly select any value in the pulse width modulation frequency range and determine it as the frequency of the pulse width modulation signal.
[0093] In a possible embodiment, the data sending module 104 is specifically configured to:
[0094] Based on the baud rate, control the sending pin of the serial interface to send each of the hexadecimal numbers in ascending order.
[0095] In a possible embodiment, it further includes a serial interface recovery module, which is specifically configured to:
[0096] Restore the communication logic between the serial interface and other devices to prevent the soft start of the load from exclusively occupying the serial interface.
[0097] Figure 7 This is a schematic structural diagram of a single-chip microcomputer load soft start device provided by an embodiment of the present application. As Figure 7 shown, the device includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device can be one or more, Figure 7 Taking one processor 201 as an example; the processor 201, memory 202, input device 203, and output device 204 in the device can be connected through a bus or other means, Figure 7Take the bus connection as an example. As a computer-readable storage medium, the memory 202 can be used to store software programs, computer-executable programs, and modules, such as program instructions or modules corresponding to a single-chip microcomputer load soft start method in an embodiment of the present application. By running the software programs, instructions, and modules stored in the memory 202, the processor 201 executes various functional applications and data processing of the device, that is, implements the above-mentioned single-chip microcomputer load soft start method. The input device 203 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the device. The output device 204 may include display devices such as a display screen.
[0098] An embodiment of the present application also provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute a single-chip microcomputer load soft start method when executed by a computer processor. The method includes:
[0099] When it is detected that the power supply is turned on and powered, perform comparison processing according to pre-stored frequency reference data and an associated preset frequency range comparison table to obtain a pulse width modulation frequency selection range;
[0100] Based on the pulse width modulation frequency range, select the frequency of the pulse width modulation signal, and calculate the corresponding baud rate according to the frequency and a preset ratio;
[0101] Based on the baud rate, control the sending pin of the serial interface to send each different pre-stored sending data in a preset order, so as to implement the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signals corresponding to different pre-stored sending data. Among them, the pulse width modulation signal is sent to a load driver to implement the soft start of the load controlled by the single-chip microcomputer, and the load driver is connected to the sending pin of the serial interface and the load.
[0102] It should be noted that in the embodiments of the above single-chip microcomputer load soft start method system, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the embodiments of the present application.
[0103] Note that the above is only the preferred embodiment of the embodiments of the present application and the technical principles applied. Those skilled in the art will understand that the embodiments of the present application are not limited to the specific embodiments described herein. Various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the embodiments of the present application. Therefore, although the embodiments of the present application have been described in more detail through the above embodiments, the embodiments of the present application are not limited to the above embodiments. Without departing from the concept of the embodiments of the present application, more other equivalent embodiments can be included, and the scope of the embodiments of the present application is determined by the scope of the appended claims.
Claims
1. A single-chip microcomputer load soft-start method, applied to a single-chip microcomputer, wherein the single-chip microcomputer includes a serial interface, characterized in that: The method comprises: When it is detected that the power supply is turned on, a pulse width modulation frequency selection range is obtained by comparing the pre-stored frequency reference data and the associated preset frequency range comparison table; Selecting a frequency of a pulse width modulation signal based on the pulse width modulation frequency range, and calculating a corresponding baud rate according to the frequency and a preset ratio; Based on the baud rate, the sending pin of the serial interface is controlled to send different pre-stored sending data in a preset order to achieve the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signal corresponding to different pre-stored sending data, wherein the pulse width modulation signal is sent to the load driver to achieve soft start of the load controlled by the single-chip microcomputer, and the load driver is connected to the sending pin of the serial interface and the load.
2. The single chip microcomputer load soft starting method according to claim 1, characterized in that: The pre-stored frequency reference data includes load characteristics, control accuracy, and a baud rate range supported by the serial interface. The pulse width modulation frequency selection range is obtained by comparing the pre-stored frequency reference data with an associated preset frequency range comparison table, including: According to the load characteristics, the control accuracy and the baud rate range supported by the serial interface, the corresponding associated preset frequency range comparison table is queried to obtain a first pulse width modulation frequency range, a second pulse width modulation frequency range and a third pulse width modulation frequency range; A pulse width modulation frequency selection range is obtained by comparing the first pulse width modulation frequency range, the second pulse width modulation frequency range and the third pulse width modulation frequency range.
3. The single chip microcomputer load soft starting method according to claim 2, characterized in that: The pulse width modulation frequency selection range is obtained by comparing the first pulse width modulation frequency range, the second pulse width modulation frequency range and the third pulse width modulation frequency range, including: An overlapping frequency range among the first pulse width modulation frequency range, the second pulse width modulation frequency range and the third pulse width modulation frequency range is determined, and the overlapping frequency range is determined as a pulse width modulation frequency selection range.
4. The single chip microcomputer load soft starting method according to any one of claims 1 to 3, characterized in that: The step of selecting the frequency of the pulse width modulation signal based on the pulse width modulation frequency range comprises: The preset weight of the control accuracy in the pre-stored frequency reference data is obtained, a frequency selection position in the pulse width modulation frequency range is determined according to the preset weight, and a value corresponding to the frequency selection position is determined as the frequency of the pulse width modulation signal.
5. The single chip microcomputer load soft starting method according to any one of claims 1 to 3, characterized in that: The step of selecting the frequency of the pulse width modulation signal based on the pulse width modulation frequency range comprises: Any value in the pulse width modulation frequency range is randomly selected to be determined as the frequency of the pulse width modulation signal.
6. The single chip microcomputer load soft starting method according to any one of claims 1 to 3, characterized in that: The different pre-stored transmission data include hexadecimal numbers corresponding to the duty cycle numbers, and the control of the transmission pin of the serial interface based on the baud rate to send the different pre-stored transmission data in a preset order includes: The sending pin of the serial interface is controlled based on the baud rate to send each of the hexadecimal numbers in order from small to large.
7. The single chip microcomputer load soft starting method according to any one of claims 1 to 3, characterized in that: After the soft start of the load is completed, including: The communication logic between the serial interface and other devices is restored to prevent the soft start of the load from monopolizing the serial interface.
8. A single chip microcomputer load soft start device, characterized in that: include: A range determination module is used to obtain a pulse width modulation frequency selection range by comparing the pre-stored frequency reference data and the associated preset frequency range comparison table when it is detected that the power supply is turned on; a frequency determination module, configured to select a frequency of a pulse width modulation signal based on the pulse width modulation frequency range, A baud rate determination module, used to calculate the corresponding baud rate according to the frequency and the preset ratio; A data sending module is used to control the sending pin of the serial interface to send different pre-stored sending data in a preset order based on the baud rate, so as to realize the frequency of the pulse width modulation signal corresponding to the baud rate and the different duty cycles of the pulse width modulation signal corresponding to different pre-stored sending data, wherein the pulse width modulation signal is sent to a load driver to realize the soft start of the load controlled by the single-chip microcomputer, and the load driver is connected to the sending pin of the serial interface and the load.
9. A single chip microcomputer load soft start device, the device comprising: one or more processors; A storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the single-chip microcomputer load soft start method as described in any one of claims 1-7.
10. A storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the single chip microcomputer load soft start method according to any one of claims 1 to 7 when executed by a computer processor.