Summary of the invention
In order to overcome the deficiencies in the prior art, an object of the present invention is to provide the light-dimming method of a kind of LED lamp,
It can LED lamp in dimming process continuously, export smoothly, eliminate flicker and the shake of light.
The two of the purpose of the present invention are to provide the light modulating device of a kind of LED lamp, its can realize the purpose of the present invention it
One.
An object of the present invention realizes by the following technical solutions:
The light-dimming method of a kind of LED lamp, comprises the steps:
Step one: receiving the control signal from DMX control station, this control signal has target brightness value;
Step 2: obtain present intensity difference according to this target brightness value and present intensity value, poor according to present intensity
Value is calculated present intensity and increases data;
Step 3: increase data according to present intensity and obtain new present intensity value with present intensity value, it is judged that be the brightest
Angle value whether equal to target brightness value, the most then stops continuing to obtain new present intensity value, otherwise, according to new the brightest
Angle value obtains present intensity difference with target brightness value, performs step 4 afterwards;
Step 4: obtain new present intensity according to present intensity mathematic interpolation and increase data, return step 3 afterwards.
Preferably, step 2 " obtains present intensity according to present intensity mathematic interpolation and increases data " include walking as follows
Rapid:
Step A: judge that present intensity difference whether more than or equal to Preset Time, the most then performs step B, otherwise, holds
Row step C;
Step B: obtain the first brightness according to Preset Time and present intensity difference and increase data and the second brightness increased numbers
According to, it is judged that whether present intensity difference increases data less than or equal to the second brightness, the most then present intensity increases data=the
One brightness increases data+1, and otherwise present intensity increases data=the first brightness and increases data;Afterwards, definition is each time according to working as
Front luminance difference be calculated present intensity increase data time a length of compare the time, compare the time=be 1;
Step C: obtain the 3rd brightness according to Preset Time and present intensity difference and increase data and the 4th brightness increased numbers
According to, present intensity difference increases data more than or equal to the 3rd brightness, and present intensity difference increases data more than the 4th brightness
Time, then compare the time=compare the time+1 due to this;Otherwise, define this compare the time=Preset Time is divided by present intensity
Difference.
Preferably, in described step B, " according to Preset Time and present intensity difference obtain first brightness increase data and
Second brightness increases data " specifically include following steps:
Step B1: according to formula: Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, and wherein, Dled is
Present intensity difference, Tmax is Preset Time;
Step B2: according to formula: Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3: according to formula: Fade_data3=Tmax-Fade_data2 try to achieve the 6th brightness increase data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4: according to formula: Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5: according to formula F ade_data5=Dled-Fade_data4 try to achieve second brightness increase data, wherein,
Fade_data5 is that the second brightness increases data.
Preferably, in step C, " obtain the 3rd brightness according to Preset Time and present intensity difference and increase data and the 4th
Brightness increases data " specifically include following steps:
Step C1: according to formula: Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2: according to formula: Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3: according to formula: Fade_data8=Fade_data7-Tmax try to achieve the 4th brightness increase data, wherein,
Fade_data8 is that the 4th brightness increases data.
Preferably, step 5 is also included: new present intensity value is incrementally divided into some groups of brightness values and carries out
Output.
The two of the purpose of the present invention realize by the following technical solutions:
A kind of light modulating device of LED lamp, including such as lower unit:
Receive unit: for receiving the control signal from DMX control station, this control signal has target brightness value;
First computing unit: for obtaining present intensity difference according to this target brightness value and present intensity value, according to
Present intensity mathematic interpolation obtains present intensity and increases data;
Cycling element: obtain new present intensity value with present intensity value for increasing data according to present intensity, it is judged that
Whether present intensity value equal to target brightness value, the most then stops continuing to obtain new present intensity value, otherwise, according to new
Present intensity value obtains present intensity difference with target brightness value, performs the second computing unit afterwards;
Second computing unit: increase data for obtaining new present intensity according to present intensity mathematic interpolation, return afterwards
Return cycling element.
Preferably, the first computing unit includes judge module, the first computing module and the second computing module,
Judge module: be used for judging that present intensity difference whether more than or equal to Preset Time, the most then performs the first meter
Calculate module, otherwise, perform the second computing module;
First computing module: increase data and second for obtaining the first brightness according to Preset Time and present intensity difference
Brightness increases data, it is judged that whether present intensity difference increases data less than or equal to the second brightness, the most then present intensity increases
Long data=the first brightness increases data+1, and otherwise present intensity increases data=the first brightness and increases data;Afterwards, definition is every
Once according to present intensity mathematic interpolation obtain present intensity increase data time a length of compare the time, compare the time=1;
Second computing module: increase data and the 4th for obtaining the 3rd brightness according to Preset Time and present intensity difference
Brightness increases data, and when whether present intensity difference increases data more than or equal to the 3rd brightness, and present intensity difference is more than
4th brightness increases data, the most then compare the time=compare the time+1 due to this;Otherwise, define this compare the time=
Preset Time is divided by present intensity difference.
Preferably, in the first computing module, " obtain the first brightness according to Preset Time and present intensity difference and increase data
Data are increased with the second brightness " specifically include following steps:
Step B1: according to formula: Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, and wherein, Dled is
Present intensity difference, Tmax is Preset Time;
Step B2: according to formula: Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3: according to formula: Fade_data3=Tmax-Fade_data2 try to achieve the 6th brightness increase data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4: according to formula: Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5: according to formula F ade_data5=Dled-Fade_data4 try to achieve second brightness increase data, wherein,
Fade_data5 is that the second brightness increases data.
Preferably, in the second computing module, " obtain the 3rd brightness according to Preset Time and present intensity difference and increase data
Data are increased with the 4th brightness " specifically include following steps:
Step C1: according to formula: Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2: according to formula: Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3: according to formula: Fade_data8=Fade_data7-Tmax try to achieve the 4th brightness increase data, wherein,
Fade_data8 is that the 4th brightness increases data.
Preferably, also include breaking up unit: for new present intensity value is incrementally divided into some groups of brightness
Value exports.
Compared to existing technology, the beneficial effects of the present invention is:
This invention ensures that LED lamp in the light modulation overall process of 0-100% can continuously, smooth transition, there is no the sudden strain of a muscle of light
Sparkle and shake, and it is linear to have good light modulation, avoid the bright dark fringe of camera picture appearance when video recording or shooting simultaneously
Or shadow, meet the use of light in scene to greatest extent.
Detailed description of the invention
Below, in conjunction with accompanying drawing and detailed description of the invention, the present invention is described further:
The present invention provides the light-dimming method of a kind of LED lamp, comprises the following steps that
S1: receiving the control signal from DMX control station, this control signal has target brightness value;
Having CPU inside the LED lamp that the present invention is applied, this CPU Yu DMX control station is to be electrically connected with, and accepts
The control of DMX control station, the passage DM value that signal is 0-255 that DMX control station occurs, in CPU, storage has corresponding different
The brightness value of passage DM value, such as, the passage DM value of last control signal is 10, the passage DM of this control signal received
Value is 80, then CPU gets the brightness value of corresponding 10 and 80, the brightness value corresponding to 80 i.e. target brightness value.
S2: obtain present intensity difference, according to present intensity difference meter according to this target brightness value and present intensity value
Calculation obtains present intensity and increases data;
In S2, such as present intensity value is 150, and target brightness value is 220, then present intensity difference be target brightness value with
The absolute value of the difference between present intensity value, namely 70.Conventional way is exactly the brightness of directly output 220, the present invention
This present intensity difference is broken up repeatedly output rather than disposably the most directly exports target by intermediate portions to be done exactly
Brightness value, by the most steadily exporting, it is ensured that does not has flicker and the shake of light.Such as present intensity difference is 70, by this 70
Data are divided into many groups to be added in present intensity value, and constantly update present intensity value, until present intensity value is equal to target brightness value.
In system, it is provided with Interruption, when system performs this computing, often performs to add 1 a cycle time.During timer initial
Between be 0.
S3: increase data according to present intensity and obtain new present intensity value with present intensity value, it is judged that present intensity value
Whether equal to target brightness value, the most then stop continuing to obtain new present intensity value, otherwise, according to new present intensity value
Obtain present intensity difference with target brightness value, perform S4 afterwards;
In S3 when present intensity value is equal to target brightness value, say, that this current brightness value has reached demand, is
The final brightness needing output, it is not necessary to continue computing output the most on its basis.When receiving new target brightness value
Time, start again to calculate.It addition, if in calculating process, when present intensity value not up to target brightness value, connect again
Receive the control signal of DMX control station, and obtain target brightness value by this control signal and changed, then stop original
Calculate, rerun as target using new target brightness value.
S4: obtain new present intensity according to present intensity mathematic interpolation and increase data, return S3 afterwards.
S2 " obtains present intensity according to present intensity mathematic interpolation and increases data " comprise the steps:
Step A: judge that present intensity difference whether more than or equal to Preset Time, the most then performs step B, otherwise, holds
Row step C;
Step B: obtain the first brightness according to Preset Time and present intensity difference and increase data and the second brightness increased numbers
According to, it is judged that whether present intensity difference increases data less than or equal to the second brightness, the most then present intensity increases data=the
One brightness increases data+1, and otherwise present intensity increases data=the first brightness and increases data;Afterwards, definition is each time according to working as
Front luminance difference be calculated present intensity increase data time a length of compare the time, this compares the time=1;Computing each time is arrived
Here, all can be assigned to compare the time is 1.
Step C: obtain the 3rd brightness according to Preset Time and present intensity difference and increase data and the 4th brightness increased numbers
According to, it may be judged whether meet condition: present intensity difference increases data more than or equal to the 3rd brightness, and present intensity difference is more than
4th brightness increases data, the most then define this and compare the time=compare the time+1;Otherwise, define this compare the time=
Preset Time is divided by present intensity difference.
In described step B, " obtain the first brightness according to Preset Time and present intensity difference and increase data and the second brightness
Increase data " specifically include following steps:
Step B1: according to formula: Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, and wherein, Dled is
Present intensity difference, Tmax is Preset Time;Tmax refers to the regulation unit interval and reaches object brightness from from present intensity value
The transformation period of value, in the present invention, Tmax=Ttime*N, N are the data of constant and the change that could dictate that, Ttime is that system is fixed
Time device break period.In this step, it is to try to achieve except value is that the first brightness increases data.
Step B2: according to formula: Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;This step is complementation.
Step B3: according to formula: Fade_data3=Tmax-Fade_data2 try to achieve the 6th brightness increase data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4: according to formula: Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5: according to formula F ade_data5=Dled-Fade_data4 try to achieve second brightness increase data, wherein,
Fade_data5 is that the second brightness increases data.
In step C, " obtain the 3rd brightness according to Preset Time and present intensity difference and increase data and the 4th brightness growth
Data " specifically include following steps:
Step C1: according to formula: Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2: according to formula: Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3: according to formula: Fade_data8=Fade_data7-Tmax try to achieve the 4th brightness increase data, wherein,
Fade_data8 is that the 4th brightness increases data.
Such as: Preset Time is 50, i.e. Tmax=50, say, that will perform 50 cycles, present intensity value is 200,
Target brightness value is 347;Then present intensity difference is 147, then by above-mentioned steps, can be calculated the first brightness and increase data
For 147/50=2, it is 147%50=47 that the 5th brightness increases data, and it is 50-47=3 that the 6th brightness increases data, the 7th brightness
Growth data are 3*2=6, and it is 147-6=141 that the second brightness increases data, now contrast present intensity difference and the second brightness
Whether increase data less than or equal to the second brightness, it can be seen that 147 are more than 141, thus in this execution cycle, the brightest
Degree increases data=the first brightness and increases data, namely equal to 2, then and present intensity value=200+2=202, this present intensity
The present intensity value 200 that value 202 replacement is original, next execution cycle, then be to calculate using 202 as present intensity value.
It should be understood that, in the present invention, the first brightness increases data, the second brightness increases data, the 5th brightness increases data,
It is just to calculate in first cycle that 6th brightness increases the value of data and the 7th brightness growth data, ensuing 49
In the individual cycle, change is present intensity difference, then be appreciated that present intensity increases data and also can produce change.
By calculating it is found that three cycles in 50 cycles before, present intensity growth data are all equal to the
One brightness increases data, and in 47 cycles below, present intensity increases data and is all equal to the first brightness growth data+1,
Namely 3.And for the concept of the comparison time in the present invention, illustrated by following case:
If Preset Time is 50, present intensity difference is 40, and comparing the time is 1, and one is compared the time equal to a week
Phase, then calculate the 3rd brightness increasing data is 50/2=25, and now present intensity difference 40 increases data 25 more than the 3rd brightness,
8th brightness increases data=40*2=80, and the 4th brightness increases data=80-50=30, and now present intensity difference 40 is more than
4th brightness increases data 30, so it is 1+1=2 that this in this circulation compares the time.After ten circulations
Having walked 20 and compared the time, now above 20 cycles have walked 10 brightness values;And when present intensity difference is less than 30, this
Secondary compare the time=1, then 30 cycles have walked 30 brightness values below, and brightness value sums to 40, just 50 preset
Time has been walked 40 numbers.
If Preset Time or 50, but present intensity difference is 20, then and the 3rd brightness increases data is 25, the brightest
Degree difference less than the 3rd brightness increase data, then compare the time be Preset Time divided by present intensity difference, namely 50/20=
2, being to change the least in this link due to brightness, detailed being made in the Tmax time place completing 20 so having
Reason.
It addition, after the present invention tries to achieve new present intensity value, for ensureing high frequency output, by new present intensity value with
The mode of average incremental is assigned in Dcur-r [j] array, is divided into some groups of brightness values and exports.Namely to present intensity
Value carries out differentiation output.
Example: Dcur is divided into 60 groups of outputs
Such as, Dcur=150, led_lsb_1=150/60=2, led_msb_1=150%60=30;
First for circulation show that in Dcur-r [j] array, 60 numbers are all 2, and second for circulation calculates again
Front 30 numbers in Dcur-r [j] array all carry out adding 1 process, then front 30 numbers in Dcur-r [j] array are all 3.Two
The result of individual circulation is that front 30 numbers are equal to 3, and rear 30 numbers are equal to 2, say, that be divided into 60 groups to export by 150, front
30 groups each group of face be incremented by difference be 3, after 30 groups be incremented by differences be 2.The like, if Dcur=151, then two
The result of individual circulation is that front 31 numbers are equal to 3, and rear 29 numbers are equal to 2.The most both improve LED dimming resolution,
Also provide even transition during the mashed up light modulation of flatness, followability and color of LED light modulation.The low frequency way of output originally,
Light modulation square wave schematic diagram as in figure 2 it is shown, the data that original low frequency exports are distributed into several little square waves by the present invention exports,
To reach the effect of high frequency light modulation, as shown in Figure 3.T in Fig. 2 represents a total cycle of output present intensity value, will in Fig. 3
The square wave of Fig. 2 is subdivided into n little square wave output, and T1 is then that n/mono-T, T1 represent that present intensity value is subdivided into n group to be exported,
The cycle that each group of output is corresponding.
On the other hand, the present invention provides the light modulating device of a kind of LED lamp, including such as lower unit,
Receive unit: for receiving the control signal from DMX control station, this control signal has target brightness value;
First computing unit: for obtaining present intensity difference according to this target brightness value and present intensity value, according to
Present intensity mathematic interpolation obtains present intensity and increases data;
Cycling element: obtain new present intensity value with present intensity value for increasing data according to present intensity, it is judged that
Whether present intensity value equal to target brightness value, the most then stops continuing to obtain new present intensity value, otherwise, according to new
Present intensity value obtains present intensity difference with target brightness value, performs the second computing unit afterwards;
Second computing unit: increase data for obtaining new present intensity according to present intensity mathematic interpolation, return afterwards
Return cycling element;
Differentiation unit: export for new present intensity value is incrementally divided into some groups of brightness values.
In the first computing unit, it includes judge module, the first computing module and the second computing module, these three mould
Block is for performing the step for of " obtaining present intensity according to present intensity mathematic interpolation and increase data " in the first computing unit, tool
Body is as follows:
Judge module: be used for judging that present intensity difference whether more than or equal to Preset Time, the most then performs the first meter
Calculate module, otherwise, perform the second computing module;
First computing module: increase data and second for obtaining the first brightness according to Preset Time and present intensity difference
Brightness increases data, it is judged that whether present intensity difference increases data less than or equal to the second brightness, the most then present intensity increases
Long data=the first brightness increases data+1, and otherwise present intensity increases data=the first brightness and increases data;Afterwards, definition is every
Once according to present intensity mathematic interpolation obtain present intensity increase data for comparing the time, compare the time=1;
Second computing module: increase data and the 4th for obtaining the 3rd brightness according to Preset Time and present intensity difference
Brightness increases data, it may be judged whether meet condition: present intensity difference increases data more than or equal to the 3rd brightness, and the brightest
Degree difference increases data more than the 4th brightness, the most then define this and compare the time=compare the time+1;Otherwise, this is defined
Relatively time=Preset Time is divided by present intensity difference.
In first computing module, " obtain the first brightness according to Preset Time and present intensity difference and increase data and second
Brightness increases data " specifically include following steps:
Step B1: according to formula: Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, and wherein, Dled is
Present intensity difference, Tmax is Preset Time;
Step B2: according to formula: Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3: according to formula: Fade_data3=Tmax-Fade_data2 try to achieve the 6th brightness increase data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4: according to formula: Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5: according to formula F ade_data5=Dled-Fade_data4 try to achieve second brightness increase data, wherein,
Fade_data5 is that the second brightness increases data.
In second computing module, " obtain the 3rd brightness according to Preset Time and present intensity difference and increase data and the 4th
Brightness increases data " specifically include following steps:
Step C1: according to formula: Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2: according to formula: Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3: according to formula: Fade_data8=Fade_data7-Tmax try to achieve the 4th brightness increase data, wherein,
Fade_data8 is that the 4th brightness increases data.
It will be apparent to those skilled in the art that can technical scheme as described above and design, make other various
Corresponding change and deformation, and all these change and deformation all should belong to the protection domain of the claims in the present invention
Within.