A dimming method based on straight line fitting

CN120076117BActive Publication Date: 2026-09-18LEN TECH LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510508772.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2026-09-18
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

查找表法可以通过预先设定PWM配置值,使PWM配置值与PWM信号的高电平持续时间的关系符合指数映射关系,这种方式需要存储大量数据以供查表输出,消耗大量存储资源

Benefits of technology

[0010] The dimming method based on linear fitting proposed in this application can obtain the linear fitting result corresponding to the PWM configuration value without the need for arithmetic logic units, which greatly reduces the consumption of circuit computing and storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120076117B_ABST
    Figure CN120076117B_ABST
Patent Text Reader

Abstract

The application relates to a dimming method based on straight line fitting, comprising the following steps: acquiring a PWM configuration value, wherein the PWM configuration value is a binary number, and a plurality of fitting intervals are divided based on a possible value range of the PWM configuration value; the serial number of the fitting interval is a decimal number determined based on at least the first part of the PWM configuration value; the fitting interval where the PWM configuration value is located is determined based on the first part of the PWM configuration value; and a straight line fitting result is obtained based on the PWM configuration value and the fitting interval where the PWM configuration value is located; wherein the bit number of the straight line fitting result is greater than that of the PWM configuration value. The application also relates to an electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electrical control, and in particular to a dimming method based on linear fitting. Background Technology

[0002] The brightness of a light-emitting diode (LED) can be adjusted by regulating its drive current. Pulse-width modulation (PWM) dimming controls the average drive current of the LED by changing the duty cycle of the PWM signal, thereby adjusting the LED's brightness. A higher PWM duty cycle results in higher brightness; conversely, a lower PWM duty cycle results in lower brightness. Since the switching frequency of LEDs is much higher than the human eye's perception frequency, the human eye does not perceive flickering light, only changes in brightness. In practical applications, LEDs require uniform brightness changes, i.e., linear brightness changes. However, because the human eye's sensitivity to high and low brightness differs, a linear change in brightness can only be perceived when the switching duty cycle changes exponentially. To provide a more comfortable dimming experience for the human eye, exponential dimming is widely used.

[0003] Existing exponential dimming methods include lookup table methods, formula methods, and linear fitting methods. The lookup table method pre-sets PWM configuration values ​​so that the relationship between these values ​​and the high-level duration of the PWM signal conforms to an exponential mapping. This method requires storing a large amount of data for lookup table output, consuming significant storage resources. The formula method requires numerous multipliers or adders for complex calculations to achieve exponential dimming, resulting in high implementation difficulty, large computational delays, and significant computational resource requirements. The linear fitting method uses multiple straight lines to fit the exponential dimming curve, requiring substantial computational resources during the fitting process and exhibiting relatively low accuracy. Summary of the Invention

[0004] To address the technical problems existing in the prior art, this application proposes a dimming method based on linear fitting, comprising: obtaining a PWM configuration value, wherein the PWM configuration value is a binary number, and multiple fitting intervals are divided based on its possible value range; the sequence number of the fitting interval is a decimal number determined at least based on a first part of the PWM configuration value; determining the fitting interval in which the PWM configuration value belongs based on the first part of the PWM configuration value; obtaining a linear fitting result based on the PWM configuration value and the fitting interval in which it belongs; wherein the number of bits in the linear fitting result is greater than the number of bits in the PWM configuration value.

[0005] Specifically, in the method, when the PWM configuration value is located in a fitting interval other than the first fitting interval, the linear fitting result corresponding to each PWM configuration value includes a first part, a second part, and a third part from the least significant bit to the most significant bit; wherein the first fitting interval is the interval starting from the minimum value of the PWM configuration value; the linear fitting result is a binary number with a fixed number of bits, the first part of which includes one or more 0s, wherein the number of 0s is the sequence number of the fitting interval where the PWM configuration value is located minus 1; the second part includes the value of the least significant X bits of the PWM configuration value, wherein X is an integer greater than or equal to 5; the least significant bit of the third part is 1, and if there are other bits, it is 0.

[0006] Specifically, in the method, when the PWM configuration value is within the first fitting interval, the PWM configuration value is used as the straight line fitting result.

[0007] Specifically, in the method, when the PWM configuration value is at its maximum value, the linear fitting result is a preset fixed value.

[0008] This application also relates to an electronic device including an LED dimming device, wherein the LED dimming device is configured to perform the method described in any of the preceding methods.

[0009] In particular, the electronic device also includes LED light-emitting elements.

[0010] The dimming method based on linear fitting proposed in this application can obtain the linear fitting result corresponding to the PWM configuration value without the need for arithmetic logic units, which greatly reduces the consumption of circuit computing and storage resources. Attached Figure Description

[0011] The preferred embodiments of this application will now be described in further detail with reference to the accompanying drawings, wherein: Figure 1 The diagram shown is a schematic diagram of an LED dimming target curve according to an embodiment of this application; Figure 2 The figure shown is a schematic diagram of a linear fitting result curve according to an embodiment of this application; Figure 3 The diagram shown is a flowchart of a linear fitting method according to an embodiment of this application; Figure 4 The figure shown is a schematic diagram of the curve of the adjustment value changing with the PWM configuration value according to an embodiment of this application; Figure 5 The diagram shown is a flowchart of a curvature adjustment method according to an embodiment of this application; Figure 6The figure shown is a schematic diagram of the curves before and after adjustment of the straight line fitting result according to an embodiment of this application; Figure 7 The diagram shown is a dimming simulation result according to an embodiment of this application. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] In the following detailed description, reference can be made to the accompanying drawings, which form part of this application and illustrate specific embodiments of the present application. In the drawings, similar reference numerals describe substantially similar components in different figures. Specific embodiments of the present application are described in sufficient detail below to enable those skilled in the art to implement the technical solutions of the present application. It should be understood that other embodiments may also be utilized, or structural, logical, or electrical changes may be made to the embodiments of the present application.

