APPLICATION NOTE 4253

PWM Intensity Control for the MAX6964 LED Driver

By: Walter Chen

Abstract: The following application note describes the unique features of the MAX6964 LED driver and how these features can be utilized properly in applications requiring intensity control. The application note also provides example programming routines showcasing the intensity-control selections for both master and individual port selections of the MAX6964. The features of LED intensity control are particularly valuable in automotive applications, in which LED intensity adjustment is required for daytime and nighttime conditions.

The MAX6964 is a high-output-current, 17-port LED driver with 8-bit, pulse-width-modulated (PWM) intensity control. Each individual port allows up to 50mA sinking current. The maximum combined total sinking current through the ground pin is limited at 350mA. The 8-bit PWM intensity control is divided into 4 bits of master control applied to all ports and 4 bits of individual port control. The master intensity control can be used to adjust the general-equipment LED intensity in response to ambient lighting condition changes, such as those in an automobile during daytime and nighttime conditions. Individual port control can then be used to produce desired intensities according to their application needs. Alternatively, 4 global control bits can be used instead to simultaneously control all individual port intensities. Bits D0 through D3 of register 0x0E can be used for global or port O16 intensity control. Also, the master and individual intensity controls can be combined to produce fading effects on all ports.

It is commonly known that human eyes perceive an object as being continuously lit if the light source is turned on/off fast enough. The PWM intensity control changes the perceived intensity by varying the turn-on time while keeping the on/off frequency at a fixed rate. To avoid flickering effects, the PWM on/off frequency usually needs to be higher than 100Hz. The MAX6964's PWM intensity control is driven by an internal oscillator with a nominal frequency of 32kHz. The MAX6964's PWM period lasts for 240 clock cycles, resulting in a PWM on/off frequency of 32000/240 = 133.33Hz.

The intensity of an LED connected to a MAX6964 output is dependent on the overlapped on-times (logic-low) of both master and individual port controls when the corresponding polarity bits are 0.

The MAX6964's master intensity control is determined by bits D7–D4 of register 0x0F. These four master-control bits divide the PWM period into 15 time slots. Master time on-slots are 1/15th, 2/15th, ..., 13/15th, and 14/15th for bit patterns of 0001, 0010, ..., 1101, and 1110 respectively.

Individual port control bits, in groups of 4 for each port, are located in registers 0x10 to 0x17. Port 16 control bits are at D3 through D0 of register 0x0F. These bits (D3–D0) of register 0x0F are also used for global control, if that option is enabled. Each master time slot consists of 16 internal oscillator clock cycles. These clock cycles can be activated for 1/16th, 2/16th, ..., 15/16th, and 16/16th with bit patterns of 0000, 0001, ..., 1110, and 1111 respectively.

Figure 1 shows the port's output waveform for a master on-time of 2/15th corresponding to a bit pattern of 0010, and an individual port's on-time of 2/16th corresponding to a bit pattern of 0001, when the polarity bit is 0. There are two master on-time slots available, and both of them are on for 2/16th, as determined by the individual port's on-time.

Figure 1. A port's output waveform.
Figure 1. A port's output waveform.

Phase 0 polarity bits for ports 7 through 0 and ports 15 through 8 are located in registers 0x02 and 0x03, respectively. Likewise, phase 1 polarity bits for ports 7 through 0 and ports 15 through 8 can be found in registers 0x0A and 0x0B. Polarity for port 16 is indicated by the phase 1 (D5) and phase 0 (D4) bits of register 0x0F. Only phase 0 polarity bits are relevant when the blinking feature is not enabled.

Figure 2 shows the port's output waveform with the same master and individual port bit patterns of 0010 and 0001, but a polarity bit of 1. Comparing Figures 1 and 2, it can be observed that the on and off times are reversed—they form complementary waveforms. It is best to program the intensity level with a polarity of 0, but a polarity of 1 is necessary for blinking.

Figure 2. A one's complementary waveform.
Figure 2. A one's complementary waveform.

