2852 views|0 replies

1782

Posts

0

Resources
The OP
 

Design of custom LED drivers [Copy link]

Design of custom LED drivers
Deng Chengzhong
(School of Mechanical Engineering and Automation, Xihua University, Chengdu 610039, Sichuan, China)
  Abstract: By using some special functions of Philips LPC series microcontrollers, a high-performance LED display driver chip was customized without adding any external components. The customization methods of the general 4-bit 7-segment LED display driver chip and the 6-bit "meter" segment LED display driver chip were analyzed, and the LED display driver software programming method was introduced.
  Keywords: LED LED display driver I2C bus P87LPC762 P89LPC932

  With the rapid development and wide application of computer technology and electronic technology, the output display technology of electrical equipment has become complex and diverse, such as CRT display, LCD display, multi-bit LED display and light-emitting diode display. Among these displays, LED and light-emitting diode display circuits are relatively simple and low in cost, and are widely used in single-function instruments and electromechanical equipment. However, when the device displays more points or bits, it is necessary to adopt a certain drive circuit and corresponding drive method.
  In the design of LED drive and display unit, there are many ways to use: using the port of the computer chip as the driving port of the LED, and implementing it through software programming and external drive, the disadvantage is that it occupies the time and related resources of the computer chip; using dedicated interface chips such as Intel8155, 8255, etc. as the port expansion of the computer chip, and implementing it through software programming and external drive, the disadvantage is that the circuit is more complex, the power consumption is larger, and it also occupies the time and related resources of the computer chip; using dedicated display chips such as Intel8279, MAX7219, PS7219, etc., can achieve more complex functions, but it still occupies more computer chip ports, and the chip price is higher. Most display drivers do not have strict bus timing, which can easily cause timing confusion and abnormal display in a strong interference environment. The LED display solution discussed in this article uses the circuit characteristics of Philips' LPC series microcontroller chips to customize a dedicated LED display driver controller chip in another form. It mainly uses the communication interface based on the I2C bus to make the connection reliable; and based on software programming to control the display, the display mode and type are diverse. Due to the strong port driving ability of the LPC series chips, general LEDs can be directly connected. Without adding external components, multiple LEDs or a large number of light-emitting diodes can be displayed. When connected to other chips, fewer I/O ports are occupied.
1 4-digit 7-segment LED display
  The usual 4-digit LED display is shown in Figure 1. It is composed of multiple light-emitting diodes. According to different connection methods, it can be divided into common anode LED and common cathode LED. Its circuit characteristics are basically the same: the light-emitting diode conduction voltage drop is 1.2V~1.8V, and the forward working current is 2mA~15mA. In the display drive mode, dynamic scanning is used. When the common terminals n1 to n4 are scanned, the LED driver will output the display segments a to dp respectively, and the LED will display normally. Among the customized LED display driver chips, the P87LPC762 microcontroller chip in the LPC series has better port settings and stronger internal functions, so its pin functions can be set by programming as the driver chip of the LED display.

Figure 1 4-digit LED display

2 Customized 4-digit 7-segment LED display driver chip
  To realize the display of 4-digit 7-segment LED, it is enough to make the current flowing through each segment of the light-emitting diode meet the requirements. Here, the P87LPC762 microcontroller of the LPC series of Philips is selected to realize the display driver circuit. P87LPC762 is an enhanced 51 series microcontroller. In addition to the functions of general microcontrollers, it also has the performance of driving LEDs:
  · The I/O port has pull-up output mode or open-drain output mode settings, which can be used as segment output and bit output of common cathode or common anode LEDs.
  · It has a large port pull current or sink current, and has an internal short-circuit protection function to realize the current drive of LEDs.
  · When designing a 4-digit LED driver, the remaining pins of the chip can be used for I2C bus address setting and LED polarity selection.
  · There is an internal 2K OPT, which can be used as a program memory to realize interface and display programming.
  · It comes with an I2C hardware interface, which is convenient for interface programming and multi-chip connection.
  · The internal watchdog and internal reset can improve the reliability of the drive display.
  · An internal RC oscillator is provided to reduce external components.
  The pin functions of the P87LPC762 chip are shown in Figure 2. It has three ports: Port0, Port1, and Port2. When internal oscillation and internal reset are selected, the maximum number of I/O ports can reach 18. Most ports can be configured by software to be one of the four types of quasi-bidirectional, pull-up, input, and open-drain output. For the pull-up output mode, the P87LPC762 adds a third transistor on the basis of the standard quasi-bidirectional port to provide a strong pull-up function, which can output a large pull current at a high level; for the open-drain output mode, the port can provide a large sink current to the outside; for the input mode, the port pin level is determined by the external voltage.
  According to the display characteristics of the 4-bit dynamic LED, the ports of the P87LPC762 are defined here, and the defined pins are shown in Table 1. P0.0~P0.7 are used as the segment output of 4-bit LED. Depending on the polarity of LED, the port can be set as pull-up output or open-drain output; P1.0, P1.1, P1.6, P1.7 are used as the bit output of 4-bit LED. Depending on the polarity of LED, the port can be set as open-drain output or pull-up output; P1.5 is used as the polarity selection of LED and is set as input mode; P2.1, P2.0, P1.4 are used as the external address of I2C bus, which is convenient for setting the I2C bus address when multiple chips are connected and is set as input mode; P1.2 and P1.3 keep the I2C bus interface function unchanged. The chip pins after definition are shown in Figure 3.