[0014] Techniques, methods, and apparatus known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and apparatus should be considered part of the specification. The lines connecting the units in the accompanying drawings are merely for illustrative purposes, indicating that at least the units at both ends of the line are communicating with each other, and are not intended to prevent unconnected units from communicating. Furthermore, the number of lines between two units is intended to indicate at least the number of signals involved in communication between the two units or at least the number of output terminals, and is not intended to limit communication between the two units to only the signals shown in the figures.

[0015] Traditional exponential dimming methods either use addition and multiplication modules to fit the dimming curve or use lookup tables to map the PWM to the calculated value of an exponential function, thus obtaining the final dimming control value corresponding to the PWM configuration value. This process requires a large number of computing or storage units.

[0016] The dimming method proposed in this application, based on linear fitting and curvature adjustment, combines linear fitting and curvature adjustment to reduce the demand for storage and computing resources. Through a more optimized algorithm, it achieves exponential dimming with higher accuracy, providing users with a more comfortable and delicate visual experience.

[0017] Figure 1The diagram shown is a schematic diagram of an LED dimming target curve according to an embodiment of this application. Figure 1 The LED dimming target curve shown is an exponential curve. The horizontal axis represents the PWM configuration value, which is a decimal number corresponding to an eight-bit binary number. The vertical axis represents the dimming control value corresponding to the PWM configuration value, which is a decimal number corresponding to a 12-bit binary number. The LED dimming device generates a PWM signal with a corresponding duty cycle based on the dimming control value. In the LED dimming target curve, the larger the PWM configuration value, the higher the duty cycle of the generated PWM signal, the higher the LED brightness, and the steeper the curve slope; the smaller the PWM configuration value, the lower the duty cycle of the generated PWM signal, the lower the LED brightness, and the shallower the curve slope. According to one embodiment of this application, the number of bits in the dimming control value is greater than the number of bits in the PWM configuration value.

[0018] Figure 2 The diagram shown is a schematic representation of a linear fitting result curve according to an embodiment of this application. The horizontal axis represents the PWM configuration value, and the vertical axis represents the linear fitting result. Figure 2 As shown, the target curve for LED dimming is fitted using M linear functions. Here, M is an integer greater than or equal to 1.

[0019] According to one embodiment, the PWM configuration value is divided into M fitting intervals starting with its minimum value, and the LED dimming target curve is divided into M segments according to the fitting intervals.

[0020] According to one embodiment of this application, the LED dimming device includes a register. The register is configured to receive an N-bit binary PWM configuration value, where N is an integer greater than or equal to 1.

[0021] In one embodiment of this application, the register is configured to receive an eight-bit binary PWM configuration value, and the decimal range corresponding to the numerical range of the PWM configuration value is 0~255. Starting with the minimum value of the PWM configuration value, the PWM configuration value is divided into multiple fitting intervals in groups of 32. Within the fitting interval starting with the minimum value and its adjacent fitting interval, the dimming control value corresponding to the PWM configuration value changes relatively little; therefore, these two fitting intervals can be merged into a first fitting interval. The first fitting interval includes PWM configuration values ​​0~31 and 32~63; the second fitting interval includes PWM configuration values ​​64~95; the third fitting interval includes PWM configuration values ​​96~127; the fourth fitting interval includes PWM configuration values ​​128~159; the fifth fitting interval includes PWM configuration values ​​160~191; the sixth fitting interval includes PWM configuration values ​​192~223; and the seventh fitting interval includes PWM configuration values ​​224~254 and the maximum value of PWM configuration value 255. In the first fitting interval, the dimming control value changes the slowest as the PWM configuration value increases; from the second to the sixth fitting interval, the dimming control value changes gradually faster as the PWM configuration value increases; in the seventh fitting interval, the dimming control value changes the fastest relative to other fitting intervals as the PWM configuration value increases.

[0022] According to one embodiment, within the fitting interval of each PWM configuration value, a linear fit is performed on the target LED dimming curve to obtain M linear functions based on different fitting intervals. The linear functions can be modeled as: Y=K(Xb) Where X represents the PWM configuration value, Y represents the linear fitting result, K represents the slope of the linear function, and b represents the offset. Within different fitting intervals, the modeled linear function has different slopes K, and the correspondence between the PWM configuration value and the linear fitting result also differs. In some embodiments of this application, for two adjacent fitting intervals, the K value of the linear function fitted by the latter fitting interval is twice the K value of the linear function fitted by the former fitting interval; except for the first fitting interval, the difference between the offsets b of the linear functions of two adjacent fitting intervals is 32, corresponding to the width of each fitting interval. Here, the PWM configuration value included in the latter fitting interval is greater than the PWM configuration value included in the former fitting interval.

[0023] In the following detailed description, the PWM configuration value includes an eight-bit binary number. Starting with the minimum value of the PWM configuration value, the range of PWM configuration values ​​is divided into seven fitting intervals in sequence to illustrate the dimming method proposed in this application. The first fitting interval is the fitting interval starting with the minimum PWM configuration value, for example... Figure 2The first fitting interval (PWM configuration value 0~63) is defined; the starting value of the PWM configuration value in the highest-indexed fitting interval is greater than the PWM configuration values ​​contained in other fitting intervals, for example... Figure 2 The seventh fitting interval (PWM configuration value 224~255) is shown in the figure. It's understandable that the fitting interval can be divided starting from the maximum value of the PWM configuration value, and then divided according to the order in which the PWM configuration values ​​gradually decrease.