LEDs driven by the MAX6964 can be made to blink (on and off) by toggling the BLINK input, or by flipping the blink flip bit (D1 of register 0x0F). The blink enable bit (D0 of register 0x0F) must be set to 1 to activate the BLINK input and the blink flip bit. A host controller needs to change the BLINK input logic level or write to the MAX6964 for every blinking event. When blinking is enabled (D0 = 1), the LED polarity of a particular port is related to either phase 0 or phase 1, depending on if the exclusive OR of the BLINK input and the blink flip bit equals 0 or 1.

To activate blinking for a desired port, corresponding phase 0 and 1 polarity bits must be different. Because the PWM intensity control is still functioning when the blinking is enabled, a blinking LED can be not only turned on and off, but can also be controlled to switch intensities between lighter and darker modes based on normal and complementary waveforms. Furthermore, by selecting phases 0 and 1 logic levels for different ports individually, they can be made to blink at opposite phases or not to blink at all. For example, setting the port 1 phase 0 bit to 0 and phase 1 bit to 1, and the port 2 phase 0 bit to 1 and phase 1 bit to 0, will make them blink in opposite phases. Setting both of the port's phase 0 and phase 1 bits to 0 or 1 will make the port stay in either a lighter or a darker mode.

Figure 3 shows the blinking of phase 0 and phase 1 between the original and its complementary waveforms. The time durations of phase 0 and phase 1 are dependent on the action of the host controller, and usually last much longer than a single PWM period to make the blinking event noticeable.

Figure 3. Blinking between phase 0 and phase 1.
Figure 3. Blinking between phase 0 and phase 1.

The following are examples of I²C command sequences sent to the MAX6964 to turn on LEDs at certain PWM intensity levels.

The following three I²C write commands can be used to turn on the O16 LED at its minimum intensity level. The I²C device address of the MAX6964 is 0x49.
0x49 0x0F 0x30                  // Turn off the global bit
0x49 0x0E 0x10                  // Select 1/15th for master and 1/16th
                                // for O16
0x49 0x0F 0x00                  // Set phase 0 and 1 polarity bits of 
                                // O16 to 00
The following I²C write commands can be used to turn on all LEDs at their minimum intensity level.
0x49 0x0F 0x30                  // Turn off the global bit
0x49 0x0E 0x10                  // Select 1/15th for master and 1/16th for O16
0x49 0x0F 0x00                  // Set phase 0 and 1 polarity bits of O16 to 00
0x49 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 // Set 1/16th for all ports
0x49 0x02 0x00 0x00             // Set phase 0 polarity bits for all ports
The last two commands have utilized the register address auto-increment feature, which allows writing to multiple registers using a single write command.

Sometimes LEDs need to be turned on gradually during power-up. The intensity of LEDs can be adjusted from low to high by setting the master control from low to high and, at each master setting, changing the individual port control from low to high. Because some master and individual port combinations produce the same or similar intensity level, not all settings are necessary to produce an increase in intensity. At high intensity levels, some lower individual port settings must be skipped (Table 1). As some duplicate or similar intensity levels are skipped, the increase in intensity level is based on a double loop (master intensity change as one loop and individual port as the second loop). Table 1 shows only 59 steps of a total of 240 available combinations.

Table 1. Double-Loop Increasing Trend
Individual Master Intensity Individual Master Intensity
X 0 0 C 4 52
0 1 1 D 4 56
1 1 2 E 4 60
2 1 3 F 4 64
3 1 4 C 5 65
4 1 5 D 5 70
5 1 6 E 5 75
6 1 7 F 5 80
7 1 8 D 6 84
8 1 9 E 6 90
9 1 10 F 6 96
A 1 11 D 7 98
B 1 12 E 7 105
C 1 13 F 7 112
D 1 14 E 8 120
E 1 15 F 8 128
F 1 16 E 9 135
8 2 18 F 9 144
9 2 20 E A 150
A 2 22 F A 160
B 2 24 E B 165
C 2 26 F B 176
D 2 28 E D 195
E 2 30 F D 208
F 2 32 E E 210
A 3 33 F E 224
B 3 36 E F 225
C 3 39 F F 240
D 3 42      
E 3 45      
F 3 48      

