Use DS89C450 as static LCD display controller

Abstract: Many companies' microcontrollers integrate an LCD display controller, which is implemented in hardware. Some microcontrollers, such as the DS89C450, do not provide this function, but a simple display controller can be implemented through software. This application note explains how to use the DS89C450 ultra-high-speed flash microcontroller to drive a 7-segment digital static LCD display panel.

Introduction Liquid crystal display (LCD) is widely used in various modern electronic devices, such as calculators, hand-held blood glucose meters, gas station pumps and televisions. The LCD has low power consumption and a clear display when viewed directly. It has replaced the old LED display in many applications. Many microcontrollers (such as MAXQ2000) integrate an LCD controller that can drive an LCD display panel, with a duty cycle of up to ¼. But in some cases, the ideal microcontroller in a specific application may not necessarily integrate an LCD controller. In these cases, you can use the port pins of the microcontroller to drive the display and implement the display controller in software.

This application note explains how to use the DS89C450 ultra-high-speed flash microcontroller to implement a simple 7-segment digital static LCD display controller. Since there is no special function of DS89C450, this example code can be easily exported to any 8051 compatible microcontroller, as long as the microcontroller has enough pins to drive the LCD display panel used in this application.

You can download (ASM) the sample code for this application note.

Choose an LCD display panel. When selecting an LCD display panel in your application, you should carefully select the compatible compatible microcontroller and LCD display controller for the LCD. When making a selection, the following questions should be considered. What is the operating voltage range of the LCD? Since the DS89C450 is a 5V microcontroller, and its port pins work at 5V level, we must choose a 5V LCD display panel. Note that many microcontrollers with integrated LCD controllers use a dedicated power supply input (VLCD) to set the voltage range used by the LCD controller. What is the duty cycle of the LCD? A static LCD display panel connects each segment of the display to a dedicated drive line. This means that the number of segment drivers must be equal to the number of LCD segments being driven. However, each segment drive line (SEG) of a multiplexed LCD display panel drives more than one LCD segment. These display panels use multiple common backplane (COM) outputs to drive the multilevel between VLCD and GND on the SEG and COM lines based on the duty cycle used. Since the 8051 microcontroller DS89C450 we use can only drive its port pin lines to 5V and GND, our situation is limited to static LCDs. For more information on driving multiplexed LCDs, please refer to the following documents: Application Note 3548, "Using an LCD with MAXQ Microntrollers". MAXQ® Series User's Guide: MAXQ2000 Supplementary Materials ) The backplane cable requires an additional port pin. For this application note, the Lumex® LCD-S401C52TR display was selected. The LCD is a 5V static display with 4 7-segment numbers and 3 symbol segments (a comma and three decimal points). Each digit on the LCD is composed of 7 segments. As shown in Figure 1, segments A, B, G, E, and D are turned on and the number "2" is displayed.

Figure 1. 7-segment LCD display numbers
Figure 1. 7-segment LCD display numbers

The LCD-S401C52TR display contains a COM backplane (connected to two pins) and 32 display segments, each connected to a segment drive pin. In this example, we only use three of the 7-segment numbers, which means that the DS89C450 needs to drive 21 SEG lines (each of the three digits requires 7 segments) and a COM line, thus requiring 22 port pins . When the extended memory bus configuration is not used, the DS89C450 provides 24 push-pull port pins. Therefore, the microcontroller has enough I / O capacity to accomplish this task (Port 0 has 8 other port pins. However, three pins are open drain and require additional pull-up resistors to be used as general purpose I / O).

Hardware setup The hardware setup for this example is based on the DS89C450 evaluation (EV) kit (version B), with the memory interface CPLD (U5) and two external memory chips (U6 and U7) removed. This change releases multiple port pins that can be used by our application, otherwise these pins can be used to implement the extended memory bus, especially port 0 (all 8 lines), port 2 (all 8 lines), Ports 3.6 and 3.7. See Table 1 (Note: Port 0 is not used in this example). DS89C450 contains 64kB internal code space and 1kB internal data SRAM, which is enough for this example.