Figure 2 Original pin function of P87LPC762 chip

Figure 3 Pin definition of new customized chip of P87LPC762

  To achieve the above chip settings, some internal special function registers and pin settings of P87LPC762 are shown in Table 2. PxMx is the port mode setting, which is selected in conjunction with the LED polarity. UCFG1 is the chip system configuration word, which needs to be written when the chip is programmed and cannot be set after the program is running. When the configuration word is FBH, it means: start the watchdog, internal reset, the port line is high level after reset, the undervoltage voltage is 2.5V, six clocks, and the internal RC oscillator.
3 Customize the 6-bit "meter" field LED display driver chip
  Usually, the appearance of a 1-bit "meter" field LED display is shown in Figure 4, and it is composed of multiple light-emitting diodes. If you want to form a 6-bit "meter" field LED display, you need to connect the same segments and bits separately, and lead out the common end of each bit for dynamic scanning. According to the different polarities of the light-emitting diode connection, it can be divided into two methods: common anode and common cathode. Since the 6-bit "meter" field LED display has more output segments and bits, the LPC series P89LPC932 chip can be used to implement the display driver circuit. Its pins are 28-pin package, and the maximum number of I/O ports can reach 26. The functional pins are shown in Figure 5. P89LPC932 has the same port electrical characteristics as P87LPC762, and has more I/O ports, so it can be used as a driver chip for the 6-bit "meter" field LED display. The newly customized driver chip pins are shown in Figure 6: a~n are drive segment outputs, n1~n6 are drive bit outputs; A/K is the selection terminal for common anode and common cathode; A0~A2 is the external address selection of the I2C bus, and up to 8 external chips can be connected; SDA and SCL keep the I2C bus interface function unchanged.

Figure 4 Appearance

Figure 5 Original pin function of P87LPC932 chip

Figure 6 Pin definition of new customized chip of P89LPC932
Table 1 Modified port definition of P87LPC762
Pinout Original pin function New Definition illustrate Pinout Original pin function New Definition illustrate
1 P0.0/CMP2 a LED
segment output
12 P1.0/TXD n1 LED
segment output
20 P0.1/CIN2B b 11 P1.1/RXD n2
19 P0.2/CIN2A c 2 P1.6 n3
18 P0.3/CIN1B d 3 P1.7 n4
17 P0.4/CIN1A e 4 P1.5/RST A/K polarity
16 P0.5/REF f 6 P2.1/X1 A2 Chip Address
14 P0.6/CMP1 g 7 P2.0/X2 A1
13 P0.7/T1 dp 8 P1.4/INT1 A0
9 P1.3/SDA SDA I2C interface
15 VDD VDD power supply
10 P1.2/SCL SCL 5 VSS VSS

Table 2 P87LPC762 chip settings
P1.5 P0M1 P0M2 P1M1 P1M2 P2M1 P2M2 UCFG1
Common anode LED Grounding FFH FFH 10H C3H 03H 00H FBH
Common cathode LED Connect to power supply 00H FFH D3H C3H 03H 00H FBH

