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.
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.
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.
The following are examples of I2C command sequences sent to the MAX6964 to turn on LEDs at certain PWM intensity levels.
The following three I2C write commands can be used to turn on the O16 LED at its minimum intensity level. The I2C 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 I2C 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.
The following text is a pseudo-programming code to turn on LEDs gradually in LoopLength x WaitTime seconds. The I2C 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 I2C(Write, 0x0E, MasterPort(1, i)); // Set master intensity level I2C(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.
|Master Port Intensity|
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.
|Choice 1||Choice 2||Intensity Level x 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 I2C write commands can be used to blink the LEDs driven by the MAX6964. The I2C 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.