The segments and common lines on the LCD-S401C52TR display are connected to the port pins of the DS89C450 through the J4 plug near the prototype area. The segment line is connected to the port pin through a 1kΩ resistor, but not directly connected to the port pin. The reason for this setting is that the port pins of the DS89C450 have a stronger driving capability than the commonly used methods of LCD display panel drive lines (0-state and monostable strong pull-down, 1 state strong pull-up, and weak pull-up). Because the COM line has a large capacitance and requires a strong drive, it is directly connected to its port pin. However, this application does not recommend that segment lines be driven directly by port pins. There is a problem with this configuration: as more and more segments are opened, through the LCD display, the capacitive coupling between the segment and the common plane will cause the COM line to deviate from its preset state (the reason for this problem, (Because the working section always maintains a positive voltage to the common plane). As a result, the segments that should be turned off are partially opened. Therefore, connect the port pins through resistors to reduce the driving capacity and avoid this problem.

Table 1. LCD display board and port pin connections
DS89C450 Port Pin J4 Header Pin LCD Pin (s) LCD Signal Notes
P1.0 1 twenty one 4A Through 1kΩ
P1.1 2 20 4B Through 1kΩ
P1.2 3 19 4C Through 1kΩ
P1.3 4 18 4D Through 1kΩ
P1.4 5 17 4E Through 1kΩ
P1.5 6 twenty two 4F Through 1kΩ
P1.6 7 twenty three 4G Through 1kΩ
P1.7 8 1, 40 COM Connect directly
P2.0 twenty one 25 3A Through 1kΩ
P2.1 twenty two twenty four 3B Through 1kΩ
P2.2 twenty three 15 3C Through 1kΩ
P2.3 twenty four 14 3D Through 1kΩ
P2.4 25 13 3E Through 1kΩ
P2.5 26 26 3F Through 1kΩ
P2.6 27 27 3G Through 1kΩ
P3.0 10 30 2A Through 1kΩ
P3.1 11 29 2B Through 1kΩ
P3.2 12 11 2C Through 1kΩ
P3.3 13 10 2D Through 1kΩ
P3.4 14 9 2E Through 1kΩ
P3.5 15 31 2F Through 1kΩ
P3.6 16 32 2G Through 1kΩ

It also needs some instructions on the hardware settings: A standard 16.384MHz crystal oscillator (inserted on Y1) is used to provide the clock for the DS89C450. When running the application, the DIP switches SW1.1 and SW4.2 should be in the ON position; all others should be OFF. When loading the application (using the MAXQ Microcontroller Tool Kit (MTK) or another development tool), the DIP switches SW1.1, SW1.2, SW1.3, SW4.1 and SW4.2 should be in the ON position; all Others should be OFF. When the LCD display is running, you can always see the status of port 1 on the LED bar display U10. This is normal. Since the LCD display is buffered, it will not affect the application. P3.0 and P3.1 are also used for the Tx / Rx line of serial port 0. Therefore, when the application is loaded (using the serial port to start the loader), due to the activity of these lines, one or two segments of the LCD will flash. This is normal. When the application is running, the DIP switches SW1.2 and SW1.3 should be turned off to disable the serial port function. Any unused segments on the LCD display must be driven to the OFF state and not allowed to float. This task can be accomplished by connecting one or more unused segments to the port pins that are driven to the OFF state (same voltage waveform as COM), or unused segments can be directly connected to COM. The default state of the LCD segment driving the LCD segment is OFF (for example, transparent); when no voltage is applied, the segment should be in a transparent state, which is not visible relative to the LCD display panel background. In addition, when the same voltage is applied to the segment line (SEG) and the common backplane (COM), the segment remains off. When there is a voltage difference between the SEG pin of the segment and the COM plane, the segment switches to the ON (eg, opaque) state. When the voltage reaches a special level, that is, the threshold voltage, the segment becomes darker and finally completely opaque. The threshold voltage is the percentage of the specified operating voltage of the LCD display panel. Different LCDs have different threshold voltages.

The polarity of the voltage difference does not affect driving the LCD segment. For example, a controller that drives a 3V threshold voltage LCD can turn on segment n by setting COM to ground and SEGn to 3V, and can also set COM to 3V and SEGn to ground to achieve the same purpose. This fact is very important because if the static DC voltage on the LCD is held for too long, the segment may be damaged and can no longer switch normally. To avoid this problem, regardless of whether the segment is in the ON or OFF state, the LCD segment is always driven with alternating waveforms to ensure that the total DC voltage on each segment remains at zero (Figure 2).

Figure 2. Alternating drive waveforms for static LCD segments
Figure 2. Alternating drive waveforms for static LCD segments

As shown in Figure 2, the COM pin of the static display has been driven by a 50% duty cycle square wave, the square wave level is between VLCD (our setting is 5V) and GND. Use one of the two modes to drive each segment. To turn OFF the segment, the same waveform as we drive the COM pin should be used to drive it. This ensures that the DC voltage on the SEG / COM pair is always zero, meaning that the segment will remain off. To turn the segment ON, the signal opposite to the COM waveform should be used to drive it. This means that half the time drives the segment with a positive voltage and the other half drives it with a negative voltage. These two states have the same visual display, so the segment appears to be on all the time. Since the average DC value of the voltage difference is zero, there will be no static DC bias that will damage the LCD glass. Different LCD display panels have different LCD driving frequencies (called frame frequencies). The appropriate frequency value for practical application depends on the test conditions of specific hardware settings. Since the rate of change of the LCD segment state is limited by the total capacitance of the segment, the LCD can only work normally within a specific range of frame frequencies. Generally speaking, this range is between 20 Hz and 200 Hz. The example code in this application note makes the LCD run at approximately 30 Hz. If the frame rate of a particular display is too high or too low, the LCD segment will flicker or appear dark.

The following is the main program that drives the LCD segment to run. Main: mov IE, # 080h; Disable TImer 0 interrupt temporarily mov R2, DigitP1; Grab local copies of digit variables mov R3, DigitP2 mov R4, DigitP3 mov IE, # 082h; Re-enable TImer 0 interrupt mov A, R2 call getDigit ; Calculate segment pattern for ones digit anl A, # 01111111b; Ensure that COM (P1.7) is driven low mov P1, A mov A, R3 call getDigit; Calculate segment pattern for tens digit mov P2, A mov A, R4 call getDigit; Calculate segment pattern for hundreds digit mov P3, A ;;;; Delay loop ;;;; mov R0, # 0FFh L1A: mov R1, # 0FFh L1B: djnz R1, L1B djnz R0, L1A ;;;;;; ;;;;;;;;;;;;;;;;; mov A, R2 call getDigit; Calculate segment pattern for ones digit cpl A; Inverse of the pattern driven on the first frame half orl A, # 10000000b; Ensure that COM (P1.7) is driven high mov P1, A mov A, R3 call getDigit; Calculate segment pattern for tens digit cpl A; Inverse of the pattern driven on the first frame half mov P2, A mov A, R4 call getDigit; Calculate segment pattern for hundreds digit cp l A; Inverse of the pattern driven on the first frame half mov P3, A ;;;; Delay loop ;;;; mov R0, # 0FFh L2A: mov R1, # 0FFh L2B: djnz R1, L2B djnz R0, L2A; ;;;;;;;;;;;;;;;;;;;;; ljmp Main; Go back for another frame cycle (endless loop) Note that the COM line (connected to P1.7) always uses the same Waveform drive: the first half of the frame is low, and the second half of the frame is high. For segment lines, the mode driving of the first part of the frame is opposite to that of the second part. Connect each of the three digits to one of the three ports in the same way, so segment A is always connected to Px.0, segment B is connected to Px.1, and so on. This configuration enables the example code to use the getDigit subroutine to calculate the segment mode for each of the three LCD display panel digits. ; ************************************************* **************************; *; * getDigit; *; * Returns an LCD segment pattern (in Acc) for the decimal digit (0 to 9); * input (also in Acc); * getDigit: cjne A, # 0, getDigit_not0; xgfedcba mov A, # 00111111b; Zero ret getDigit_not0: cjne A, # 1, getDigit_not1; xgfedcba mov A, # 00000110b; One ret getDigit_not1: cjne A, # 2, getDigit_not2; xgfedcba mov A, # 01011011b; Two ret getDigit_not2: cjne A, # 3, getDigit_not3; xgfedcba mov A, # 01001111b; Three ret getDigit_not3: cjne A, # 4, get4 mov A, # 01100110b; Four ret getDigit_not4: cjne A, # 5, getDigit_not5; xgfedcba mov A, # 01101101b; Five ret getDigit_not5: cjne A, # 6, getDigit_not6; xgfedcba mov A, # 01111101b; Six ret getDigit_not , # 7, getDigit_not7; xgfedcba mov A, # 00000111b; Seven ret getDigit_not7: cjne A, # 8, getDigit_not8; xgfedcba mov A, # 01111111b; Eight ret getDigit_not8: cjne A, # 9, getDigit_not9; xgfedcba111mov, ; Nine ret getDigit_not9: mov A, # 0 ret The mode displayed on the LCD in the example code of the running counter is a 3-digit decimal counter. It starts from 000 at power-on and increments to 001, 002, until 999, and then flips. Since the main loop of the program drives the LCD segment and the common mode, we must find another way to periodically increment the counter value. Our solution is to use timer 0 to periodically trigger an interrupt. mov TMOD, # 021h; TImer 1: 8-bit autoreload from TH1; TImer 0: 16-bit mov TCON, # 050h; Enable timers 0 and 1 mov CKMOD, # 038h; Use system clock for all timer inputs mov IE, # 082h; Enable timer 0 interrupt Each time a timer interrupt occurs, the delay counter in the register is decremented. When the delay counter reaches zero, the LCD 3-digit counter value is incremented by 1 (each digit rolls over as needed); the delay counter is initialized to its maximum value. Since the width of timer 0 is 16 bits, the example code sets the delay counter to 20, and the 3-bit counter is approximately every (1 / 16.384MHz) × (216) × 20 = 0.08s, which is 12 times per second, incremented once. org 000Bh; Timer 0 interrupt ljmp IntTimer0; ***************************************** **********************************; *; * IntTimer0 (INTT0); *; * Timer interrupt service routine ; * IntTimer0: push ACC; Save off accumulator and R0 push R00 mov R0, Count; Only increment LCD digits every [CountMax]; interrupt cycles djnz R0, INTT0_Done inc DigitP1; Increment ones digit on display mov A, DigitP1 cjne A, # 10, INTT0_Continue; Check for rollover mov DigitP1, # 0 inc DigitP2; Increment tens digit on display mov A, DigitP2 cjne A, # 10, INTT0_Continue; Check for rollover mov DigitP2, # 0 inc DigitP3; Increment hundreds digit on display mov A , DigitP3 cjne A, # 10, INTT0_Continue; Check for rollover mov DigitP3, # 0 INTT0_Continue: mov R0, CountMax; Reset to starting cycle count INTT0_Done: mov Count, R0; Update cycle counter pop R00 pop ACC; Restore accumulator and R0 reti Conclusion Using a large number of dedicated digital peripherals of the microcontroller, static or multiple channels can be implemented in the software as required With LCD display controller. The simple static display makes this implementation very intuitive. The standard general I / O functions of 8051 microcontrollers such as DS89C450 can be used to drive the SEG and COM waveforms on the LCD. Using the high-performance DS89C450, even if the LCD controller is implemented in software, it can ensure that the main application has sufficient processing power.

With a light output of up to 16,800 lumens, our Outdoor Led Wall Light Fixtures will light up any area to create a more secure environment. Outdoor Led Wall Pack is perfect for outdoor perimeter and area lighting. Features wide lateral spacing. And Outdoor Led Wall Light Fixtures will save you up to 85% on your energy bill. Bbier Outdoor Wall Lights come with a silicone gasket which PREVENTS LEAKAGE from the outside. It is also HEAT AND IMPACT RESISTANT. Comes in a standard dark bronze finish to match any area. Made of Glass or PC Lens. Glass will not degrade or change colors from sunlight exposure.


We uphold the highest standards for all our products by testing each product for optimal performance and safety. Bbier Outside Wall Lights are non toxic, unlike traditional HID wall packs, and will not fade over time, so you can enjoy a consistent high output light. The IP65 weatherproof rating ensures our Led Wall Pack can stand up to the elements. Outdoor Led Wall Light Fixtures is ideal for outdoor spaces such as building exteriors, parkings lots, street/alleyways, paraking lots and garages.


Outdoor Led Wall Light Fixtures






Outdoor Led Wall Light Fixtures

Outdoor Led Wall Pack,Outdoor Led Wall Light Fixtures,Outdoor Wall Lights,Outside Wall Lights

Shenzhen Bbier Lighting Co., Ltd , https://www.chinabbier.com