A dimming method based on straight line fitting and table lookup

Through the dimming method based on linear fitting and table lookup and correction, the problem of low resource consumption and accuracy of the exponential dimming method in the existing technology is solved, and the high-precision exponential dimming effect is achieved, providing a more comfortable visual experience .

CN119255428BActive Publication Date: 2025-02-25LEN TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411769910.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-02-25
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

In the prior art, the exponential dimming method consumes a large amount of storage resources, has high computing difficulty, large computing delay and low accuracy.

Method used

The dimming method based on linear fitting and table lookup is adopted. By obtaining the PWM configuration value and dividing it into multiple fitting intervals, the linear fitting results are combined with the search for correction value table to obtain the final adjustment results.

Benefits of technology

It realizes that there is no consumption of computing resources, uses simple algorithms and a small amount of storage resources, and obtains high-precision exponential dimming effect, providing a more comfortable and delicate visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119255428B_ABST
    Figure CN119255428B_ABST
Patent Text Reader

Abstract

The present application relates to a dimming method based on straight-line fitting and table lookup adjustment, including obtaining a PWM configuration value and dividing a plurality of fitting intervals based on its possible value range; judging the fitting interval in which the PWM configuration value is located based on the first part of the content; obtaining a straight-line fitting result based on the PWM configuration value and the fitting interval in which the PWM configuration value is located; looking up the adjustment value table based on the second part of the content of the PWM configuration value to obtain the adjustment value corresponding to the highest-numbered fitting interval and use it as the initial value of the adjustment value; obtaining the multiple relationship of the adjustment value between the fitting interval in which the PWM configuration value is located and the highest-numbered fitting interval based on the first part of the content of the PWM configuration value; obtaining the adjustment value corresponding to the PWM configuration value based on the multiple relationship and the initial value of the adjustment value; applying the adjustment value corresponding to the PWM configuration value to the straight-line fitting result to obtain the final adjustment result. The present application also relates to an electronic device for executing the dimming method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of electrical control, and in particular to a dimming method based on straight line fitting and table lookup adjustment. Background Art

[0002] The brightness of a light-emitting diode (LED) can be achieved by adjusting the driving current of the LED. The pulse width modulation (PWM) dimming method can control the average driving current of the LED by changing the PWM switching duty cycle, thereby adjusting the brightness of the LED. The higher the PWM switching duty cycle, the higher the brightness; otherwise, the lower the switching duty cycle, the lower the brightness. The LED switching frequency is much higher than the recognition frequency of the human eye, so the human eye will not feel the flickering of the light, but only the brightness change. In practical applications, the LED needs to have a uniform brightness change, that is, a linear brightness change. However, due to the different sensitivity of the human eye to high brightness and low brightness, the human eye can only recognize the linear change of brightness when the switching duty cycle changes exponentially. In order to make the human eye have a more comfortable dimming experience, the exponential dimming method is widely used.

[0003] Existing exponential dimming methods include lookup table method, formula method, straight line fitting method, etc. The lookup table method can pre-set the PWM configuration value so that the relationship between the PWM configuration value and the high-level duration of the PWM signal conforms to the exponential mapping relationship. This method requires the storage of a large amount of data for table lookup output, which consumes a lot of storage resources. The formula method requires the use of a large number of multipliers or adders to perform complex calculations to achieve exponential dimming, which is difficult to implement, has a large calculation delay, and requires a large amount of computing resources; the straight line fitting method uses multiple straight lines to fit the exponential dimming curve, which requires a large amount of computing resources in the fitting process and has low accuracy. Summary of the invention

[0004] In view of the technical problems existing in the prior art, the present application proposes a dimming method based on straight-line fitting and lookup table adjustment, including obtaining a PWM configuration value, wherein the PWM configuration value is a binary number, and a plurality of fitting intervals are divided based on its value range, and the serial number of the fitting interval is a decimal number determined based on at least the first part of the content of the PWM configuration value; judging the fitting interval in which the PWM configuration value is located based on the first part of the content of the PWM configuration value; when the PWM configuration value is other than its maximum value and the fitting interval in which the PWM configuration value is located is the first fitting interval, obtaining a straight-line fitting result based on the PWM configuration value and the fitting interval in which the PWM configuration value is located; searching the adjustment value table based on the second part of the content of the PWM configuration value to obtain the adjustment value corresponding to the highest serial number fitting interval and using it as the adjustment value initial value; based on the first part of the PWM configuration value, obtain the multiple relationship of the adjustment value between the fitting interval in which it is located and the highest number fitting interval; based on the multiple relationship and the initial value of the adjustment value, obtain the adjustment value corresponding to the PWM configuration value; apply the adjustment value corresponding to the PWM configuration value to the straight line fitting result to obtain a final adjustment result, wherein the number of bits of the final adjustment result is greater than the number of bits of the PWM configuration value; wherein the first part of the PWM configuration value includes the highest N bits of the PWM configuration value; the second part of the PWM configuration value includes the remaining bits of the PWM configuration value except the highest N bits; wherein the sum of the number of bits of the first part and the second part of the PWM configuration value is the total number of bits of the PWM configuration value; N is an integer greater than or equal to 3.