[0024] The PWM configuration value is divided into two parts. The first part of the PWM configuration value differs for different fitting intervals. The decimal number determined by the first part of the PWM configuration value can be used as the sequence number of the fitting interval and the fitting interval in which the PWM configuration value belongs. The first part of the PWM configuration value corresponding to the fitting interval with the highest sequence number has the largest value. The second part of the PWM configuration value corresponds to a trimming point within a fitting interval. It is understandable that the first and second parts of the PWM configuration value can include different numbers of bits, but the sum of the two parts is the sum of the total number of bits in the PWM configuration value. For example, when the PWM configuration value has 9 bits, it can be divided into 16 fitting intervals. The high four bits of the PWM configuration value in each fitting interval constitute the first part, and the values ​​of the first part of the PWM configuration value in different fitting intervals are different; the low five bits of the PWM configuration value constitute the second part.

[0025] According to one embodiment, the first part of the PWM configuration value includes the most significant N bits of the PWM configuration value; the second part of the PWM configuration value includes the remaining bits of the PWM configuration value excluding the most significant N bits. The sum of the number of bits in the first and second parts of the PWM configuration value is the total number of bits in the PWM configuration value, where N is an integer greater than or equal to 3.

[0026] In the following description, the PWM configuration value is divided into two parts: the highest three bits and the lowest five bits. The first part corresponds to the fitting interval of the PWM configuration value, and the lowest five bits of the PWM configuration value correspond to the adjustment points within the fitting interval. Figure 2 For example, the highest three bits of the PWM configuration value included in the first fitting interval are 000 or 001. Except for the first fitting interval, the highest three bits of the PWM configuration value included in other fitting intervals are the same. For instance, when the highest three bits of the PWM configuration value are 010, the PWM configuration value is in the second fitting interval; when the highest three bits of the PWM configuration value are 011, the PWM configuration value is in the third fitting interval; when the highest three bits of the PWM configuration value are 100, the PWM configuration value is in the fourth fitting interval; when the highest three bits of the PWM configuration value are 101, the PWM configuration value is in the fifth fitting interval; when the highest three bits of the PWM configuration value are 110, the PWM configuration value is in the sixth fitting interval; and when the highest three bits of the PWM configuration value are 111, the PWM configuration value is in the seventh fitting interval.

[0027] The reason for choosing the lowest five bits of the PWM configuration value as the adjustment point is that, regardless of the total number of bits in the PWM configuration value, using the lowest five bits to determine the adjustment point provides relatively high accuracy, basically meeting the usage requirements. Of course, users can adjust the number of bits in the PWM configuration value used as the coordinates of the adjustment point within the scope protected by this application, according to their needs.

[0028] Figure 3 The diagram shown is a flowchart of a linear fitting method according to one embodiment of this application. According to one embodiment, the linear fitting method can be performed by an LED dimming device.

[0029] Step 301: Obtain the PWM configuration value.

[0030] According to one embodiment, the PWM configuration value can be specified by the user.

[0031] Step 302: Determine the fitting interval of the PWM configuration value based on the highest three bits of the PWM configuration value.