4 Application of customized LED display driver chip
  Taking the customized 4-bit 7-segment LED display driver chip as an example, the schematic diagram of the designed LED display driver is shown in Figure 7. It uses the general I/O ports P1.0 and P1.1 of the 89C52 microcontroller as the analog I 2 C bus; the LED display is a 4-bit common cathode LED, and the A/K pin is connected to the power supply; the display driver chip is customized using P87LPC762 and named LED-762. The I 2 C bus external address of the first chip is 000, which is achieved by grounding the A0, A1, and A2 pins. The addresses of the remaining chips are set in sequence, and up to 8 external chips can be connected (not shown in the figure). From the circuit diagram, LED-762 can be used as an LED driver without any external components. Since it uses the I 2 C bus connection, it occupies the least system resources and the circuit is relatively simple. If 8 LED-762s are connected to the I 2 C bus, the LED expansion bit number can reach 32 bits. For the application of the "meter" segment LED display driver chip, the same connection method can be used. On the same I 2 C bus, the maximum expandable "meter" field LED can reach 48 bits, which is enough to meet general use requirements.
  In order to improve the driving ability of the I 2 C bus, when realizing multi-chip connection, SCL and SDA need to be connected to the bus matching pull-up resistor.
5 Software programming of customized LED display driver chip
  Since the LPC series chip has an internal hardware interface that supports the I 2 C bus, users can directly use it as the master controller of the I 2 C bus or the slave controller of the I 2 C bus. The slave can receive or send data from the bus through the I 2 C hardware interrupt processing; the master controller can operate the I 2 C bus to realize the start timing, data timing, response timing, and stop timing to detect the I 2 C bus slave and realize the corresponding data transmission. The slaves on the I 2 C bus are distinguished by the I 2 C bus address. The I2C bus address is uniformly allocated by the I2C bus committee. The chip address is 7 bits (it occupies D7~D1 bits). The upper 4 bits (D7~D4) determine the chip type. Users can also customize the chip type. The lower 3 bits (D3~D1) are set through the chip A0, A1, and A2 pins.
  When using the LPC series chip with an I2C bus interface to customize the LED display driver chip, the customized LED display driver chip is set as the controlled device, and the CPU to send the display data is set as the I2C bus master. The flowchart of the customized LED display driver chip receiving data through the I2C interrupt is shown in Figure 8. When the first data is received from the I2C bus , it is determined whether it is the same as the chip address. If it is the same and it is write display data, the response timing is sent to receive 4 bits of display data, and then the I2C interface returns to the idle state. To realize LED dynamic display, the display program can be compiled for the LED display driver. According to the LED polarity input, the segments and bits to be displayed are sent out respectively, and the LED can be displayed normally.

Figure 7 Schematic diagram of LED display driver using customized display driver chip

Figure 8 I 2 C interrupt flow chart

  According to the I 2 C bus protocol requirements, there are certain response time requirements for the data sent by the master controller. The shortest time can be determined by the multiplication frequency of the RC oscillator and the interrupt response time, and the maximum rate can reach 400kbs/s. The lowest rate can be controlled by the dedicated I 2 C timer I inside the LPC series. In order to adapt to the non-standard low-rate I 2 C bus operation, the timer I can be turned off.
6 Chip test and main performance indicators
  According to the customization requirements, after the complete LED display driver and chip setting parameters are solidified through the programmer, a chip test connection diagram should be made, as shown in Figure 7. Here, P1.0 and P1.1 of 89C52 are used as the simulated I 2 C bus control lines to write the simulated I 2 C driver. Moreover, the next normal data reception of the display driver will not be affected by the 89C52 host resetting and the I 2 C bus communication disconnection. If the timer I in the customized LED driver is turned off, the simulated I 2 C program is paused and the customized LED driver can be debugged normally. Since the output current capability of the LPC series chip port of Philips is strong, the LED brightness meets the requirements when driving 0.5-inch common cathode and common anode LEDs. When the display is displayed at full brightness for a long time, the temperature rise of the customized LED driver chip is normal and can work continuously for a long time. In actual use, the control ports A/K and A0, A1, and A2 are set to input mode during programming. Therefore, when they are suspended, the input level is in an uncertain state and changes randomly, which may cause abnormal display. According to the address setting requirements, they should be forced to connect to VCC or GND.
References
1 Zhang Yigang, Peng Xiyuan, Tan Xiaoyun, etc. MCS-51 single-chip microcomputer application design. Harbin: Harbin Institute of Technology Press, 1997
2 He Limin. I 2 C bus application system design. Beijing: Beijing University of Aeronautics and Astronautics Press, 1995
3 Zhou Hangci. 51LPC series OTP single-chip microcomputer principle and application design. Beijing: Beijing University of Aeronautics and Astronautics Press, 2000

(Received date: 2005-04-25)

This post is from Analog electronics

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list