[0005] In particular, the method, wherein, when the PWM configuration value is located in other fitting intervals except the first fitting interval, the straight line fitting result corresponding to each of the PWM configuration values ​​includes a first part, a second part and a third part in order from the lowest bit to the highest bit; wherein the first fitting interval is an interval starting with 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 serial number of the fitting interval where the PWM configuration value is located minus 1; the second part includes the value of the lowest X bits of the PWM configuration value, wherein X is an integer greater than or equal to 5; the lowest bit of the third part is 1, and if there are any remaining bits, they are 0.

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

[0007] In particular, in the method described, when the PWM configuration value is a maximum value, the direct fitting result is a preset fixed value.

[0008] In particular, the method described above obtains the multiple relationship of the adjustment value between the fitting interval where the PWM configuration value is located and the highest sequence number fitting interval by looking up the multiple relationship table, and the multiple relationship table includes the first part of the PWM configuration value and the corresponding multiple relationship value.

[0009] In particular, the method described herein, wherein obtaining the trimming value corresponding to the PWM configuration value based on the multiple relationship and the initial value of the trimming value, comprises: dividing the initial value of the trimming value by 2 and rounding down, wherein the number of divisions by 2 is determined based on the multiple relationship.

[0010] In particular, in the method described above, the adjustment values ​​corresponding to the highest-numbered fitting interval are symmetrically distributed in ascending order of PWM configuration values, and the adjustment value table only includes half of the adjustment values ​​in the symmetrical distribution, and the other half is obtained through a symmetrical relationship.

[0011] In particular, the method further includes, when the Xth bit from the lowest bit of the PWM configuration value is 0, searching the trimming value table based on the lowest X-1 bits of the PWM configuration value to obtain the initial value of the trimming value. When the Xth bit from the lowest bit of the PWM configuration value is 1, searching the trimming value table based on the result of bit-by-bit inversion of the lowest X-1 bits of the PWM configuration value to obtain the initial value of the trimming value.

[0012] In particular, in the method described above, when the fitting interval in which the PWM configuration value is located is a fitting interval other than the first and highest numbered fitting intervals, the initial value of the adjustment value is shifted rightward to obtain the adjustment value corresponding to the current PWM configuration value, and the number of shifts is determined based on the multiple relationship.

[0013] In particular, the method further includes, when the fitting interval where the PWM configuration value is located is the highest numbered fitting interval, setting the value of the final adjustment result to be the difference between the straight line fitting result and the initial value of the adjustment value.

[0014] In particular, the method further includes, when the PWM configuration value is its maximum value or the fitting interval in which it is located is the first fitting interval, setting the adjustment value to 0, and setting the value of the final adjustment result to the straight line fitting result.

[0015] The present application also relates to an electronic device, comprising an LED dimming device, wherein the LED dimming device is configured to execute any of the above methods.

[0016] Particularly, the electronic device further comprises an LED light emitting element.

[0017] The dimming method based on straight line fitting and table lookup adjustment proposed in the present application adopts a combination of straight line fitting and table lookup adjustment, does not consume computing resources, uses a simpler algorithm, consumes a small amount of storage, and realizes exponential dimming with higher precision. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Below, the preferred embodiments of the present application will be further described in detail with reference to the accompanying drawings, wherein:

[0019] Figure 1 Shown is a schematic diagram of an LED dimming target curve according to an embodiment of the present application;

[0020] Figure 2 The figure is a schematic diagram of a straight line fitting result curve according to an embodiment of the present application;

[0021] Figure 3 Shown is a flow chart of a straight line fitting method according to an embodiment of the present application;

[0022] Figure 4 The figure is a flow chart of a table lookup and adjustment method according to an embodiment of the present application;

[0023] Figure 5 The figure is a flow chart of a table lookup and adjustment method according to another embodiment of the present application;

[0024] Figure 6 Shown is a schematic diagram of a curve before and after adjustment of a straight line fitting result according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] In the following detailed description, reference may be made to the various specification drawings that are part of the present application and are used to illustrate specific embodiments of the present application. In the accompanying drawings, similar reference numerals describe substantially similar components in different figures. The various specific embodiments of the present application are described below in sufficient detail so that a person of ordinary skill in the art with relevant knowledge and skills in the art can implement the technical solutions of the present application. It should be understood that other embodiments may also be used or structural, logical or electrical changes may be made to the embodiments of the present application.

[0027] The technologies, methods and devices known to those skilled in the art may not be discussed in detail, but where appropriate, the technologies, methods and devices shall be considered as part of the specification. The lines between the units in the drawings are only for the convenience of explanation, indicating that at least the units at both ends of the lines are communicating with each other, and are not intended to limit the unconnected units from being unable to communicate. In addition, the number of lines between two units is intended to indicate at least the number of signals involved in the communication between the two units or at least the output terminals, and is not intended to limit the two units to only be able to communicate with each other through the signals shown in the figure.

[0028] Traditional straight line fitting methods either use calculation modules such as adders or multipliers to fit the LED dimming target curve, or use a lookup table to map PWM to the calculation value of an exponential function. In this process, a large number of calculation or storage units are consumed.

