The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.   United States  United States   


Datasheet Search Engine   
 
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)


  Datasheet Home \ Datasheet Details

LCD, Display, Microprocessor, LED, Crystal Oscillators, LCDs, Controller, Driver

Download

PDF Abstract Text:

DIRECT DRIVE OF LCD DISPLAYS


USING THE Z8 MCU TO DIRECTLY DRIVE AN LCD DISPLAY SAVES MONEY AND SPACE FOR SMALL, LOW-COST APPLICATIONS.

APPLICATION NOTE
DIRECT DRIVE OF LCD DISPLAYS
USING THE Z8 MCU TO DIRECTLY DRIVE AN LCD DISPLAY SAVES MONEY AND SPACE FOR SMALL, LOW-COST APPLICATIONS.
INTRODUCTION
It is often necessary for small microprocessor-based devices to display status information to the user. If the quantity of information is small, light emitting diodes (LEDs) can give a simple status display. However, LEDs are not practical if the volume of information gets too large. Segmented LED displays allow more information to be displayed but, LEDs consume power, shortening the life of battery-operated devices. Liquid crystal display (LCD) modules are a small, light, low-power alternative. LCD displays can be purchased that display nearly anything by using a dot matrix or a segmented display of discrete areas of liquid crystal. The drawback to dot matrix LCD is the cost of the dedicated controller chip that is usually required to drive the LCD glass. While LCDs are not difficult to control, they are very unforgiving. They require constant attention because a voltage change across the liquid crystal can destroy the crystal structure and ruin the display. Also, typical dot-matrix display panels require a large number of signal inputs. This makes it impractical to use dot-matrix LCD displays without a dedicated driver chip. This chip can be built directly into the same case as the glass, and this combination is then called an LCD module. Note: Application Note AP96Z8X1400, Interfacing LCDs to the Z8 (found in the Z8 Application Note Handbook), describes how LCD modules can be used with the Zilog Z8 family of microcontrollers. LCD displays are also made in a segmented fashion, however. This type of display uses segments of liquid crystal to form characters and enunciators, in the same manner used by LED-segmented displays. Since the total number of controlled segments is lower than with dot matrix-type displays, the Z8 can take direct control of the LCD glass. This application note describes how the designer can interface directly to a simple LCD using the Z86X3X and Z86X4X family of microcontrollers.
THEORY OF OPERATION LCD Basics
A liquid crystal display is manufactured by layering polarizing liquid crystal between two plates of glass and a polarizer. (See Figure 1.) When a voltage potential is developed across the liquid crystal, the crystalline matrix twists. The effect is that the voltage controls a polarizing filter, alternately blocking and transmitting light.
Glass Liquid Crystal Glass Polarizer Reflector or Backlight
Figure 1. LCD Cross Section
Applying the control voltage for too long a period of time causes the matrix of the liquid crystal to permanently twist, ruining the polarizing effect. To prevent this problem, the
AP97Z8X1800
Direct Drive of LCD Displays LCD must be pulsed-first in one direction, then in the other. The shifting effect is neutralized. The voltage is alternated quickly enough (typically 50 to 100 Hz) that the eye does not perceive the ON segment as flickering. Traditional LCD panels were built with one backplane of glass acting as a common conductor for all the segments. Another glass plate had a conductor for each segment brought out to the edge of the panel for connection to the outside. The signals to drive this type of display are illustrated in Figure 2.
Zilog Figure 3a illustrates how two segments can share a segment driver line and Figure 3b shows the signals that would be generated to drive the two segments.
3 "off"
Segment OFF +Von Vcom -Von
Segment ON
Seg. A
Seg. G Figure 4. Two Plane Drive Signals
(50 - 100 Hz Typical) Figure 2. LCD Drive Signal
As the number of segments to be driven increases, the number of pins required on the driver chip increases proportionally.
Multiple Backplanes
In order to reduce the number of control lines required, for large segment counts, modern LCD display panels are usually built with more than one backplane. This is done by splitting the backplane glass into several conductors and connecting more than one segment to each control pin. Then, by placing a signal on the common pins as well as the segment pins, the segments can be toggled independently.
In this example, segment A (the top of the character) would be ON and segment G (the bar across the middle) would be OFF. The two common planes drive an alternating signal with periods of zero between each high and low drive pulse and the planes out of phase with each other. The common signal pin is then driven with the data for both pins, the data for common 1, data for common 2, inverted data for common 1 and inverted data for common 2. Figure 3c shows this sequence.
Figure 5. The Phased Data Sequence
The resulting waveforms at each segment are shown at the bottom of Figure 3b. The Root Mean Squared (RMS) value of the signal on segment A is larger than the initial voltage of the liquid crystal so it appears dark while the RMS voltage across segment G is below the threshold so the segment is clear. It is important to keep each segment toggling quickly enough to prevent noticeable flicker. The common planes must toggle twice as fast in a two-plane configuration, four times as fast in a four plane, and so forth. Obviously, as the number of backplanes goes up, the speed of the driving processor must also increase. This sets up a trade off between speed of the controller and complexity of the glass on one side and pin count on the other.
AP97Z8X1800
Zilog
Direct Drive of LCD Displays
HARDWARE IMPLEMENTATION The Application
To demonstrate the method for using the Z8 to directly drive an LCD glass, this application note implements a small, battery-operated travel alarm clock. The clock design has a single alarm setting with a snooze feature and an audible alarm. P35 P34 Z86L43
The LCD Glass
LCD glass for this type of application is typically custom manufactured in volume. This gives the user flexibility in selecting an initial threshold voltage that matches the chosen power supply as well as explicitly defines the appearance of the segments and the number of backplanes. For purposes of this note, the circuit is designed around an LCD that was left over from another project. It has a threshold voltage of about 1.2 volts, 13 segment lines and 2 backplanes. Using a supply voltage that can range from 3.0 volts down to 2.0 volts, the worst-case RMS voltage across an OFF segment is calculated as: P37
Figure 6. Three Level Drive Circuit The common signals can be generated, phase by phase, simply by driving the three port pins to the correct state. For example, to generate phase zero, pin P35 would be driven HIGH and pins P34 and P37 driven LOW. The common 1 voltage is then LOW while the common 2 voltage is set by the resistive divider from Voh to Vol. The OFF state can be accomplished by driving all three pins LOW and driving all the segments LOW. Since the common mode DC component is ignored by the LCD glass, this is a safe state. The segment drivers can simply be connected directly to port pin outputs since they only need to drive a HIGH or a LOW. This method allows up to 3 backplanes (an uncommon but feasible number) times 24 segment lines for a total of 72 segments, including enunciators. This maximum case leaves only four inputs (port 3, lower nibble) and no free outputs. An alternative is available if more segments are required. Figure 5 shows how port 2 can be used as the common driver using fixed resistor dividers.
which is well above the threshold. Thus, a 3-volt lithium button-cell supply works nicely.
Driving The Backplanes
Since microprocessors normally do not deal in negative output voltages, the center line of the plots is usually half the supply voltage referenced to the ground of the chip. The positive drive level is the chip supply and the negative drive level is ground. The liquid crystal is insensitive to the DC component common to both the backplane and segment lines, only the difference between them matters. This can be accomplished using the binary drive of the Z8 as shown in Figure 4.
Figure 7. Alternate Common Drive
Using this method allows up to 8 back planes times 20 segment lines for a total of 160 segments. This configuration is speed limited, however, and the OFF state continues to draw current through the dividers unless AP97Z8X1800 3
Direct Drive of LCD Displays external circuitry is added to deactivate the power. There is also a penalty in software complexity if not all of port 2 is used for plane drivers, and the extra pins are used for outputs. The circuit described in this application note uses the first method of generating the common backplane signals. The number of segments available from a two backplane solution is sufficient. (In fact, the Z86L33, 28-pin device is enough.) The complete schematic is shown on the next page in Figure 6.
Zilog case. When the case is closed, it automatically turns the switch OFF. The LED backlight for the LCD is actually not directly driven by the button input. The Z8 MCU has control of the LEDs, allowing it to be disabled when the power is OFF and allowing the light to stay on for a few seconds after the button is released. The backlight is optional because it draws significant power from the batteries. A second battery can easily be added to supply the backlight. This battery could also be a higher voltage to further improve battery life or allow a different type of backlight. The Piezo buzzer is driven by a hardware timer using timer-out mode. This minimizes the software requirement. The buzzer is tied between Vcc and the P36 pin with a small resistor in series to reduce the in-rush current when the pin toggles. To protect the circuit from a reversed battery condition, a diode is placed from the ground to the Vcc pin of the Z8. If the battery is inserted incorrectly, the diode prevents the Vcc from going more than 0.7 volts below ground, quickly discharging and destroying the battery. The more common method of placing the diode in line between the battery and the Vcc pin has the drawback of reducing the Vcc voltage at any given battery voltage. Often, the battery still has some energy left when the Vcc gets too low to work correctly.
The User Interface
Aside from the LCD glass itself, the user interface consists of a Piezo buzzer to generate the alarm sound, an optional LED backlight, five buttons used for setting the time, setting the alarm, the snooze bar and the backlight, and the power switch. The power switch does not actually deactivate the power since the Z8 must keep running to update the real-time clock. Instead, the power switch is an input to the Z8. When the switch is in the OFF position, the Z8 shuts down the LCD, and ignores the buttons. The reduced software load lets the Z8 be in HALT mode a higher percentage of the time, saving current. The switch is a break-before-make slider built into the clam-shell style
AP97Z8X1800
Zilog
Direct Drive of LCD Displays
Piezo Buzzer 10K 10K
P20.4
P35 P34 P36 10K P37
Z86L33 XTAL1 1MHz XTAL2
P30.3 P25 P26 P27 Vcc GND
Off On Power 0
Snooze
Alarm
P25 1K
3V Lithium Figure 6a. Optional LED Backlight Circuit Figure 8. LCD Direct Drive Demo Circuit
Light
AP97Z8X1800
Direct Drive of LCD Displays
Zilog
SOFTWARE IMPLEMENTATION The LCD Driver
The Real Time Clock
Button Inputs
All of the buttons except the backlight button are interrupt driven. The button routines are set up such that they can be interrupted by the LCD timer. In fact, the 10 ms LCD timer is used to create a 50 ms debounce delay after a button is pressed. Three of the four buttons have at least two modes of operation. The Alarm button serves to make the clock display the alarm time setting. It also toggles the alarm ON and OFF and shuts off the alarm buzzer. The snooze bar, similarly, causes the clock to display the snooze time-out setting and causes the alarm to go into snooze mode if pressed while the buzzer is sounding. The Advance button does nothing by itself but, when pressed
LCD Data Manipulation
AP97Z8X1800
Zilog while one of the other three buttons is held, causes the displayed time to increment. If the Advance button is depressed continuously, the rate of change accelerates. The exception, the Clock Set button, serves only to set the clock time and only functions in conjunction with the Advance button. The backlight button is not interrupt driven. It is sampled once each 10-ms period, after the LCD is updated. If
Direct Drive of LCD Displays pressed, the LED backlight is activated and a two-second timer is loaded. If the button is still down at the next sampling, the counter is reloaded. When the button is released, the counter starts decrementing. When it reaches zero, the LEDs are extinguished. The complete software listing is appended below.
AP97Z8X1800
Zilog
AP97Z8X1800
Direct Drive of LCD Displays
00000001B 00000001B 00001000B 00010000B 00010000B 00000010B
00101111B 00100000B 00100010B 00100100B 11110000B
AP97Z8X1800
Zilog
IRQ0 IRQ1 IRQ2 IRQ3 IRQ4 IRQ5
(P32) (P33) (P31) (P30) (T0) (T1)
Alarm button Advance button Time set button Snooze bar Just carrier, no IRQ Master clock / LCD timer
AP97Z8X1800
Stay in HALT until timer ticks MAIN
LD LD SRP LD CLR LD LD LD CLR LD LD LD CLR CLR CLR CLR CLR CLR CLR LD LD LD LD CALL CALL RET
Make sure light is off
Set minutes to snooze Set longest alarm time Load "Next" registers
SRP AND CLR CLR CLR CLR LD LD LD LD
Stop T1 Clear display
Phase 0 is next
Initialize to Phase 3
AP97Z8X1800
Zilog
Ignore further button IRQs
Discard any buttons pending
CALL JR EI JR OR LD LD AND AND LD EI TCM JR CALL AND LD IRET
Back to normal
CALL JR AND AND AND AND OR AND EI
AP97Z8X1800
Direct Drive of LCD Displays
Display alarm time Turn Turn Turn Only "AL" on on bell indicator alarm on allow ADV button or T1 IRQs
TCM JR CALL LD LD AND AND LD IRET
Wait for button release
Display current time Turn "AL" off Back to normal
CALL OR JR LD LD OR LD EI JR AND LD AND EI TCM JR CALL LD LD JR AND AND LD IRET
Set snoozing mode Init snooze counter Silence alarm Wait for button release
AP97Z8X1800
Direct Drive of LCD Displays
Zilog
ADVANCE:
FASTMODE:
AP97Z8X1800
Zilog
Direct Drive of LCD Displays
CP JR CLR CP JR ADD DA CP JR LD CALL EI JR JR CALL POP IRET
Wait for half second tick Inc snooze limit (BCD) 30 mins max
refresh, it must be on
Test P26 input Force light for 1 sec
SKIPCOMP:
AP97Z8X1800
Direct Drive of LCD Displays IRET
Zilog
Count 100ths of a second (decimal)
Turn off the backlight
Turn on the backlight
BCD so add, not inc BCD
Skip alarm if power off
AP97Z8X1800
Direct Drive of LCD Displays Write the new time data
JR JR TCM JR DJNZ AND LD JR LD RR XOR AND JR CP JR CP JR OR OR RET
DEC JR AND AND RET AND AND TCM JR LD CP JR RR JR OR LD JR
Blank out the hours digits See if hours should be blank
AP97Z8X1800
Zilog
AND AND AND AND TCM JR LD CALL RCF RRC JR OR OR OR AND SWAP OR RL SWAP OR RET
Blank out the minutes digits
See if minutes should be blank
Move D bit into carry Put D bit into new position
Drop off D segment bit Align nibbles Align bits
EI DI JR LD LD LD LD LD LD RET
Takes a packed BCD byte in R15 and returns with the corresponding digit nibbles in RR12 and RR14 PUSH RP
AP97Z8X1800
Direct Drive of LCD Displays
Packed BCD, 2 digits to display Put 10s digit in R15 and 1s digit in R14
Add digit as table offset (carry into upper byte) 10s digit code into R12
1s code into R15
TABLE:
.BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .BYTE .END
bafcged 01111011B 01001000B 01100111B 01101101B 01011100B 00111101B 00111111B 01101000B 01111111B 01111100B 01111110B 00011111B 00110011B 01001111B 00110111B 00110110B
AP97Z8X1800