The following text is a pseudo-programming code to turn on LEDs gradually in LoopLength x WaitTime seconds. The I²C routine issues a write command to a MAX6964 register that has a specific intensity defined by the array. Multiple writes can also be accommodated with the register address auto-increment feature.
LoopLength;                             // Total number of step in the increase in 
                                        // intensity 
MasterPort(2, LoopLength);              // Array for master/port setting pairs of every 
                                        // step
StepTime;                               // Lighting duration at each intensity step
For i = 1 to LoopLength                 // Start intensity increasing loop
I²C(Write, 0x0E, MasterPort(1, i));        // Set master intensity level
I²C(Write, 0x10, MasterPort(2, i), MasterPort(2, i), ...); // Set port 
                                        // intensity 
                                        // levels
Wait(StepTime);                         // Lighting up
End                                     // End loop
The LED-intensity level is dependent on both master and individual port PWM control bit selections. A certain intensity level might be replicable by two different master and individual port combinations. On the other hand, some intensity levels may not be produced by any combination. Table 2 shows available intensity levels in accordance to values of master and individual port PWM intensity control bits. The intensity level is the number from the table divided by 240 when the polarity bit is 0. This table is symmetrical along a diagonal line, starting from the top second to the left corner and ending next to the bottom right corner.

Table 2. Intensity Level Based on Master and Individual Port Selections
  Master Port Intensity
0 1 2 3 4 5 6 7 8 9 A B C D E F
Individual
Port
Intensity
0 off 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 off 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
2 off 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45
3 off 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60
4 off 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75
5 off 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90
6 off 7 14 21 28 35 42 49 56 63 70 77 84 91 98 105
7 off 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120
8 off 9 18 27 36 45 54 63 72 81 90 99 108 117 126 135
9 off 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150
A off 11 22 33 44 55 66 77 88 99 110 121 132 143 154 165
B off 12 24 36 48 60 72 84 96 108 120 132 144 156 168 180
C off 13 26 39 52 65 78 91 104 117 130 143 156 169 182 195
D off 14 28 42 56 70 84 98 112 126 140 154 168 182 196 210
E off 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225
F off 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240

In Table 2, notice that there are continuous integer numbers up to the number 16. Beyond 16, the prime numbers are missing (i.e., those cannot be reproduced by multiplying 1 through 16 and 1 through 15). Additionally, there are many numbers/events that can be generated by multiple choices of master and individual port settings. Table 3 shows the linearly increasing intensity level trend, as well as its shorter versions. The Short1 list has an intensity level skip of 2/240th and the Short2 list has a skip of 4/240th. You can also have a power-of-2 increasing trend by using these master and individual port combinations along the diagonal line shown in Table 2. Or, you can fit a desired increasing trend by picking the closest combinations from Table 2.