[0029] The dimming method based on straight-line fitting and table lookup adjustment proposed in the present application adopts a combination of straight-line fitting and table lookup adjustment, does not require consumption of computing resources, obtains a smoothly transitioned LED dimming target curve, and uses a small amount of storage resources to achieve high-precision exponential dimming. The method is simple, consumes little storage resources, and has high accuracy.

[0030] Figure 1 FIG. 4 is a schematic diagram of an LED dimming target curve according to an embodiment of the present application. Figure 1 The LED dimming target curve shown is an exponential curve. The horizontal axis represents the PWM configuration value, and its value 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, and its value is a decimal number corresponding to a 12-bit binary number. The LED dimming device generates a PWM signal of a corresponding duty cycle based on the dimming control value. In the LED dimming target curve, the larger the value of the PWM configuration value, the higher the duty cycle of the generated PWM signal, the higher the brightness of the LED, and the higher the slope of the curve; the smaller the value of the PWM configuration value, the lower the duty cycle of the generated PWM signal, the lower the brightness of the LED, and the lower the slope of the curve. According to one embodiment of the present application, the number of bits of the dimming control value is greater than the number of bits of the PWM configuration value.

[0031] Figure 2 FIG. 1 is a schematic diagram of a straight line fitting result curve according to an embodiment of the present application. The horizontal axis represents the PWM configuration value, and the vertical axis represents the straight line fitting result. Figure 2 As shown, the LED dimming target curve is fitted by M segments of linear functions, where M is an integer greater than or equal to 1.

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

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

[0034] In one embodiment of the present 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 to 255. With the minimum value of the PWM configuration value as the starting value, the PWM configuration value is divided into a plurality of fitting intervals in order of each 32 PWM configuration values. The dimming control value corresponding to the PWM configuration value in the fitting interval with the minimum value of the PWM configuration value as the starting value and a fitting interval adjacent thereto changes little, so these two fitting intervals can be combined as the first fitting interval. The first fitting interval includes PWM configuration values ​​0 to 31 and 32 to 63; the second fitting interval includes PWM configuration values ​​64 to 95; the third fitting interval includes PWM configuration values ​​96 to 127; the fourth fitting interval includes PWM configuration values ​​128 to 159; the fifth fitting interval includes PWM configuration values ​​160 to 191; the sixth fitting interval includes PWM configuration values ​​192 to 223; the seventh fitting interval includes PWM configuration values ​​224 to 254 and the maximum value 255 of the PWM configuration value. In the first fitting interval, as the PWM configuration value increases, the change of the dimming control value is relatively the slowest; from the second to the sixth fitting intervals, as the PWM configuration value increases, the change of the dimming control value gradually becomes faster; in the seventh fitting interval, as the PWM configuration value increases, the change of the dimming control value is the fastest relative to other fitting intervals.

[0035] According to one embodiment, within the fitting interval of each PWM configuration value, a straight line fitting is performed on the LED dimming target curve to obtain M linear functions based on different fitting intervals. The linear function can be modeled as:

[0036] Y=K(Xb)

[0037] Wherein, X represents the PWM configuration value. Y represents the straight line fitting result. K represents the slope of the linear function, and b represents the offset. In different fitting intervals, the modeled linear function has different slopes K, and the corresponding relationship between the PWM configuration value and the straight line fitting result is also different. In some embodiments of the present application, in two adjacent fitting intervals, the K value of the linear function fitted in the latter fitting interval is twice the K value of the linear function fitted in the previous 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 previous fitting interval.

[0038] In the following detailed description, the PWM configuration value includes an eight-bit binary number. Taking the minimum value of the PWM configuration value as the starting value, the value range of the PWM configuration value is divided into seven fitting intervals in sequence to illustrate the dimming method proposed in the present application. Among them, the first fitting interval is a fitting interval with the minimum PWM configuration value as the starting value, for example Figure 2 The first fitting interval (0 to 63) in the PWM configuration value of the highest numbered fitting interval has a starting value greater than the PWM configuration value contained in other fitting intervals, for example Figure 2 It can be understood that the fitting interval of the PWM configuration value can also be divided by taking the maximum value of the PWM configuration value as the starting point and dividing in the order of gradually decreasing PWM configuration values.

[0039] The PWM configuration value is divided into two parts, and the values ​​of the first part of the PWM configuration value corresponding to different fitting intervals are different. The decimal number determined by the content of the first part of the PWM configuration value can be used as the serial number of the fitting interval and the fitting interval where the PWM configuration value is located. The value of the first part of the PWM configuration value corresponding to the highest serial number fitting interval is the largest. The second part of the PWM configuration value corresponds to the sampling point of the adjustment value in a fitting interval. It can be understood that the first part and the second part of the PWM configuration value can include different bits, but the sum of the bits of the two parts is the sum of the bits of the PWM configuration value. For example, when the PWM configuration value is 9 digits, the PWM configuration value can be divided into 16 fitting intervals, and the upper four bits of the PWM configuration value in each fitting interval are the first part, and the values ​​of the first part of the PWM configuration value in different fitting intervals are different; the lower five bits of the PWM configuration value are the second part.

