A circuit for realizing automatic color gradient of RGB three-primary color LED lamp
By designing an automatic color gradient circuit for LED lights, the problem of high MCU resources in existing technologies with high power consumption and complicated programming, and achieve high -efficiency and low -power color gradient effects.
Patent Information
- Application Number
- CN201911107056.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-13
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2039-11-13
AI Technical Summary
The existing LED light color gradient technology requires long-term occupation of MCU resources, increase system power consumption, and high programming complexity, limiting its application scenarios.
Design a circuit including long decoding module, time -sequential control module, timing control module, color gradient step, and RGB three -channel output controller circuit. By simplifying algorithms and time -sharing reuse core circuits, automatic color gradients can be achieved Essence
The automatic, linear, and delicate color gradient effect is achieved. It does not need to take up MCU resources for a long time, greatly reduce the system power consumption, and simplify the system -level lighting design.
Smart Images

Figure CN110856306B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of LED lamp control, and in particular to a circuit for realizing automatic color gradient change of an RGB three-primary color LED lamp. Background Art
[0002] LED lights have the advantages of high efficiency and energy saving, ultra-long life, green environmental protection and strong applicability, and are widely used in various fields of daily life. In addition to applications in traditional lighting fields, LED lights are increasingly used in various high-end entertainment products, smart homes, home appliances and smart wearable products. In these application fields, LED lights are required to achieve colorful lighting effects to meet the various cool visual effects required by the products. For example, the automatic adjustment of the brightness of LED lights to form an automatic breathing effect; the accurate restoration of various colors, the color gradient effect, etc. This requires the LED control system to be more and more intelligent, and to be able to highly integrate various lighting effect controls to reduce peripheral devices and simplify system design and software support.
[0003] The LED driver chip is actually a PWM control chip. Each PWM signal controls each LED lamp to emit light of different brightness to achieve color change. The existing color gradient needs to be realized through single-chip microcomputer programming or MCU main control chip continuously sending instructions to the LED driver chip.
[0004] For example, Figure 1 A device for realizing color gradient of a three-primary color LED lamp is shown, and the device is realized mainly by single-chip computer programming, and includes a color coordinate conversion unit, a color coordinate distance calculation unit, a current color color coordinate determination unit, and a current color color coordinate determination unit. The color coordinate conversion unit is used to convert the RGB values of the target color and the initial color into CIE1931 color coordinates and CIE1931 color coordinates respectively. The color coordinate distance calculation unit is used to calculate the distance between the CIE1931 color coordinates of the target color and the CIE1931 color coordinates of the initial color in the x-axis direction and the distance in the y-axis direction. The current color color coordinate determination unit is used to calculate the CIE1931 color coordinates of the current color according to the preset color coordinate value change speed. The control signal generation unit is used to calculate the duty ratios PWM_R, PWM_G, and PWM_B of the three-way PWM control signals output to the three-primary color LED lamp driving circuit according to the CIE1931 color coordinates of the current color obtained by the current color color coordinate determination unit, and then output the three-way PWM control signals to the three-primary color LED lamp driving circuit.
[0005] This technology is implemented through a single-chip microcomputer. Through single-chip microcomputer programming, color coordinate conversion, color coordinate distance calculation, current color coordinate determination, PWM control signal generation, and LED lamp drive circuit are sent to make the three-primary color LED lamp emit the target color light. This technology requires a lot of code writing, occupies system resources for a long time, and increases the power consumption of the entire system.
[0006] For example, Figure 2 and Figure 3 The color-adjustable indicator light device composed of the three primary colors of RGB is shown. The color-adjustable indicator light device composed of the three primary colors of RGB includes a main control chip (MCU), an indicator light circuit composed of the three primary colors of RGB and a light strip. The indicator light circuit composed of the three primary colors of RGB includes a circuit controller chip and an LED lamp. The circuit controller chip communicates with the main control chip through the I2C bus. The main control chip writes registers to the circuit controller chip to realize the level change of its output terminals LED0, LED1, LED2, LED3 or the PWM waveform change of the LED cathode, thereby realizing the color and brightness change of the LED lamp. This technology needs to occupy the main control chip (MCU) resources for a long time, increase the power consumption of the entire system, and increase the complexity of programming support on the client application side.
[0007] In summary, the existing LED gradient is usually based on the RGB value of the starting color and the RGB value of the target color to set the starting value and target value of the three-way PWM signal used to control the RGB three-primary color LED lamp. According to the starting value and target value of the PWM signal, the system MCU continuously sends commands to the LED driver chip to change the three-way PWM signal value starting from the starting value, and gradually increases or decreases according to a certain algorithm until the target value of the three-way PWM signal is reached, so as to achieve the color gradient effect. This method of achieving color gradient needs to occupy the system's MCU resources for a long time, requires complex software programming support, increases the system's power consumption, and limits its application occasions.
[0008] In view of this, the designer of the present invention has made in-depth considerations on the many problems existing in realizing the color gradient of the above-mentioned LED lamps, and thus came up with this project. Summary of the invention
[0009] In view of the problems existing in the prior art, the object of the present invention is to provide a circuit with low power consumption for realizing automatic color gradient of RGB three-primary color LED lamp.
[0010] To achieve the above object, the technical solution adopted by the present invention is:
[0011] A circuit for realizing automatic color gradient of RGB three-primary color LED lamp, comprising a color gradient duration decoding module, a timing main control module, a color gradient step calculation latch module and an RGB three-channel output controller;
[0012] The color gradient duration decoding module is used to convert the gradient duration of the LED light into a binary value related to the PWM frequency required for calculating the step length, and output the converted gradient duration to the color gradient step calculation latch module;
[0013] The timing main control module is used to realize the timing control of the circuit. The timing main control module outputs a time-sharing signal and a latch signal to the color gradient step calculation latch module, which is used to control the color gradient step calculation latch module to calculate the step calculation work of the RGB three channels in a time-sharing manner, and to latch the step after the step calculation of each channel is completed; the timing main control module also outputs an enable signal to the RGB three-channel output controller, which is used to control the output signal of the RGB three-channel output controller;
[0014] The color gradient step calculation latch module calculates the gradient step of each channel according to the time-sharing signal, the gradient duration after conversion, and the starting value and target value of each channel, and after the gradient step calculation of each channel is completed, the gradient step of each channel is stored in the corresponding step latch according to the latch signal output by the timing main control module; when the gradient step calculation of the three RGB channels is completed, the step latch outputs the gradient step of the three RGB channels to the RGB three-channel output controller;
[0015] The RGB three-channel output controller outputs a PWM value or a current control value according to a starting value set for each channel, and gradually increases or decreases the output PWM value or the current control value by 1 according to the calculated gradient step number until the output PWM value or the current control value reaches the target value of the corresponding channel.
[0016] The color gradient step calculation latch module includes a step counter and a step latch, and the step counter includes a time-sharing value selection circuit, a first adder and a second adder;
[0017] The time-sharing value selection circuit of the step counter selects the corresponding channel starting value and target value according to the time-sharing signal, and sends them to the first adder to compare the size between the starting value A and the target value B, and stores them in the identification bit FLAG pin, and then calculates |AB|+1 in combination with the second adder; the time-sharing value selection circuit also calculates the gradual change step number of the channel according to the converted gradual change time length, |AB|+1, and in combination with the first adder and the second adder.
[0018] The color gradient duration decoding module includes:
[0019] POR pin, used to input power-on reset signal;
[0020] The T_CRF pin is used to input the gradual change time of the LED light; the LOAD1 pin is used to input the loading signal of the gradual change time; the TC pin is used to output the converted gradual change time.
[0021] The timing main control module includes:
[0022] The CLK pin is used to input the basic clock signal for work; the POR pin is used to input the power-on reset signal; the CRF_EN pin is used to input the enable signal of the LED light color gradient function; the RSTB pin is used to output the reset signal of the color gradient step calculation latch module; the CLK_CNT pin is used to output the step calculator clock; the CLK_LATCH pin is used to output the latch signal; the step_en<2:0> pin is used to output the time-sharing enable signal; the step_load<2:0> pin is used to output the control signal for storing the gradient step number; the S0 and S1 pins are used to output the time-sharing signal of the value selection circuit; the LOAD1 pin is connected to the LOAD1 pin of the color gradient duration decoding module, and is used to output the gradient duration loading signal to the gradient duration decoding module; the END pin is used to input the step calculation end signal.
[0023] The color gradient step calculation latch module is provided with:
[0024] The R_IN pin is used to input the initial value of the R channel; the G_IN pin is used to input the initial value of the G channel; the B_IN pin is used to input the initial value of the B channel; the R_END pin is used to input the target value of the R channel; the G_END pin is used to input the target value of the G channel; the B_END pin is used to input the target value of the B channel;
[0025] RSTB pin, connected to RSTB pin of timing main control module, used to input power-on reset signal; CLK_CNT pin, connected to CLK_CNT pin of timing main control module, used to input step counter clock; CLK_LATCH pin, connected to CLK_CNT pin of timing main control module, used to input latch signal;
[0026] step_en<2:0> pins are connected to the step_en<2:0> pins of the timing master control module and are used to input time-sharing signals. <0> When the pin is high, the gradient step number of the R channel is calculated, step_en <1> When the pin is high, the gradient step number of the G channel is calculated, step_en <2> When the pin is at a high level, the gradient step number of channel B is calculated;
[0027] The step_load<2:0> pin is connected to the step_load<2:0> pin of the timing main control module and is used to input the control signal for storing the gradient step number; step_load <0> The pin is used to input the control signal for storing the gradient steps of the R channel, step_load <1> The pin is used to input the control signal for storing the gradient steps of the G channel, step_load <2> The pin is used to input the control signal for storing the gradient steps of channel B;
[0028] The S0 and S1 pins are connected to the S0 and S1 pins of the timing main control module respectively, and are used to input the time-sharing signal of the value selection circuit; the END pin is connected to the END pin of the timing main control module, and is used to input the step calculation end signal to the timing main control module;
[0029] FLAG<2:0> pin is used to output the size between the channel start value and the target value to control the channel brightness to increase or decrease; STEP_R pin is used to output the gradient step number of the R channel; STEP_G pin is used to output the gradient step number of the G channel; STEP_B pin is used to output the gradient step number of the R channel; B channel.
[0030] The RGB three-channel output controller includes an R channel output controller, a G channel output controller and a B channel output controller;
[0031] Among them, the R channel output controller is provided with: STEP_R pin, used to input the gradient step number of the R channel; R_IN pin, used to input the initial value of the R channel; R_END pin, used to input the target value of the R channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the R channel to output the gradient PWM value or current control value according to the gradient step number; ROUT pin, used to output the PWM value or current control value;
[0032] The G channel output controller is provided with: STEP_G pin, used to input the gradual change step number of the G channel; G_IN pin, used to input the initial value of the G channel; G_END pin, used to input the target value of the G channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the G channel to output the gradual change PWM value or current control value according to the gradual change step number; GOUT pin, used to output the PWM value or current control value;
[0033] The B channel output controller is provided with: STEP_B pin, used to input the gradient step number of the B channel; B_IN pin, used to input the initial value of the B channel; B_END pin, used to input the target value of the B channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the R channel to output the gradient PWM value or current control value according to the gradient step number; BOUT pin, used to output the control PWM value or current control value.
[0034] After adopting the above scheme, the automatic color gradient circuit of the present invention is simple and has low power consumption. During the implementation process, the main control chip only needs to write registers to the circuit to set the starting color, target color and gradient duration, and enable the color gradient function. The circuit can automatically calculate according to the settings to achieve automatic, linear and delicate color gradient effects, without occupying the main control chip (MCU) resources for a long time, greatly reducing the power consumption of the system. Moreover, the color gradient circuit of the present invention can be integrated into the LED driver chip, thereby greatly simplifying the difficulty of system-level lighting effect design.
[0035] In addition, in the color gradient circuit of the present invention, a simple subtraction calculation is used to replace a complex division calculation, and a time-sharing multiplexed core circuit is used to reduce the circuit scale, so that the circuit can be integrated into a common LED driver chip, greatly reducing the cost of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a principle block diagram of the prior art one;
[0037] Figure 2 It is the principle block diagram of the second prior art;
[0038] Figure 3 It is a specific circuit diagram of the prior art 2;
[0039] Figure 4 It is a circuit principle framework diagram of the present invention;
[0040] Figure 5 An implementation example of a latch module for calculating the number of color gradient steps;
[0041] Figure 6 Calculate the latch operation timing flow chart for the color gradient step number. DETAILED DESCRIPTION
[0042] like Figure 4 As shown, the present invention discloses a circuit for realizing automatic color gradient of RGB three-primary color LED lamp, which includes a color gradient duration decoding module 1, a timing main control module 2, a color gradient step calculation latch module 3 and an RGB three-channel output controller 4.
[0043] Among them, the color gradient duration decoding module 1 is used to convert the gradient duration of the LED light into a binary value related to the PWM frequency required for calculating the step length, and output the converted gradient duration to the color gradient step calculation latch module 3.
[0044] The timing main control module 2 is used to realize the timing control of the circuit. The timing main control module 2 outputs a time-sharing signal and a latch signal to the color gradient step calculation latch module 3, which is used to control the color gradient step calculation latch module 3 to calculate the step calculation work of the RGB three channels in a time-sharing manner, and to latch the step after the step calculation of each channel is completed; the timing main control module 2 also outputs an enable signal to the RGB three-channel output controller 4, which is used to control the output signal of the RGB three-channel output controller 4.
[0045] The color gradient step calculation latch module 3 calculates the gradient step of each channel according to the time-sharing signal, the gradient duration after conversion, and the starting value and target value of each channel, and after the gradient step of each channel is completed, the gradient step is stored in the step latch according to the latch signal; when the gradient step calculation of the three RGB channels is completed, the step latch outputs the gradient step of the three RGB channels to the RGB three-channel output controller 4.
[0046] The RGB three-channel output controller 4 outputs a PWM value or a current control value according to the starting value of each channel, and gradually increases or decreases the output PWM value or the current control value by 1 according to the calculated gradient step number, until the output PWM value or the current control value reaches the target value of the corresponding channel.
[0047] like Figure 4 As shown, the color gradient duration decoding module 1 is provided with: a POR pin for inputting a power-on reset signal;
[0048] The T_CRF pin is used to input the gradual change time of the LED light; the LOAD1 pin is used to input the loading signal of the gradual change time; the TC pin is used to output the converted gradual change time.
[0049] The timing main control module 2 is provided with: a CLK pin for inputting a basic clock signal for working; a POR pin for inputting a power-on reset signal; a CRF_EN pin for inputting an enable signal for the color gradient function of the LED lamp; an RSTB pin for outputting a reset signal of the color gradient step calculation latch module 3; a CLK_CNT pin for outputting a step calculator clock; a CLK_LATCH pin for outputting a latch signal; a step_en<2:0> pin for outputting a time-sharing enable signal; a step_load<2:0> pin for outputting a control signal for storing gradient steps; S0 and S1 pins for outputting a time-sharing signal for a numerical selection circuit; a LOAD1 pin connected to the LOAD1 pin of the color gradient duration decoding module 1, for outputting a gradient duration loading signal to the gradient duration decoding module; and an END pin for inputting a step calculation end signal.
[0050] The color gradient step calculation latch module 3 is provided with:
[0051] The R_IN pin is used to input the initial value of the R channel; the G_IN pin is used to input the initial value of the G channel; the B_IN pin is used to input the initial value of the B channel; the R_END pin is used to input the target value of the R channel; the G_END pin is used to input the target value of the G channel; the B_END pin is used to input the target value of the B channel;
[0052] RSTB pin, connected to RSTB pin of timing master control module 2, used to input power-on reset signal; CLK_CNT pin, connected to CLK_CNT pin of timing master control module 2, used to input step counter clock; CLK_LATCH pin, connected to CLK_CNT pin of timing master control module 2, used to input latch signal;
[0053] The step_en<2:0> pin is connected to the step_en<2:0> pin of the timing master control module 2 and is used to input the time-sharing signal. <0> When the pin is high, the gradient step number of the R channel is calculated, step_en <1> When the pin is high, the gradient step number of the G channel is calculated, step_en <2> When the pin is at a high level, the gradient step number of channel B is calculated;
[0054] The step_load<2:0> pin is connected to the step_load<2:0> pin of the timing main control module 2 and is used to input the control signal for storing the gradient step number; wherein, step_load <0> The pin is used to input the control signal for storing the gradient steps of the R channel, step_load <1> The pin is used to input the control signal for storing the gradient steps of the G channel, step_load <2> The pin is used to input the control signal for storing the gradient steps of channel B;
[0055] The S0 and S1 pins are connected to the S0 and S1 pins of the timing main control module 2, respectively, and are used to input the time-sharing signal of the value selection circuit; the END pin is connected to the END pin of the timing main control module 2, and is used to input the step calculation end signal to the timing main control module 2;
[0056] FLAG<2:0> pin is used to output the size between the channel start value and the target value to control the channel brightness to increase or decrease; STEP_R pin is used to output the gradient step number of the R channel; STEP_G pin is used to output the gradient step number of the G channel; STEP_B pin is used to output the gradient step number of the R channel; B channel.
[0057] The RGB three-channel output controller 4 includes an R channel output controller 41, a G channel output controller 42 and a B channel output controller 43. The R channel output controller 41 is provided with: a STEP_R pin for inputting the gradient step number of the R channel; an R_IN pin for inputting the initial value of the R channel; an R_END pin for inputting the target value of the R channel; a T_CLK pin for inputting a clock signal with the same frequency as the system PWM; a FADING_EN pin for enabling the R channel to output a gradient PWM value or a current control value according to the gradient step number; and a ROUT pin for outputting a PWM value or a current control value.
[0058] The G channel output controller 42 is provided with: a STEP_G pin for inputting the gradient step number of the G channel; a G_IN pin for inputting the initial value of the G channel; a G_END pin for inputting the target value of the G channel; a T_CLK pin for inputting a clock signal having the same frequency as the system PWM frequency; a FADING_EN pin for enabling the G channel to output a gradient PWM value or a current control value according to the gradient step number; and a GOUT pin for outputting a PWM value or a current control value.
[0059] The B channel output controller 43 is provided with: a STEP_B pin for inputting the gradient step number of the B channel; a B_IN pin for inputting the initial value of the B channel; a B_END pin for inputting the target value of the B channel; a T_CLK pin for inputting a clock signal having the same frequency as the system PWM frequency; a FADING_EN pin for enabling the R channel to output a gradient PWM value or a current control value according to the gradient step number; and a BOUT pin for outputting a control PWM value or a current control value.
[0060] The color gradient step calculation latch module 3 includes a step calculator 31 and a step latch 32. In order to simplify the circuit structure of the step calculator, the step calculator 31 includes a time-sharing value selection circuit 311, a first adder 312 and a second adder 313. The time-sharing value selection circuit 311 selects the corresponding channel start value and target value according to the time-sharing signal, and sends them to the first adder 312 to compare the size between the start value A and the target value B, and stores them in the flag pin FLAG, and then calculates |AB|+1 in combination with the second adder 313; the time-sharing value selection circuit 311 also calculates the gradient step number of the channel according to the converted gradient duration, |AB|+1, and in combination with the first adder 312 and the second adder 313.
[0061] The working principle of the circuit of the present invention is described below by taking 8-bit 2 KHz PWM digital dimming as an example.
[0062] The MCU only needs to give the initial PWM values of the RGB three channels (R_INI<7:0>, G_INI<7:0>, B_INI<7:0>), the target PWM values (R_END<7:0>, G_END<7:0>, B_END<7:0>), and the time T_CRF<3:0> required to change from the initial color to the target color (the gradient time is explained using 4 bits as an example). When the color gradient function is enabled (CRF_EN=H), this circuit will first decode the 4-bit gradient time through the color gradient duration decoding module 1; according to the given PWM initial value, target value and the gradient time obtained by decoding, the color gradient step calculation latch module 3 calculates how many PWM steps each channel changes for one unit of brightness, and stores the step calculation result of each channel; finally, the RGB three-channel output controller 4 adds 1 or subtracts 1 to the PWM value every calculated step starting from the starting value of each channel according to the calculated step number, until the target value is reached to achieve color gradient.
[0063] Assume that the gradient time (T_CRF) is set to 1.572S, the corresponding T_CRF<3:0> binary is 0111, and the period of 2 KHz PWM is 512us, then , Convert 3072 to 15-bit binary 0000 1100 0000 0000 (the maximum gradient duration that can be set corresponding to 15 bits is 2^15 X 512 us = 16.77S). Therefore, the color gradient duration decoding module 1 is to convert the color gradient duration represented by 4-bit T_CRF<3:0> into 15-bit binary according to the above relationship. Assume the initial value of the R channel is A = 80 / 255 and the target value is B = 200 / 255, then B > A, |A - B| = 120; then STEP_R = 3072 / 120 = 25, that is, starting from the initial value 80 / 255, the brightness increases by 1 / 255 every 25 PWM cycles until the target value 200 / 255 is reached. A linear change from the initial value to the target value is achieved in 1.572S. Conversely, if the initial value A = 200 / 255 and the target value is B = 80 / 255, then B < A, |A - B| = 120; then STEP_R = 3072 / 120 = 25, that is, starting from the initial value 200 / 255, the brightness decreases by 1 / 255 every 25 PWM cycles until the target value 80 / 255 is reached.
[0064] Since the implementation of division is very complex in the design of digital circuits. Therefore, in this design, the calculation of STEP is converted from division to subtraction. First, judge the size relationship between the starting value A and B and store it in the flag bit FLAG<2:0>, so as to determine Figure 1 whether the RGB three-channel output controller counts up or counts down starting from the starting value. The value of |A - B| + 1 (adding 1 is to prevent A = B) is calculated by the color gradient step calculation latch circuit and stored in the register; then the value of the color gradient duration is sent to the color gradient step calculation latch circuit and used as the minuend, continuously subtract |A - B| + 1, and each time it is subtracted, the step counter is incremented by 1 until the resulting result is less than or equal to 0 and then stop counting. In this way, subtraction is used instead of division to calculate how many steps to change the brightness by 1 / 255 from the initial value to the target value. In this system, the step calculation for the three channels uses a time-division multiplexing circuit, and the time-division control of the step calculation and the step time-division latch are performed by the timing main control module 2 to minimize the circuit scale and optimize the cost. The calculated steps are latched separately and sent to each channel output controller. When the steps of the three channels are all calculated, the timing main control module 2 will enable the output controllers of the three channels to start the control of color gradient. The channel output controller adds 1 or subtracts 1 from the PWM value each time the count reaches the number of steps until the output PWM value is equal to the target value and then ends. The three channels gradually linearly change from their respective specified starting values to the target values within the common time T_CRF, realizing the automatic color gradient process.
[0065] Figure 5This is an implementation example of the color gradient step calculation latch module 3, and its working timing mechanism is as follows Figure 6 When the color gradient function of the system is enabled, the step number of the R channel is calculated first. At this time, the timing master controller sets step_en <0> It is high effective, and S0 and S1 are set to 0. At this time, the time-sharing value selection circuit 311 selects Z<7:0>=R_INI<7:0>=A; Z1<7:0>=R_END<7:0>=B; Z2<6:0>=0; the 15-bit adder (the first adder 312) will determine the size relationship between A and B and store it in the flag bit FLAG <0> , and sends the result of AB to the eight-bit adder for processing. At this time, only the lower eight bits of the result of the 15-bit adder are valid, and the eight-bit adder (the second adder 313) calculates |AB|+1; after completing this step, the timing master controller sets S0=1, S1=0, and the time-sharing value selector sets Z<7:0>=TC<7:0>; Z2<6:0>=TC<14:8>; Z1<7:0>=AB<7:0>=|AB|+1; at this time, Z<7:0> and Z2<6:0> together form the minuend equal to TC<14:0>, and Z1<7:0>=|AB|+1 is the subtrahend, and the subtrahend is ready to start the subtraction calculation. After data preparation is completed, the timing master controller sets S0=1, S1=1, and starts subtraction calculation. The difference of each subtraction is the output OUT<14:0> of the 15-bit adder. At this time, the time-sharing value selector will select Z<7:0>=OUT<7:0>; Z2<6:0>=OUT<14:8>; Z1<7:0>=AB<7:0>=|AB|+1; as long as OUT<14:0> is greater than 0, OUT<14:0> will be sent back to the time-sharing value selector as the minuend for the next subtraction. Each time |AB|+1 is subtracted, Figure 2 The step counter in the step_load register will increase by one. When the subtraction result is less than or equal to 0, the subtraction ends, the step counter stops counting, and the calculated number of steps is transferred to the step_load register. <0> The signal is stored in the step latch; then the system resets all adders, step counters, and the timing master control circuit to control step_en <0> Low, stop enabling, control step_en <1> When high, the step count of channel G is enabled. After the step count of channel G is completed, the step count of channel B is calculated. The step counts of the three channels will be sent to the three-way output controller by the step count latch.
[0066] The key to the present invention is that the automatic color gradient circuit of the present invention is simple and has low power consumption. During the implementation process, the main control chip only needs to write registers to the circuit to set the starting color, target color and gradient duration, and enable the color gradient function. The circuit can automatically calculate according to the settings to achieve automatic, linear and delicate color gradient effects without occupying the main control chip (MCU) resources for a long time, greatly reducing the power consumption of the system. Moreover, the color gradient circuit of the present invention can be integrated into the LED driver chip, thereby greatly simplifying the difficulty of system-level lighting effect design.
[0067] In addition, in the color gradient circuit of the present invention, a simple subtraction calculation is used to replace a complex division calculation, and a time-sharing multiplexed core circuit is used to reduce the circuit scale, so that the circuit can be integrated into a common LED driver chip, greatly reducing the cost of the system.
[0068] The above description is only an implementation example of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A circuit for realizing automatic color gradient of RGB three-primary color LED lamp, characterized in that: It includes a color gradient duration decoding module, a timing main control module, a color gradient step calculation latch module and an RGB three-channel output controller; The color gradient duration decoding module is used to convert the color gradient duration of the LED lamp into a binary value related to the PWM frequency required for calculating the step length, and output the converted gradient duration to the color gradient step calculation latch module; The timing main control module is used to realize the timing control of the circuit. The timing main control module outputs a time-sharing signal and a latch signal to the color gradient step calculation latch module, which is used to control the color gradient step calculation latch module to calculate the step calculation work of the RGB three channels in a time-sharing manner, and to latch the step after the step calculation of each channel is completed; the timing main control module also outputs an enable signal to the RGB three-channel output controller, which is used to control the output signal of the RGB three-channel output controller; The color gradient step calculation latch module calculates the gradient step of each channel according to the time-sharing signal, the gradient duration after conversion, and the starting value and target value of each channel, and after the gradient step calculation of each channel is completed, the gradient step of each channel is stored in the corresponding step latch according to the latch signal output by the timing main control module; When the gradient step number calculation of the three RGB channels is completed, the step latch outputs the gradient step number of the three RGB channels to the RGB three-channel output controller; The RGB three-channel output controller outputs a PWM value or a current control value according to a starting value set for each channel, and gradually increases or decreases the output PWM value or the current control value by 1 according to the calculated gradient step number until the output PWM value or the current control value reaches the target value of the corresponding channel; The color gradient step calculation latch module includes a step calculator and a step latch, and the step calculator includes a time-sharing value selection circuit, a first adder and a second adder; the time-sharing value selection circuit of the step calculator selects the corresponding channel starting value and target value according to the time-sharing signal, and sends them to the first adder to compare the size between the starting value A and the target value B, and stores them in the identification bit FLAG pin, and then calculates |AB|+1 in combination with the second adder; the time-sharing value selection circuit also calculates the gradient step number of the channel according to the converted gradient duration, |AB|+1, and in combination with the first adder and the second adder.
2. A circuit for realizing automatic color gradient of RGB three-primary color LED lamp according to claim 1, characterized in that: The color gradient duration decoding module includes: POR pin, used to input power-on reset signal; The T_CRF pin is used to input the gradual change time of the LED light; the LOAD1 pin is used to input the loading signal of the gradual change time; TC pin, used to output the transition duration after conversion.
3. A circuit for realizing automatic color gradient of RGB three-primary color LED lamp according to claim 2, characterized in that: The timing main control module includes: The CLK pin is used to input the basic clock signal for operation; the POR pin is used to input the power-on reset signal; CRF_EN pin, used to input the enable signal of the LED light color gradient function; RSTB pin, used to output the reset signal of the color gradient step calculation latch module; CLK_CNT pin, used to output the step counter clock; CLK_LATCH pin, used to output the latch signal; step_en<2:0> pin, used to output the time-sharing enable signal; step_load<2:0> pin, used to output the control signal for storing the gradient step number; S0 and S1 pins, used to output the time-sharing signal of the value selection circuit; LOAD1 pin, connected to the LOAD1 pin of the color gradient duration decoding module, used to output the gradient duration loading signal to the gradient duration decoding module; END pin is used to input the step calculation end signal.
4. A circuit for realizing automatic color gradient of RGB three-primary color LED lamp according to claim 3, characterized in that: The color gradient step calculation latch module is provided with: The R_IN pin is used to input the initial value of the R channel; the G_IN pin is used to input the initial value of the G channel; the B_IN pin is used to input the initial value of the B channel; the R_END pin is used to input the target value of the R channel; the G_END pin is used to input the target value of the G channel; the B_END pin is used to input the target value of the B channel; RSTB pin, connected to RSTB pin of timing main control module, used to input power-on reset signal; CLK_CNT pin, connected to CLK_CNT pin of timing main control module, used to input step counter clock; CLK_LATCH pin, connected to CLK_CNT pin of timing main control module, used to input latch signal; step_en<2:0> pins are connected to the step_en<2:0> pins of the timing master control module and are used to input time-sharing signals. <0> When the pin is high, the gradient step number of the R channel is calculated, step_en <1> When the pin is high, the gradient step number of the G channel is calculated, step_en <2> When the pin is at a high level, the gradient step number of channel B is calculated; The step_load<2:0> pin is connected to the step_load<2:0> pin of the timing main control module and is used to input the control signal for storing the gradient step number; among them, step_load <0> The pin is used to input the control signal for storing the gradient steps of the R channel, step_load <1> The pin is used to input the control signal for storing the gradient steps of the G channel, step_load <2> The pin is used to input the control signal for storing the gradient steps of channel B; The S0 and S1 pins are connected to the S0 and S1 pins of the timing main control module respectively, and are used to input the time-sharing signal of the value selection circuit; the END pin is connected to the END pin of the timing main control module, and is used to input the step calculation end signal to the timing main control module; FLAG<2:0> pin is used to output the size between the channel start value and the target value to control the channel brightness to increase or decrease; STEP_R pin is used to output the gradient step number of the R channel; STEP_G pin is used to output the gradient step number of the G channel; STEP_B pin is used to output the gradient step number of the R channel; B channel.
5. A circuit for realizing automatic color gradient of RGB three-primary color LED lamp according to claim 4, characterized in that: The RGB three-channel output controller includes an R channel output controller, a G channel output controller and a B channel output controller; Among them, the R channel output controller is provided with: STEP_R pin, used to input the gradient step number of the R channel; R_IN pin, used to input the initial value of the R channel; R_END pin, used to input the target value of the R channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the R channel to output the gradient PWM value or current control value according to the gradient step number; ROUT pin, used to output the PWM value or current control value; The G channel output controller is provided with: STEP_G pin, used to input the gradual change step number of the G channel; G_IN pin, used to input the initial value of the G channel; G_END pin, used to input the target value of the G channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the G channel to output the gradual change PWM value or current control value according to the gradual change step number; GOUT pin, used to output the PWM value or current control value; The B channel output controller is provided with: STEP_B pin, used to input the gradient step number of the B channel; B_IN pin, used to input the initial value of the B channel; B_END pin, used to input the target value of the B channel; T_CLK pin, used to input the clock signal with the same frequency as the system PWM; FADING_EN pin, used to enable the R channel to output the gradient PWM value or current control value according to the gradient step number; BOUT pin, used to output the control PWM value or current control value.
Citation Information
Patent Citations
Circuit for realizing automatic color gradient of RGB three-primary-color LED lamp
CN211240178U