Table 3. Most Smooth Increasing Trend
Choice 1 Choice 2 Intensity Level x 240
Individual Master Individual Master Full Short1 Short2
X 0 X 0 0 0 0
0 1 0 1 1    
1 1 0 2 2 2  
2 1 0 3 3    
3 1 0 4 4 4 4
4 1 0 5 5    
5 1 0 6 6 6  
6 1 0 7 7    
7 1 0 8 8 8 8
8 1 0 9 9    
9 1 0 A 10 10  
A 1 0 B 11    
B 1 0 C 12 12 12
C 1 0 D 13    
D 1 0 E 14 14  
E 1 0 F 15    
F 1 1 8 16 16 16
8 2 1 9 18 18  
9 2 1 A 20 20 20
6 3 2 7 21    
A 2 1 B 22 22  
B 2 1 C 24 24 24
4 5 4 5 25    
C 2 1 D 26 26  
8 3 2 9 27    
6 4 3 7 28 28 28
9 3 2 A 30 30  
7 4 3 8 32 32 32
A 3 2 B 33 33  
6 5 4 7 35    
B 3 2 C 36 36 36
C 3 2 D 39 39  
9 4 3 A 40 40 40
6 6 5 7 42 42  
A 4 3 B 44 44 44
8 5 4 9 45 45  
B 4 3 C 48 48 48
9 5 4 A 50 50  
C 4 3 D 52 52 52
8 6 5 9 54 54  
A 5 4 B 55    
7 7 6 8 56 56 56
9 6 5 A 60 60 60
8 7 6 9 63 63  
F 4 F 4 64 64 64
C 5 4 D 65    
A 6 5 B 66 66 66
9 7 6 A 70 70  
B 6 5 C 72 72 72
E 5 4 F 75 75  
A 7 6 B 77 77 77
C 6 5 D 78 78  
9 8 7 A 80 80 80
8 9 8 9 81 81  
B 7 6 C 84 84 84
A 8 7 B 88 88 88
E 6 5 F 90 90  
C 7 6 D 91 91 91
B 8 7 C 96 96 96
D 7 6 E 98 98  
A 9 8 B 99    
9 A 9 A 100 100 100
C 8 7 D 104 104 104
E 7 6 F 105 105  
B 9 8 C 108 108 108
A A 9 B 110 110  
D 8 7 E 112 112 112
C 9 8 D 117 117 117
E 8 7 F 120 120 120
A B A B 121 121  
D 9 8 E 126 126 126
F 8 F 8 128 128 128
C A 9 D 130 130  
B B A C 132 132 132
E 9 8 F 135 135 135
D A 9 E 140 140 140
C B A D 143 143  
B C B C 144 144 144
E A 9 F 150 150 150
D B A E 154 154 154
C C B D 156 156 156
F A F A 160 160 160
E B A F 165 165 165
D C B E 168 168 168
C D C D 169 169 169
F B F B 176 176 176
E C B F 180 180 180
D D C E 182 182 182
F C F C 192 192 192
E D C F 195 195 195
D E D E 196 196 196
F D F D 208 208 208
E E D F 210 210 210
F E F E 224 224 224
E F E F 225 225 225
F F F F 240 240 240

Table 3 shows that there are 96 distinguishable intensity levels among 240 master and individual port-setting combinations. To follow this increasing trend of all intensity levels, the master intensity level needs to be set backwards in some steps. This can be accomplished by using a setting array, such as that shown in the pseudo-programming code.

The following I²C write commands can be used to blink the LEDs driven by the MAX6964. The I²C device address of the MAX6964 is again 0x49.
0x49 0x02 0x00 0x00             // Set phase 0 polarity to all zeros to 
                                // turn LEDs on
0x49 0x0E 0xF0                  // Set master intensity to full
0x49 0x0F 0x0D                  // Set the blinking enable bit to start
0x49 0x0F 0x0F                  // Switch blinking flip bit to blink
0x49 0x0F 0x0D                  // Switch back the blinking flip bit to 
                                // blink
...
0x49 0x0F 0x0C                  // Reset the blinking enable bit to stop 
                                // blinking
0x49 0x02 0xFF 0xFF             // Set phase 0 polarity to all ones to 
                                // turn LEDs off
For the above commands, it is assumed that the phase 1 polarity bit for all ports is set to 1 (power-on default). Polarity bits in phase 0 and phase 1 registers can be set to the same value for ports that are not set for blinking. PWM intensity level settings are active during blinking. The PWM intensity level is set if the polarity bit is 0 in phase 0 or phase 1. Otherwise, its one's complementary waveform will drive the LED.

In summary, the MAX6964 LED driver can be programmed to blink between a pair of different intensity levels defined by the complementary waveforms. Gradual intensity-level change, sometimes called fading, can also be accomplished by proper programming.

The MAX7313/MAX7314 have LED drive capabilities that are similar to those of the MAX6964, plus all ports can be used as logic inputs with transition detection. The MAX6965, MAX7315, and MAX7316 are also comparable parts, but with half the number of ports. The general programming technique for the MAX6964 presented in this application note can also be used to control PWM intensity in these similar parts.
Next Steps
EE-Mail Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.
Download Download, PDF Format
© , Maxim Integrated Products, Inc.
The content on this webpage is protected by copyright laws of the United States and of foreign countries. For requests to copy this content, contact us.
APP 4253:
APPLICATION NOTE 4253,AN4253, AN 4253, APP4253, Appnote4253, Appnote 4253