[0040] According to one embodiment, the first part of the PWM configuration value includes the highest N bits of the PWM configuration value; the second part of the PWM configuration value includes the remaining bits of the PWM configuration value except the highest N bits. The sum of the number of bits of the first part and the second part of the PWM configuration value is the total number of bits of the PWM configuration value, wherein N is an integer greater than or equal to 3.

[0041] 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 where the PWM configuration value is located, and the second part corresponds to the sampling point of the adjustment value in a fitting interval. Figure 2 For example, the highest three digits of the PWM configuration value included in the first fitting interval are 000 or 001. Except for the first fitting interval, the highest three digits of the PWM configuration values ​​included in other fitting intervals are the same. For example, when the highest three digits of the PWM configuration value are 010, the PWM configuration value is located in the second fitting interval; when the highest three digits of the PWM configuration value are 011, the PWM configuration value is located in the third fitting interval; when the highest three digits of the PWM configuration value are 100, the PWM configuration value is located in the fourth fitting interval; when the highest three digits of the PWM configuration value are 101, the PWM configuration value is located in the fifth fitting interval; when the highest three digits of the PWM configuration value are 110, the PWM configuration value is located in the sixth fitting interval; when the highest three digits of the PWM configuration value are 111, the PWM configuration value is located in the seventh fitting interval.

[0042] The reason why the lowest five bits of the PWM configuration value are selected as the sampling point of the trimming value is that no matter how many bits the total number of the PWM configuration value is, the accuracy of using the lowest five bits to sample the trimming value is relatively high, which basically meets the use requirements. Of course, the user can adjust the number of bits of the PWM configuration value used as the coordinates of the trimming value sampling point according to the needs within the scope of protection of this application.

[0043] Figure 3 The figure shows a flow chart of a straight line fitting method according to an embodiment of the present application. According to an embodiment, the straight line fitting method can be executed by an LED dimming device.

[0044] Step 301, obtaining PWM configuration value.

[0045] According to one embodiment, the PWM configuration values ​​may be specified by a user.

[0046] Step 302: determine the fitting interval of the PWM configuration value based on the highest three digits of the PWM configuration value.