[0032] Step 303, when the PWM configuration value is in the first fitting interval (e.g. Figure 2 When the first fitting interval (0~63) is within the range, the value of the linear fitting result is set to the current PWM configuration value.

[0033] According to one embodiment, the number of bits in the linear fitting result is higher than the number of bits in the PWM configuration value.

[0034] Step 304: When the PWM configuration value is in a fitting interval other than the first fitting interval, the value of the linear fitting result includes a first part, a second part, and a third part from the least significant bit to the most significant bit. The first part includes one or more zeros, and the corresponding decimal number is 0. The number of zeros is the sequence number of the fitting interval where the PWM configuration value is located minus 1. The second part includes the least five bits of the PWM configuration value. The least significant bit of the third part is 1, and if there are other bits, they are 0.

[0035] According to one embodiment of this application, based on the first part of the PWM configuration value, such as the highest three bits, the linear fitting result can be generated in real time by splicing together. Alternatively, the fitting interval containing the PWM configuration value and the first and / or third parts of the linear fitting result corresponding to the PWM configuration value in that fitting interval can be obtained by looking up a table. Obtaining part of the linear fitting result by looking up a table is advantageous because this method has a higher processing speed. Of course, those skilled in the art can obtain part of the linear fitting result using other methods within the scope of protection of this application.

[0036] Step 305: When the PWM configuration value is at its maximum value, the value of the linear fitting result is set to a fixed value. The fixed value can be obtained based on the LED dimming target curve. According to one embodiment of this application, the fixed value is a dimming control value corresponding to the maximum value of the PWM configuration value.

[0037] Table 1

[0038] Table 1 shows a list of the correspondences between various fitting intervals and their linear fitting results according to an embodiment of this application. The first and second columns represent different fitting intervals and their corresponding PWM configuration value ranges, including seven fitting intervals and the maximum value of the PWM configuration value; the third column represents the linear function corresponding to each fitting interval; the fourth column represents the first part of the PWM configuration value, i.e., the highest three digits; the fifth and sixth columns are the minimum and maximum values ​​of the PWM configuration value in each fitting interval, respectively; the seventh and eighth columns represent the slope and offset of the linear function corresponding to each fitting interval, where the slope K is a decimal number; the ninth column is the algorithm for the linear fitting result corresponding to each fitting interval. The linear fitting result corresponding to the maximum value of the PWM configuration value is a fixed value, which can be obtained through the LED dimming target curve. In the first fitting interval, the linear fitting result corresponding to the PWM configuration value is itself.

[0039] In Table 1, when the highest three bits of the PWM configuration value are 111, the PWM configuration value is determined to be in the seventh fitting interval (224≤X≤254). The linear function corresponding to this fitting interval is Y=64(X-192), the slope of which is 64, and the offset is 192 (corresponding to the binary number 11000000). The minimum and maximum values ​​of the PWM configuration value are 11100000 and 11111110, respectively. The first part of the linear fitting result corresponding to the PWM configuration value includes seven minus one zero, the second part includes the lowest five bits of the PWM configuration value, and the third part includes one 1, for a total of 12 binary bits. When the highest three bits of the obtained PWM configuration value are 110, the PWM configuration value is in the sixth fitting interval (192≤X≤223). The first part of the linear fitting result corresponding to the PWM configuration value includes six minus one zero, the second part includes the lowest five bits of the PWM configuration value, and the lowest bit of the third part is 1, with the remaining bits being 0; and so on. When the highest three bits of the obtained PWM configuration value are 000 or 001, the PWM configuration value is located in the first fitting interval (0≤X≤63), and the linear fitting result corresponding to the PWM configuration value is the value of the PWM configuration value. When the maximum value of the PWM configuration value is 255, its corresponding linear fitting result is 4095.

[0040] During the linear fitting process, a small number of PWM configuration values ​​are stored in registers to correspond to the linear fitting results. Without the need for arithmetic logic units, the linear fitting results corresponding to the PWM configuration values ​​can be obtained, which greatly reduces the consumption of circuit computing and storage resources.

[0041] To improve the accuracy of the fitting, after obtaining the linear fitting result of the PWM configuration value, the curvature adjustment method is used to adjust the linear fitting result multiple times to obtain the adjusted result corresponding to the PWM configuration value. The adjusted result is then used as the dimming control value to control the duty cycle of the PWM signal. By adjusting the linear fitting result, a smoother exponential curve is obtained. The method for obtaining the linear fitting result of the LED dimming target curve is not limited to the linear fitting method proposed in the above embodiments, and other methods may also be used.

[0042] Within a fitting interval, the lowest five bits of the PWM configuration value correspond to the adjustment point within that interval. Therefore, a correspondence is established between the lowest five bits of the PWM configuration value and the total adjustment value. The total adjustment value is then used to adjust the linear fitting result corresponding to the PWM configuration value.

[0043] Table 2

[0044] Table 2 shows a list of the lowest five bits of the PWM configuration value and the total trim value according to one embodiment. The first column of pwm_config[4:0] represents the decimal number corresponding to the lowest five bits of the PWM configuration value, and the second column of pwm_config[4:0] represents the lowest five bits of the PWM configuration value. The first to seventh columns of trim_value represent the fitting intervals divided based on the value range of the PWM configuration value, and the total trim value corresponding to the PWM configuration value in each fitting interval, where the total trim value is a decimal number. For example, in the seventh fitting interval 224≤x≤255, the total trim value corresponding to the lowest five bits of the PWM configuration value being 01000 is the decimal number 100. The total trim value corresponding to different PWM configuration values ​​is different in different fitting intervals. The total trim value corresponding to the PWM configuration value in the highest-order fitting interval is greater than the total trim value corresponding to the PWM configuration value in other fitting intervals.

[0045] In Table 2, the total adjustment value exhibits symmetry within any fitting interval. As the lowest five bits of the PWM configuration value change from small to large, the total adjustment value is symmetrical about the median value of the lowest five bits of the PWM configuration value. Within a fitting interval, based on the binary representation of the fifth bit of the PWM configuration value from the least significant bit, the PWM configuration value can be divided into two categories: one where the fifth bit is 0 and the other where the fifth bit is 1. The adjustment value ranges for the two categories are the same, but their trends are opposite. For example, in the fitting interval 224≤x≤255, the value of the fifth bit of the PWM configuration value from the least significant bit can divide the lowest five bits of the PWM configuration value into two categories: 00000~01111 and 10000~11111. In the first category (00000~01111), the lowest four bits of the PWM configuration value change from 0000 to 1111, and the corresponding decimal number of the total adjustment value changes from the minimum value (0) to the maximum value (135). In the second category (10000~11111), the lowest four bits of the PWM configuration value change from 0000 to 1111, and the decimal number corresponding to the total adjustment value changes from the maximum value (135) to the minimum value (0). At this time, by inverting the lowest four bits of the second part of the PWM configuration value bit by bit and corresponding it with the total adjustment value, the same result as in the first category can be obtained. That is to say, among the lowest five bits of the PWM configuration value, the highest bit can be used to determine the category of the PWM configuration value in a fitting interval, and the other four bits are used to determine the adjustment point within the fitting interval.

[0046] Figure 4 The diagram shows a curve illustrating the change of the adjustment value as a function of the PWM configuration value according to an embodiment of this application. The horizontal axis represents the decimal number corresponding to the lowest five bits of the PWM configuration value; the vertical axis represents the total adjustment value. Different curves represent the change of the total adjustment value within different fitting intervals.

[0047] like Figure 4 As shown, the step size is calculated by taking the difference between the total adjustment values ​​corresponding to two adjacent PWM configuration values, from the minimum value of the lowest five bits of the PWM configuration value to the median value of the lowest five bits. The step size decreases as the PWM configuration value increases. This decrease in step size is reflected in the gradually decreasing slope of the tangent line drawn on any curve through the point corresponding to the PWM configuration value. Based on the symmetry of the total adjustment values ​​within the same fitting interval, the step size also exhibits a symmetry. The curvature adjustment method changes the slope of the linear function corresponding to each fitting interval by altering the step size between two adjacent total adjustment values, thus adjusting the linear function corresponding to each fitting interval into a curve.

[0048] According to one embodiment, when the total adjustment value first increases and then decreases within a fitting interval, the final adjustment result can be the difference between the linear fitting result and the total adjustment value.

[0049] According to another embodiment of this application, when the total adjustment value first decreases and then increases within a fitting interval, the final adjustment result can be the sum of the linear fitting result and the total adjustment value.

[0050] In one embodiment of this application, the total adjustment value corresponding to the PWM configuration value is divided into multiple adjustment values, and the straight line fitting result is adjusted multiple times.

[0051] Table 3

[0052] Table 3 shows the correspondence between the number of adjustments and the lowest five bits of the PWM configuration value according to one embodiment of this application. The first column is the decimal number corresponding to the lowest five bits of the PWM configuration value, and the second column is the corresponding number of adjustments. Based on the symmetry of the total adjustment value within the same fitting interval, the number of adjustments also has a symmetrical relationship, and the number of adjustments is symmetrical about the median value of the lowest five bits of the PWM configuration value. For example, when the decimal number corresponding to the lowest five bits of the PWM configuration value increases from 0 to 15, the number of adjustments increases from 0 to 15; when the decimal number corresponding to the lowest five bits of the PWM configuration value increases from 16 to 31, the number of adjustments decreases from 15 to 0.

[0053] According to one embodiment, the number of adjustments is obtained based on the second part of the PWM configuration value. In one embodiment, the number of adjustments is obtained using the lowest four bits of the PWM configuration value, based on the symmetry of the number of adjustments within the same fitting interval. The reason for choosing the lowest four bits of the PWM configuration value to generate the initial value of the number of adjustments is that, regardless of the total number of bits in the PWM configuration value, the accuracy of generating the number of adjustments using the lowest four bits of the PWM configuration value within a fitting interval is already relatively high, basically meeting the usage requirements. Of course, users can adjust the number of bits in the PWM configuration value used to generate the initial value of the number of adjustments according to their needs within the scope protected by this application.

[0054] According to one embodiment of this application, based on the symmetry of the total adjustment value within the same fitting interval, the adjustment value used each time for adjustment also has a symmetrical relationship.

[0055] In one embodiment of this application, the LED dimming device includes a counter configured to cyclically accumulate counts starting from zero and output a count value. When the counter starts counting from zero, the PWM output is high until the count value reaches a dimming control value corresponding to the PWM configuration value, at which point the PWM output is low, thereby controlling the PWM duty cycle output. One or more adjustment values ​​are generated based on the count value, and the linear fitting result is adjusted multiple times based on these adjustment values ​​to obtain the final adjustment result, which is then used as the dimming control value. According to one embodiment, the counter can be a component already included in the electronic device containing the LED light-emitting element; therefore, the counter's operating state and value are not controlled by the dimming device but serve the electronic device as a whole. Here, it is only required that the binary counter's value has at least 4 bits. Of course, users can use other counters as needed and obtain the adjustment value using the counter's count value.

[0056] According to one embodiment, the adjustment process for the linear fitting result may include one or more stages. The number of adjustments for each stage is obtained based on the PWM configuration value. The sum of all adjustment values ​​used in each stage is the total adjustment value.

[0057] In some embodiments, during the counter counting process, different fitting intervals correspond to different algorithms. A first adjustment value is obtained based on different algorithms and the counter count value. The first stage adjustment can use the first adjustment value to adjust the straight line fitting result.

[0058] Table 4

[0059] Table 4 shows a list of first adjustment values ​​according to an embodiment of this application. In the counter pwm_cnt[4:0], the first column represents the decimal number corresponding to the lowest five digits of the count value, and the second column represents the lowest five digits of the count value. Columns 2 to 8 represent the first adjustment values ​​used for each adjustment from the seventh fitting interval to the first fitting interval, and the sum of the first adjustment values ​​used in all adjustments. The last row is the algorithm for the first adjustment values ​​corresponding to each fitting interval. During the counting process starting from zero, the first stage of curvature adjustment is performed during the counting process from 0 to 15, with the lowest four digits of the count value changing from 0000 (decimal number 0) to 1111 (decimal number 15).

[0060] According to one embodiment, each time the counter counts, a first adjustment value is generated based on the lowest four bits of the count value, and an adjustment is completed using the first adjustment value. Accordingly, each time an adjustment is completed, the number of adjustments is reduced by one.

[0061] The choice of the number of bits in the count value is related to the adjustment precision and is not limited to the lowest four bits. Here, the lowest four bits of the count value are chosen as the first adjustment value because the resulting precision already basically meets the usage requirements. Of course, users can adjust the number of bits used as the first adjustment value according to their needs within the scope protected by this application.

[0062] For example, when the count value is from 0 to 15, the first stage of adjustment is performed. The adjustment value algorithm corresponding to the PWM configuration value in the seventh fitting interval (224≤x≤255) is to invert the lowest four bits of the count value one by one. During the first adjustment of the PWM configuration value, the counter count is 0, and the decimal number corresponding to the first adjustment value is 15, based on the adjustment value algorithm. The cumulative decimal number corresponding to the first adjustment value is 15. During the second adjustment of the PWM configuration value, the counter count is 1, and the decimal number corresponding to the first adjustment value is 14. The cumulative decimal number corresponding to the first adjustment value after the two adjustments is 29. During the third adjustment of the PWM configuration value, the counter count is 2, and the decimal number corresponding to the first adjustment value is 13. The cumulative decimal number corresponding to the first adjustment value after the two adjustments is 42.

[0063] Figure 5 This is a flowchart of a curvature adjustment method according to one embodiment of the present application. According to one embodiment, the curvature adjustment method can be performed by an LED dimming device.

[0064] Step 501: Obtain the straight line fitting results and PWM configuration values.

[0065] Step 502: Obtain the initial value for the number of adjustments based on the second part of the PWM configuration value. This may specifically include steps 5021 to 5023.

[0066] Step 5021: Determine if the fifth bit from the least significant bit of the PWM configuration value is 0. If so, proceed to step 5022; otherwise, proceed to step 5023.

[0067] Step 5022: When the fifth bit from the least significant bit of the PWM configuration value is 0, set the initial value of the adjustment count to the decimal number corresponding to the lowest four bits of the PWM configuration value.

[0068] Step 5023: When the fifth bit from the least significant bit of the PWM configuration value is 1, set the initial value of the adjustment count to the decimal number corresponding to the result of inverting the least four bits of the PWM configuration value.

[0069] Step 503: Determine whether the initial value of the number of adjustments is 0 or whether the PWM configuration value is within the first fitting interval. If the initial value of the number of adjustments is not 0 and the PWM configuration value is within a fitting interval other than the first fitting interval, jump to step 505; if the initial value of the number of adjustments is 0 or the PWM configuration value is within the first fitting interval, jump directly to step 504 and use the straight line fitting result as the final adjustment result.

[0070] Step 505: Determine the fitting interval of the PWM configuration value based on the highest three bits of the PWM configuration value, obtain the first trimming value algorithm corresponding to the fitting interval, and obtain the first trimming value based on the first trimming value algorithm.

[0071] According to one embodiment, the straight line fitting result is set as the initial value of the first-stage adjustment result.

[0072] Step 506: Determine if the trimming enable signal is valid. If the trimming enable signal is valid, proceed to step 508 to perform the first stage of trimming; if the trimming enable signal is invalid at this time, proceed to step 507 to wait for the count value to be updated until the trimming enable signal is valid before proceeding to step 508.

[0073] According to one embodiment, when the lowest four bits of the counter's count value correspond to a decimal number of 0 and the adjustment count is not 0, the adjustment enable signal jumps from a disabled state to an enabled state and continues until the adjustment count reaches 0. After that, the adjustment enable signal jumps back to a disabled state. In this case, the LED dimming control device begins the first stage of adjustment of the linear fitting result.

[0074] According to another embodiment, when the number of adjustments is 0, the adjustment enable signal is in an invalid state.

[0075] Step 508: Obtain the first adjustment value based on the first adjustment value algorithm and the lowest four bits of the count value.

[0076] According to one embodiment, when the PWM configuration value is within the highest sequence fitting interval (e.g., the seventh fitting interval 224≤x≤255 in Table 4), the lowest four bits of the first adjustment value are the result obtained by inverting the lowest four bits of the count value bit by bit.

[0077] According to one embodiment, when the PWM configuration value is located in the highest-order fitting interval or other fitting intervals outside the second fitting interval, the lowest four bits of the count value are inverted bit by bit and shifted to the right to obtain the first adjustment value. The number of shifts is less than 4 and is the difference between the highest-order number and the sequence number of the fitting interval where the PWM configuration value is located. The remaining bits are 0. Specifically, when the PWM configuration value is located in the sixth fitting interval, the lowest three bits of the first adjustment value are obtained by inverting the second to fourth bits of the count value from the lowest bit, and the remaining bits are 0. When the PWM configuration value is located in the fifth fitting interval, the lowest two bits of the first adjustment value are obtained by inverting the third and fourth bits of the count value from the lowest bit, and the remaining bits are 0. When the PWM configuration value is located in the fourth and third fitting intervals, the lowest bit of the first adjustment value is obtained by inverting the fourth bit of the count value from the lowest bit, and the remaining bits are 0.

[0078] According to one embodiment, when the PWM configuration value is in the second fitting interval (e.g., the second fitting interval 64≤x<96 in Table 4), the result of performing a bitwise AND operation between the inverted fourth bit of the count value and the first bit of the count value is used as the least significant bit of the first adjustment value, and the remaining bits are 0.

[0079] Step 509: Update the correction result of the first stage. Update the correction result of the first stage with the difference between the correction result of the first stage and the first correction value.

[0080] Step 510: Update the number of adjustments in the first stage. Update the value after subtracting 1 from the number of adjustments to the number of adjustments.

[0081] According to one embodiment, a first adjustment value is obtained based on the fitting interval where the PWM configuration value is located and the current count value of the counter, and the first adjustment value is subtracted from the straight line fitting result one by one to obtain the adjustment result, and the number of adjustments is reduced accordingly.

[0082] Step 511: Determine if the number of adjustments in the first stage is equal to 0. If the number of adjustments is equal to 0, proceed to step 513; otherwise, proceed to step 508.

[0083] In some embodiments, the first stage of adjustment of the straight-line fitting result can meet the dimming requirements, and the adjustment result of the first stage can be used as the final adjustment result.

[0084] Alternatively, according to other embodiments, the adjustment of the straight-line fitting result may also include a second-stage adjustment, which uses a second adjustment value to adjust the adjustment result of the first-stage adjustment to obtain higher dimming accuracy.

[0085] Table 5

[0086] Table 5 shows a list of second adjustment values ​​according to one embodiment of this application. In this list, the first column of pwm_cnt[4:0] represents the decimal number corresponding to the lowest five digits of the count value, with values ​​increasing sequentially from 16 to 31; the second column represents the lowest five digits of the count value. Columns two through seven represent the second adjustment value and cumulative second adjustment value corresponding to the count value in each fitting interval from the seventh fitting interval to the first fitting interval. The last row of Table 5 is the algorithm for the second adjustment value corresponding to each fitting interval. According to one embodiment of this application, when adjusting the straight line fitting result, a first-stage adjustment is performed when the decimal number corresponding to the count value is 0-15; a second-stage adjustment is performed when the decimal number corresponding to the count value is 16-31.

[0087] In Table 5, for PWM configuration values ​​located in the seventh fitting interval (224 ≤ x ≤ 255), the second trim value is always 1 when the count value starts from 16 to 32, and the decimal value corresponding to the successively accumulated second trim value is 15. For PWM configuration values ​​located in the sixth fitting interval (192 ≤ x < 224), the second trim value is obtained by inverting the least significant bit of the count value. When the least significant bit of the count value is 0, the second trim value is 1; when the least significant bit of the count value is 1, the second trim value is 0. The decimal value corresponding to the successively accumulated second trim value is 8 when the count value starts from 16 to 32.

[0088] According to one embodiment, the adjustment result of the first stage adjustment is obtained as the initial value of the adjustment result of the second stage adjustment.

[0089] Step 513: Use the second adjustment value to perform a second-stage adjustment on the first-stage adjustment result.

[0090] For the highest sequence number fitting interval, the second stage of adjustment can be performed on the adjustment results of the first stage adjustment. The following two methods can be used.

[0091] In one embodiment, the second-stage adjustment is performed once. The difference between the first-stage adjustment result and the second adjustment value is used as the final adjustment result. That is, the first-stage adjustment result is adjusted once to obtain the final adjustment result. Here, the second adjustment value is the initial value for the number of adjustments.

[0092] In another embodiment, the adjustment result of the first stage is adjusted multiple times, with the second adjustment value being 1 in each adjustment. The number of adjustments is the same as the number of adjustments made during the first stage.

[0093] According to one embodiment, for fitting intervals other than the highest-indexed fitting interval, the first-stage adjustment result is adjusted multiple times using a second adjustment value. The second adjustment value is subtracted from the first-stage adjustment result each time to obtain the second-stage adjustment result, and the number of adjustments is reduced accordingly. The number of adjustments in the second stage can be the same as the number of adjustments in the first stage. The fitting interval containing the PWM configuration value is determined based on the highest three bits of the PWM configuration value, and the second adjustment value is obtained through a corresponding algorithm. When the difference between the fitting interval index of the PWM configuration value and the highest-indexed fitting interval index is 1 or 3, the second adjustment value is the inverted first bit of the count value. When the difference between the fitting interval index of the PWM configuration value and the highest-indexed fitting interval index is 2, the second adjustment value is the inverted second bit of the count value. When the difference between the fitting interval index of the PWM configuration value and the highest-indexed fitting interval index is 4, the second adjustment value is 0. When the difference between the sequence number of the fitting interval where the PWM configuration value is located and the sequence number of the highest fitting interval is equal to 5, and the decimal number corresponding to the lowest four bits of the count value from the low bit is 13, the second adjustment value is 1.

[0094] According to one embodiment, the sum of all first adjustment values ​​and all second adjustment values ​​is the total adjustment value.

[0095] Step 514: Take the adjustment result of the second stage adjustment as the final adjustment result and set it as the dimming control value.

[0096] Table 6 shows a list of two-stage adjustment examples for the highest sequence number fitting interval according to an embodiment of this application. The first column represents the decimal number corresponding to the PWM configuration value, which lies within the seventh fitting interval (224 ≤ x ≤ 255). The second column represents the decimal number corresponding to the lowest five digits of the PWM configuration value. The third column represents the number of adjustments obtained based on the PWM configuration value. The fourth column represents the total adjustment value after two-stage adjustment of the linear fitting result, which is the sum of all first adjustment values ​​and all second adjustment values. The fifth column represents the adjustment result of the first stage adjustment obtained by repeatedly reducing the first adjustment value of the linear fitting result, where the values ​​in each row of the formula represent the reduction of the first adjustment value each time from left to right. The sixth column represents the final adjustment result obtained by reducing the second adjustment value after reducing the adjustment result of the first stage adjustment.

[0097] Table 6

[0098] Taking the PWM configuration value of 225 in Table 6 as an example, its fifth binary digit from the least significant bit is 0. Based on its lowest four binary digits 0001, the initial value for the number of adjustments is 1. When the adjustment enable signal is valid, the first stage of adjustment is performed on the linear fitting result corresponding to the PWM configuration value 225. After obtaining the lowest four bits of the count value and inverting them bit by bit, the first adjustment value is 15. The linear fitting result corresponding to the PWM configuration value 225 is adjusted once, and the difference between the linear fitting result and the first adjustment value (corresponding decimal number 15) is taken as the adjustment result of the first stage. In the second stage of adjustment, the number of adjustments is 1, the second adjustment value is 1, and the difference between the adjustment result of the first stage and the second adjustment value is taken as the final adjustment result. The total decimal number corresponding to the first and second adjustment values ​​is 16. The lowest five bits of the PWM configuration value are different in different fitting intervals, and the corresponding adjustment values ​​are also different.

[0099] According to another embodiment of this application, the straight line fitting result can be first adjusted in the second stage as described above, and the adjustment result of the second stage can be adjusted in the first stage as described above, and the final adjustment result can be used as the dimming control value.

[0100] The steps of the above-mentioned linear fitting and curvature adjustment methods can be freely combined according to actual needs to obtain the dimming control value corresponding to the PWM configuration value.

[0101] According to one embodiment, when the counter outputs a count value of 0, the PWM signal jumps to a high level; when the count value reaches the dimming control value, the PWM signal jumps to a low level. At this time, the duty cycle of the PWM output is (exp_value+1) / 4096, where exp_value represents the dimming control value. In one embodiment, when the PWM configuration value increases from 0 to 255, the duty cycle of the PWM signal increases exponentially, and the brightness of the LED light increases uniformly. When the PWM configuration value decreases from 255 to 0, the duty cycle of the PWM signal decreases exponentially, and the brightness of the LED light decreases uniformly.

[0102] Without consuming any computing resources, the linear fitting result is obtained through the correspondence between the PWM configuration value and the linear fitting result. During the curvature adjustment process, only a subtractor / adder needs to be added to the original LED dimming device to complete the adjustment of the linear fitting result and obtain the final adjustment result, making the dimming curve formed by the final adjustment result smoother.

[0103] Figure 6 The figure shown is a schematic diagram of the curves before and after adjustment of the straight line fitting result according to an embodiment of this application. Figure 6The horizontal axis represents the PWM configuration value, and the vertical axis represents the adjustment result. Curve 1 is the curve formed by the straight-line fitting result, and curve 2 is the curve obtained after adjusting the straight-line fitting result. Figure 6 In this study, the LED dimming target curve obtained after adjusting the straight-line fitting results has a smoother transition and is more similar to an exponential curve.

[0104] Figure 7 The figure shown is a schematic diagram of dimming simulation results according to an embodiment of this application. The value of the PWM configuration value pwm_config[7:0] is 240 (the corresponding binary number is 11110000), and the value of the linear fitting result line_func[11:0] is 3072 (the corresponding binary number is 110000000000). Figure 7 In the process, the adjustment of the straight line fitting result includes the first stage adjustment and the second stage adjustment. The fifth binary number of the PWM configuration value is 1. The lowest four binary numbers of the PWM configuration value are inverted bit by bit to obtain the adjustment count value of 15. When the decimal number corresponding to the lower four bits of the count value pwm_cnt[3:0] is 0, the adjustment enable signal sub_en jumps to a high level. The lowest four bits of the count value are obtained and inverted bit by bit to obtain the first adjustment value 15. At this time, the decimal number corresponding to trim[3:0] is the first adjustment value, and the first adjustment value is 15. In the first stage adjustment process, the count value pwm_cnt[3:0] counts from 0 to 15. Based on the algorithm of the first adjustment value, the decimal numbers corresponding to the 15th first adjustment value are 15, 14, 13...2, 1. The first adjustment value is subtracted from the straight line fitting result 3072 to obtain the adjustment result 2952 of the first stage adjustment. When the lowest four bits of the count value, pwm_cnt[3:0], correspond to a decimal number of 16, the second stage of adjustment begins. In this case, the decimal number corresponding to trim[3:0] is the second adjustment value, which is 1. Subtracting the second adjustment value 15 times from the adjustment result of the first stage, 2952, yields the final adjustment result, exp_value[11:0], which corresponds to a decimal number of 2937. The duty cycle of the PWM signal output by the LED dimming device is (2937+1) / 4096.

[0105] This application also includes an electronic device comprising an LED dimming control device and an LED device. The LED dimming control device performs any of the dimming methods described above. The LED dimming configuration device includes a register and a counter. The counter is configured to cyclically count from zero and output a count value, the range of which is 0 to 4095.

[0106] In some embodiments, the original circuit of the LED dimming control device includes a register and a timer. The LED dimming control device only needs to add a subtractor to achieve real-time exponential adjustment results through cumulative subtraction.

[0107] The three commonly used exponential dimming methods in the prior art directly map PWM configuration values ​​to dimming control values ​​through complex calculations or table lookups, consuming significant computational or storage resources. The dimming method proposed in this application, based on linear fitting and curvature adjustment, combines linear fitting with real-time adjustment, reducing the consumption of storage and computational resources. It utilizes a more optimized algorithm to obtain highly accurate exponential adjustment results, exhibiting higher stability, higher accuracy, and faster processing speed, providing users with a more comfortable and refined visual experience.

[0108] The above embodiments are for illustrative purposes only and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the scope of the invention. Therefore, all equivalent technical solutions should also fall within the scope of the invention.

Claims

1. A dimming method based on linear fitting, comprising: Obtain a PWM configuration value, wherein the PWM configuration value is a binary number, and multiple fitting intervals are divided based on its possible value range; the sequence number of the fitting interval is a decimal number determined at least based on a first part of the PWM configuration value. The fitting interval is determined based on the first part of the PWM configuration value; The linear fitting result is obtained based on the PWM configuration value and the fitting interval; wherein... The number of bits in the straight line fitting result is greater than the number of bits in the PWM configuration value; Wherein, when the PWM configuration value is located in a fitting interval other than the first fitting interval, the linear fitting result corresponding to each PWM configuration value includes a first part, a second part and a third part from the least significant bit to the most significant bit; wherein the first fitting interval is the interval starting from the minimum value of the PWM configuration value; The straight line fitting result is a binary number with a fixed number of bits, the first part of which includes one or more 0s, wherein the number of 0s is the index of the fitting interval where the PWM configuration value is located minus 1; Its second part includes the value of the least X bit of the PWM configuration value, where X is an integer greater than or equal to 5; The least significant bit of its third part is 1, and the remaining bits are 0.

2. The method according to claim 1, wherein, When the PWM configuration value is within the first fitting interval, the PWM configuration value is used as the straight line fitting result.

3. The method according to claim 1, wherein, When the PWM configuration value is at its maximum value, the linear fitting result is a preset fixed value.

4. An electronic device comprising an LED dimming device, wherein, The LED dimming device is configured to perform the method described in any one of claims 1-3.

5. The electronic device according to claim 4 further includes an LED light-emitting element.

Citation Information

Patent Citations

  • System and method for non-linear dimming of a light source

    CN102026446A