[0047] Step 303: When the PWM configuration value is within the first fitting interval (eg Figure 2 When the linear fitting result is within the first fitting interval (0-63), the value of the linear fitting result is set to the current PWM configuration value.

[0048] According to one embodiment, the number of bits of the straight line fitting result is higher than the number of bits of the PWM configuration value.

[0049] Step 304, when the PWM configuration value is in other fitting intervals except the first fitting interval, the value of the straight line fitting result includes a first part, a second part and a third part from the lowest bit to the highest bit, wherein the first part includes one or more 0s, and the corresponding decimal number is 0, 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 lowest five bits of the PWM configuration value; the lowest bit of the third part is 1, and the remaining bits, if any, are 0.

[0050] According to an embodiment of the present application, based on the first part of the content of the PWM configuration value, for example, the highest three digits, the straight line fitting result can be generated by splicing in real time, or the first part and / or the third part of the straight line fitting result corresponding to the PWM configuration value in the fitting interval and the PWM configuration value in the fitting interval can be obtained by looking up a table. The advantage of obtaining part of the straight line fitting result by looking up a table is that the processing speed of this method is relatively high. Of course, those skilled in the art can obtain part of the straight line fitting result by other methods within the scope of protection of the present application.

[0051] Step 305: When the value of the PWM configuration value is the maximum value, the value of the straight line 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 the present application, the fixed value is a dimming control value corresponding to the maximum value of the PWM configuration value.

[0052] Table 1

[0053] Fitting interval x value range Formula y=K(xb) x[7:51 Minimum x value xMax Slope K Offset b Straight line fitting result algorithm 1 0≤X≤63 x 000 / 001 0000_0000 0011_1111 1 0 x 2 64≤X≤95 2(x-32) 010 0100_0000 0101_1111 2 0010_0000 {6'b000001,x[4:01,1'b0} 3 96≤X≤127 4(x-64) 010 0110_0000 0111_1111 4 0100_0000 {5'b00001,x[4:0],2'b00} 4 128≤X≤159 8(x-96) 011 1000_0000 1001_1111 8 0110_0000 {4'b0001,x[4:0],3'b000} S 160≤X≤191 16(x-128) 101 1010_0000 1011_1111 16 1000_0000 {3'b001,x[4:0],4'b0000} 6 192≤X≤223 32(x-160) 110 1100_0000 1101_1111 32 1010_0000 {2'b01, x[4:0], 5'b00000} 7 224≤X≤254 64(x-192) 111 1110_0000 1111_1110 64 1100_0000 {1′b1,x[4:01,6′b000000} 7 x=255 4095 111 1111_1111 1111_1111 128 none 4095

[0054] Table 1 shows a list of correspondences between various fitting intervals and their straight-line fitting results according to an embodiment of the present 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 straight-line fitting result algorithm corresponding to each fitting interval. The straight-line 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 straight-line fitting result corresponding to the PWM configuration value is itself.

[0055] In Table 1, when the highest three digits of the PWM configuration value are 111, it is determined that the PWM configuration value is located in the seventh fitting interval (224≤X≤254), the linear function corresponding to the fitting interval is Y=64(X-192), the slope of the linear function is 64, the offset is 192 (the corresponding binary number is 11000000), and the minimum and maximum values ​​of the PWM configuration value are 11100000 and 11111110 respectively. The number of 0s included in the first part of the straight line fitting result corresponding to the PWM configuration value is seven minus one, the second part includes the lowest five digits of the PWM configuration value, and the third part includes one 1, a total of 12 binary digits. When the highest three digits of the acquired PWM configuration value are 110, the PWM configuration value is located in the sixth fitting interval (192≤X≤223), the number of 0s included in the first part of the straight line fitting result corresponding to the PWM configuration value is six minus one, the second part includes the lowest five digits of the PWM configuration value, the lowest bit of the third part is 1, and the remaining bits are 0; and so on. When the highest three digits of the acquired PWM configuration value are 000 or 001, the PWM configuration value is in the first fitting interval (0≤X≤63), and the straight line 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, the corresponding straight line fitting result is 4095.

[0056] In the straight line fitting process, registers are used to store the correspondence between a small amount of PWM configuration values ​​and straight line fitting results. The straight line fitting results corresponding to the PWM configuration values ​​can be obtained without the need for arithmetic logic units, which greatly reduces the consumption of circuit computing resources and storage resources.

[0057] In order to improve the fitting accuracy, after obtaining the straight line fitting result of the PWM configuration value, the straight line fitting result is adjusted using the adjustment value to obtain the adjustment result corresponding to the PWM configuration value, and the adjustment result is used as the dimming control value to control the duty cycle of the PWM signal, and the straight line obtained by the straight line fitting is adjusted to a smoother exponential curve. The method for obtaining the straight line fitting result of the LED dimming target curve is not limited to the straight line fitting method proposed in the above embodiment, and can also be other methods.

[0058] In a fitting interval, the straight line fitting result is adjusted by obtaining the adjustment value corresponding to each sampling point to obtain the adjustment result. According to one embodiment, a corresponding relationship is established between the second part of the PWM configuration value, such as the lowest five bits, and the corresponding adjustment value, and the straight line fitting result corresponding to the PWM configuration value is adjusted using the adjustment value.

[0059] Table 2

[0060]

[0061] Table 2 shows a list of the correspondence between the lowest five bits of the PWM configuration value and the trimming value according to an embodiment. The first column in the lowest five bits of the PWM configuration value pwm_config[4:0] represents the decimal number corresponding to the lowest five bits of the PWM configuration value, and the second column in the lowest five bits of the PWM configuration value pwm_config[4:0] represents the lowest five bits of the PWM configuration value. The first to seventh columns of the trimming value trim_value represent the fitting intervals divided based on the value range of the PWM configuration value, and the trimming value corresponding to the PWM configuration value in each fitting interval, where the trimming value is a decimal number. For example, in the seventh fitting interval 224≤x≤255, when the lowest five bits of the PWM configuration value are 01000, the corresponding trimming value is a decimal number 100. In different fitting intervals, the trimming values ​​corresponding to different PWM configuration values ​​are different. The trimming value corresponding to the PWM configuration value in the highest numbered fitting interval is greater than the trimming value corresponding to the PWM configuration value in other fitting intervals.

[0062] In the list of adjustment values ​​in Table 2, the adjustment values ​​corresponding to two adjacent fitting intervals have a multiple relationship. For the lowest five bits of the same PWM configuration value, the adjustment value corresponding to the higher-order fitting interval is divided by 2 and rounded down to obtain the adjustment value corresponding to the lower-order fitting interval. For example, the adjustment value corresponding to the PWM configuration value in the fitting interval 192≤x<224 can be obtained by dividing the adjustment value corresponding to the PWM configuration value in the fitting interval 224≤x≤255 by 2 and rounding down.

[0063] As can be seen from the above, based on the multiple relationship of the adjustment values ​​between adjacent fitting intervals, the adjustment value corresponding to the PWM configuration value in the preset highest number fitting interval is saved in the adjustment value table of the LED dimming device, and used as the initial value of the adjustment value. Based on the lowest five bits of the current PWM configuration value, the initial value of the adjustment value is obtained by searching the adjustment value table, and the initial value of the adjustment value is divided by 2 and rounded down multiple times to obtain the adjustment value of the current PWM configuration value. According to other embodiments, this division operation can be achieved by shifting the binary number to the right. Based on the adjustment value table, there is no need for computing resources such as a divider or a multiplier, and only a register is needed to obtain the curve adjustment result. For example, the LED dimming device only stores the adjustment value corresponding to the PWM configuration value of the seventh fitting interval 224≤x≤255 in Table 1.

[0064] In the list of trim values ​​shown in Table 2, the trim values ​​are symmetrical within any fitting interval. When the lowest five bits of the PWM configuration value change from small to large, the trim values ​​are symmetrical about the middle value of the PWM configuration value within the fitting interval. Within a fitting interval, based on the binary number of the fifth bit of the PWM configuration value, the lowest five bits of the PWM configuration value can be divided into two categories: the fifth bit is 0 and the fifth bit is 1. The trim value ranges of the two categories are the same but the change trends are opposite. For example, in the seventh fitting interval 224≤x≤255, the value of the fifth bit of the PWM configuration value 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 trimming value changes from the minimum trimming value (0) to the maximum trimming value (135); in the second category (10000-11111), the lowest four bits of the PWM configuration value change from 0000 to 1111, and the corresponding trimming value changes from the maximum trimming value (135) to the minimum trimming value (0). At this time, the result of inverting the lowest four bits in the second part of the PWM configuration value bit by bit and matching it with the trimming value can obtain the same result as the first category. 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 lower four bits are used to determine the trimming value sampling point in the fitting interval.

[0065] Here, the reason why the lowest four bits of the PWM configuration value are selected as the sampling point of the trimming value is that no matter how many bits the total number of the PWM configuration value is, within a fitting interval, the accuracy of using the lowest four bits to sample the trimming value is relatively high, which basically meets the use requirements. Of course, the user can adjust the number of bits of the PWM configuration value used as the sampling coordinate of the trimming value according to the needs within the scope of protection of this application.

[0066] According to one embodiment, the adjustment value can be set by the user according to actual needs, and the adjustment values ​​of different fitting intervals satisfy the above-mentioned multiple relationship and symmetry.

[0067] Figure 4 The flowchart of the table lookup adjustment method according to one embodiment of the present application is shown. According to one embodiment, the table lookup adjustment method can be executed by an LED dimming device.

[0068] Step 401, obtaining straight line fitting results and PWM configuration values.

[0069] Step 402 , determine whether the PWM configuration value is its maximum value or whether the fitting interval is the first fitting interval (eg, fitting interval 0≤x<64). If yes, execute step 403 , otherwise execute step 404 .

[0070] Step 403, setting the adjustment value to 0, and setting the straight line fitting result as the final adjustment result.

[0071] Step 404, obtain the lowest five bits of the PWM configuration value, look up the adjustment value table to obtain the corresponding adjustment value, and use the adjustment value as the initial value of the adjustment value.

[0072] In one embodiment, in the adjustment value table of the LED dimming device, only the corresponding relationship between the lowest five bits of the PWM configuration value in the highest numbered fitting interval and its adjustment value can be saved, and the adjustment value of the highest numbered fitting interval is used as the initial adjustment value. For example, the adjustment value in the fitting interval 224≤x≤255 in Table 2.

[0073] Step 405, determine whether the fitting interval where the PWM configuration value is located is the highest number fitting interval (eg, fitting interval 224≤x≤255). If the fitting interval where the PWM configuration value is located is the highest number fitting interval, execute step 406, otherwise execute step 407.

[0074] Step 406 , taking the initial value of the adjustment value as the final adjustment value, and jumping to step 409 .

[0075] Step 407: When the fitting interval where the PWM configuration value is located is a fitting interval other than the highest numbered fitting interval, the multiple relationship table is searched based on the highest three digits of the PWM configuration value to obtain the multiple relationship between the adjustment value of the fitting interval where the PWM configuration value is located and the adjustment value of the highest numbered fitting interval. The value of the multiple relationship is 2 W , W is an integer greater than or equal to 1.

[0076] According to one embodiment, when the highest three digits of the PWM configuration value are 110, the value of W is 1, and the multiple relationship is 2. When the highest three digits of the PWM configuration value are 101, the value of W is 2, and the multiple relationship is 4.

[0077] Step 408 , based on the multiple relationship and the initial value of the trimming value, the initial value of the trimming value is shifted rightward to obtain a final trimming value corresponding to the PWM configuration value, and the number of shifts is W.

[0078] According to one embodiment, when the highest three digits of the PWM configuration value are 110, the adjustment value of the highest numbered fitting interval is twice the adjustment value of the fitting interval where the PWM configuration value is located, and the number of times the initial value of the adjustment value is shifted to the right is 1. When the highest three digits of the PWM configuration value are 101, the adjustment value of the highest numbered fitting interval is four times the adjustment value of the fitting interval where the PWM configuration value is located, and the number of times the initial value of the adjustment value is shifted to the right is 2. When the highest three digits of the PWM configuration value are 100, the adjustment value of the highest numbered fitting interval is eight times the adjustment value of the fitting interval where the PWM configuration value is located, and the number of times the initial value of the adjustment value is shifted to the right is 3; when the highest three digits of the PWM configuration value are 011, the adjustment value of the highest numbered fitting interval is 16 times the adjustment value of the fitting interval where the PWM configuration value is located, and the number of times the initial value of the adjustment value is shifted to the right is 4; when the highest three digits of the PWM configuration value are 010, the adjustment value of the highest numbered fitting interval is 32 times the adjustment value of the fitting interval where the PWM configuration value is located, and the number of times the initial value of the adjustment value is shifted to the right is 5.

[0079] Step 409, setting the adjustment result to the difference between the straight line fitting result and the final adjustment value corresponding to the PWM configuration value.

[0080] In another embodiment of the present application, the trimming values ​​corresponding to half of the PWM configuration values ​​in the highest numbered fitting interval are saved in the trimming value table of the LED dimming device and used as the initial values ​​of the trimming values. Based on the symmetry of the trimming values ​​corresponding to the PWM configuration values ​​in the same fitting interval, the trimming values ​​corresponding to the other half of the PWM configuration values ​​are obtained. The trimming values ​​of the PWM configuration values ​​in other fitting intervals are obtained by using the multiple relationship between the fitting intervals.

[0081] Figure 5 FIG. 4 is a flow chart of a table lookup and adjustment method according to another embodiment of the present application.

[0082] Step 501, obtaining straight line fitting results and PWM configuration values.

[0083] Step 502, determine whether the PWM configuration value is the maximum value or whether the fitting interval in which it is located is the first fitting interval (for example, the fitting interval 0≤x<64). If so, execute step 503, set the adjustment value to 0, and set the straight line fitting result as the final adjustment result. Otherwise, execute step 504.

[0084] Step 504 , determining whether the fifth bit from the lowest bit of the PWM configuration value is 0, if so, executing step 506 ; otherwise, executing step 505 .

[0085] According to one embodiment, in the adjustment value table of the LED dimming device, only the adjustment value corresponding to the PWM configuration value in the highest number fitting interval when the fifth bit from the lowest bit is 0 can be saved and used as the initial value of the adjustment value. For example, when the fifth bit from the lowest bit of the PWM configuration value is 0, the adjustment value corresponding to the PWM configuration value.

[0086] Of course, the adjustment value table of the LED dimming device may also store the PWM configuration value, for example, the adjustment value corresponding to the PWM configuration value when the fifth bit from the lowest bit is 1. In this case, those skilled in the art only need to make simple adjustments to the above steps to obtain the adjustment value corresponding to the PWM configuration value.

[0087] Step 505 , when the fifth bit from the lowest bit of the PWM configuration value is 1, the trimming value table is searched based on the result of bit-by-bit inversion of the lowest four bits of the PWM configuration value to obtain the trimming value, and the trimming value is used as the initial value of the trimming value.

[0088] Step 506 : when the fifth bit from the lowest bit of the PWM configuration value is 0, the trimming value table is searched based on the lowest four bits of the PWM configuration value to obtain the trimming value, and the trimming value is used as the initial value of the trimming value.

[0089] Step 507, determine whether the fitting interval where the PWM configuration value is located is the highest number fitting interval (eg, fitting interval 224≤x≤255). If the fitting interval where the PWM configuration value is located is the highest number fitting interval, execute step 508, otherwise execute step 509.

[0090] Step 508 , taking the initial value of the adjustment value as the final adjustment value, and jumping to step 509 .

[0091] Step 509: When the fitting interval where the PWM configuration value is located is a fitting interval other than the highest numbered fitting interval, the multiple relationship table is searched based on the highest three digits of the PWM configuration value, and the multiple relationship between the adjustment value of the fitting interval where the PWM configuration value is located and the adjustment value of the highest numbered fitting interval is obtained. The value of the multiple relationship is 2 W , W is an integer greater than or equal to 1.

[0092] Step 510 , based on the multiple relationship and the initial value of the trimming value, the initial value of the trimming value is shifted rightward to obtain a final trimming value corresponding to the PWM configuration value, and the number of shifts is W.

[0093] Step 511, setting the adjustment result to the difference between the straight line fitting result and the final adjustment value corresponding to the PWM configuration value, and using the adjustment result as the dimming control value.

[0094] The execution order of the above dimming method can be adjusted by the user according to the requirements within the scope of protection of this application.

[0095] Without consuming any computing resources, the straight line fitting result is obtained through the corresponding relationship between the PWM configuration value and the straight line fitting result. With very few computing resources, the straight line fitting result is adjusted to obtain the adjustment result, so that the dimming curve formed by the final adjustment result is smoother.

[0096] Figure 6 Shown is a schematic diagram of a curve before and after adjustment of a straight line fitting result according to an embodiment of the present application. Figure 6 The 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 the figure, the LED dimming target curve obtained after adjusting the straight line fitting result has a smoother transition and is more similar to an exponential curve.

[0097] The present application also includes an electronic device, including an LED dimming control device and an LED device. The LED dimming control device performs any of the above-mentioned exponential dimming methods. The LED dimming configuration device includes a register and a counter. The counter is configured to count cyclically from zero and output a count value, and the count value output by the counter ranges from 0 to 4095.

[0098] In some embodiments, the original circuit of the LED dimming control device includes a register and a timer, and the LED dimming control device only needs to add an additional subtractor to obtain the exponential adjustment result in real time through cumulative subtraction operation.

[0099] The three commonly used exponential dimming methods in the prior art directly correspond the PWM configuration value to the dimming control value through complex calculations or table lookups, which consumes a lot of computing resources or storage resources. The dimming method based on straight line fitting and table lookup adjustment proposed in this application adopts a combination of straight line fitting and real-time adjustment, consumes less computing and storage resources, and uses a more concise method to obtain a higher precision exponential adjustment result, which has higher stability and higher precision, and provides users with a more comfortable and delicate visual experience.

[0100] The above embodiments are only used to illustrate the present invention, but not to limit the present invention. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the scope of the present invention. Therefore, all equivalent technical solutions should also fall within the scope of the present invention.

Claims

1. A dimming method based on straight line fitting and table lookup adjustment, comprising: Acquire a PWM configuration value, wherein the PWM configuration value is a binary number, and a plurality of fitting intervals are divided based on its value range, and the sequence number of the fitting interval is a decimal number determined based on at least a first part of the PWM configuration value; Determine the fitting interval based on the first part of the PWM configuration value; When the PWM configuration value is other than its maximum value and the fitting interval in which it is located is the first fitting interval, a straight line fitting result is obtained based on the PWM configuration value and the fitting interval in which it is located; Based on the second part of the PWM configuration value, the adjustment value table is searched to obtain the adjustment value corresponding to the highest number fitting interval and used as the initial value of the adjustment value; When the fitting interval where the PWM configuration value is located is the highest numbered fitting interval, setting the value of the final adjustment result to be the difference between the straight line fitting result and the initial value of the adjustment value; The number of bits of the final adjustment result is greater than the number of bits of the PWM configuration value; the first part of the PWM configuration value includes the highest N bits of the PWM configuration value; the second part of the PWM configuration value includes the remaining bits of the PWM configuration value except the highest N bits; the sum of the number of bits of the first part and the second part of the PWM configuration value is the total number of bits of the PWM configuration value; N is an integer greater than or equal to 3.

2. The dimming method according to claim 1, wherein: When the PWM configuration value is located in other fitting intervals except the first fitting interval, the straight line fitting result corresponding to each of the PWM configuration values ​​includes a first part, a second part and a third part in order from the lowest bit to the highest bit; wherein the first fitting interval is an 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, where the number of 0s is the serial 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, where X is an integer greater than or equal to 5; The least significant bit of the third part is 1, and the remaining bits, if any, are 0.

3. The dimming method according to claim 1, wherein: When the PWM configuration value is in the first fitting interval, the PWM configuration value is used as the straight line fitting result.

4. The dimming method according to claim 1, wherein: When the PWM configuration value is a maximum value, the straight line fitting result is a preset fixed value.

5. The dimming method according to claim 1, wherein: When the fitting interval where the PWM configuration value is located is other fitting intervals except the first fitting interval and the highest numbered fitting interval, Based on the first part of the PWM configuration value, a multiple relationship between the fitting interval in which the first part of the PWM configuration value is located and the fitting interval with the highest sequence number is obtained; Obtaining a trimming value corresponding to the PWM configuration value based on the multiple relationship and the initial value of the trimming value; The final trimming result value is set to be the difference between the straight line fitting result and the trimming value corresponding to the PWM configuration value.

6. The dimming method according to claim 5, wherein: The multiple relationship of the adjustment value between the fitting interval where the PWM configuration value is located and the highest numbered fitting interval is obtained by searching a multiple relationship table, wherein the multiple relationship table includes the first part of the PWM configuration value and the corresponding multiple relationship value.

7. The dimming method according to claim 6, wherein: Obtaining the trimming value corresponding to the PWM configuration value based on the multiple relationship and the initial value of the trimming value includes: The initial value of the trimming value is divided by 2 and then rounded down, wherein the number of divisions by 2 is determined based on the multiple relationship.

8. The dimming method according to claim 5, wherein: The adjustment values ​​corresponding to the highest numbered fitting interval are symmetrically distributed in ascending order of the PWM configuration values, and the adjustment value table only includes half of the adjustment values ​​in the symmetrical distribution, and the other half is obtained through a symmetrical relationship.

9. The dimming method according to claim 8, further comprising: When the Xth bit from the lowest bit of the PWM configuration value is 0, searching the adjustment value table based on the lowest X-1 bits of the PWM configuration value to obtain the initial value of the adjustment value; When the Xth bit from the lowest bit of the PWM configuration value is 1, the initial value of the trimming value is obtained by searching the trimming value table based on the result of bit-by-bit inversion of the lowest X-1 bits of the PWM configuration value.

10. The dimming method according to claim 6 or 9, wherein: When the fitting interval where the PWM configuration value is located is a fitting interval other than the first and highest numbered fitting intervals, the initial value of the trimming value is shifted rightward to obtain the trimming value corresponding to the current PWM configuration value, and the number of shifts is determined based on the multiple relationship.

11. The dimming method according to claim 1 further comprises, when the PWM configuration value is its maximum value or the fitting interval in which it is located is the first fitting interval, setting the adjustment value to 0 and setting the value of the final adjustment result to the straight line fitting result.

12. An electronic device, comprising an LED dimming device, wherein: The LED dimming device is configured to execute the dimming method described in any one of claims 1-11. The electronic device according to claim 12 , further comprising an LED light emitting element.

Citation Information

Patent Citations

  • LED instantaneous light flux test method and apparatus in PWM activation technology

    CN101430223A

  • Dimming curve correction method and unit, LED lighting device and storage medium

    CN111163558A