ST AN594 Application note

AN594
Application note
Direct LCD drive with
ST621xx and ST626xx

Introduction

This note describesatechnique for drivingaLiquid Crystal Display (LCD) withastandard ST62 microcontroller (MCU), without any dedicated LCD driver. This technique offersadisplay capa­bility for applications which require a small display atalow cost together with the versatile ca­pabilities of the standard ST62xx MCU. Higher display requirements are easily handled by dedicated members of the ST62 MCU family, for example the ST6240B.
The first part of this note describes the typical waveforms required to drive an LCD correctly withamultiplexing rate of1or2(duplex). The following parts present two solutions based on standard ST62 MCUs driving directly the LCD. The first is based on an ST6215 without using software interrupts and the second on an ST6265 where the LCD is controlled by timer inter­rupts.
In both examples the program size, the CPUtime occupation due to the LCD drive and the number of surrounding components are minimized. Consequently many additional tasks can be added to the MCU program.

LCD requirements

Withazero Root Mean Square (RMS) voltage applied to it, an LCD is practically transparent. The LCD contrast, which makes the segments turn dark or opaque and thus “on”, is caused by the difference between the RMS LCD voltage applied and the LCD threshold voltage, specific to each LCD type.
The applied LCD voltage must alternate to giveazero DC value in order to ensurealong life
the LCD. The higher the multiplexing rate is, the lower the contrast, also the period of
time of the signal has to be short enough to avoid visible flickering of the LCD display. The LCD volt­age for each segment equals to the difference between theSand COM voltages (see Figure
1).
Figure 1. Equivalent electrical schematic of an LCD segment
October 2008 Rev 2
DC value should never be more than
-
100mV. Else time life can be shorten. Frequency range is 30-2000Hz typically.
-
Less, it flickers; more, consumption grows.
1/28

Direct LCD Drive

Direct LCD drive
Each LCD segment is connected to an I/O “Segment” and to one backplane common to all the segments. A display using S segments is driven with S+1 MCU output lines. The backplane is driven with a signal “COM” controlled between 0 and V
with a duty cycle of 50%.
DD
When selecting a segment “ON”, a signal with opposite polarity to “COM” is sent to the corre­sponding “Segment” pin. When the non-inverted signal “COM” is sent to the “Segment” pin, the segment is “OFF”. Using an MCU the I/O operate in output mode either at the logic levels 0 or
1.
Figure 2. LCD signals for direct drive
2/28

Duplexed LCD drive

For duplexed drive, two backplanes are used instead of one. Each LCD pin is connected to two LCD segments, each one connected on the other side to one of the two backplanes. Thus, only (S/2)+2 MCU pins are necessary to drive an LCD with S segments.
Three different voltage levels have to be gen­erated on the backplanes : 0, V
/2 and VDD.
DD
The “Segment” voltage levels are 0 and Vdd only. The LCD segment is inactive if the RMS voltage is below the LCD threshold voltage and is active if the LCD RMS voltage is above the threshold voltage. Figure 4 shows typical Backplane, Segment and LCD wave­forms.
The intermediate voltage V
/2 is only re-
DD
quired for the “Backplane” voltages. The ST62 I/O pins selected as “Backplanes” are set by software to output mode for 0 or Vdd levels and to high impedance input mode for V
/2. This voltage Vdd/2 is defined by two
DD
equal valued resistors externally connected to the I/O pin.
By using an MCU with flexible I/O pin config­uration such as the ST6215x or ST6265x, duplexed LCD drive can be made with only 4 additional resistors.
Direct LCD Drive
Figure 3. Basic LCD segment connec­tion in duplexed mode
3/28
Direct LCD Drive
Figure 4. LCD signals for duplexed mode (used in ST6215 example)
4/28
Direct LCD Drive

Example of duplexed LCD drive with ST6215x

The following example describes the drive in duplexed mode of an LCD with an ST6215. The software is made in such way that no interrupt is generated and an OFF state for the LCD is possible. The only components necessary are those to drive the ST62 (oscillator, reset,...) and four resistors to generate the backplane intermediate voltages.
The ST6215 has 20 I/O pins, thus it is able to drive up to 36 LCD segments and 2 backplanes. One digit is defined with 8 segments connected to 2 backplanes. Each digit can display 11 val­ues, from 0 to 9 and no display.
Each value to be displayed is associated to a certain LCD waveform. One LCD waveform pe­riod is separated in 4 steps corresponding to the 3 I/O configurations (1-0-input). A look-up ta­ble stores the bytes which relate the I/O configuration to the value to display.
Figure 5. ST6215 based example
5/28
Direct LCD Drive
The following tables show an example of linking one LCD digit of the display with the relevant MCU port se quences. The second digit follows the same scheme. These examples are for the sample LCD display, please adapt these tables to your particular LCD.
The digit segments are connected to PB0-PB3 lines in this example. Schematic is shown in Figure 5. Each digit configuration definesasegment status. Each couple of segments defines a timing sequence to be output by MCU “Segment” lines (see Figure 4). These sequences are coded inside the ST6215.
Table 1: Example of drive ofadigit with ST6215
Digit Segments to Display Segment Connections
Digit
Required
Digit
Required
a
f b
g
e
c
d
Segments
COM1 ON ON ON ON
COM2 OFF ON OFF ON
T1 0000 0h
T2 0101 5h
T3 1010 Ah
T4 1111 Fh
COM1 OFF OFF OFF OFF
COM2 OFF ON OFF ON
T1 1111 Fh
T2 1010 5h
T3 0101 Ah
T4 0000 0h
Status
Timing Sequences
Timing Sequences
Segment Line PB3 PB2 PB1 PB0
COM1 (PA6) d e f a
COM2 (PA7) OFF c g b
Segments
Status
MCU
Output
Sequences
MCU
Output
Sequences
Digit
Required
Blank
Digit
Required
Segments
COM1 OFF OFF OFF OFF
COM2 OFF OFF OFF OFF
Timing Sequences
T1 1111 Fh
T2 0000 0h
T3 1111 Fh
T4 0000 0h
COM1 OFF OFF ON OFF
COM2 OFF ON ON ON
Timing Sequences
T1 1101 Dh
T2 0111 7h
T3 1000 8h
T4 0010 2h
Status
Segments
Status
MCU
Output
Sequences
MCU
Output
Sequences
-
6/28
Digit
Required
Digit
Required
Segments
COM1 ON ON OFF ON
COM2 OFF OFF ON ON
Timing Sequences
T1 0010 2h
T2 0011 3h
T3 1100 Ch
T4 1101 Dh
COM1 ON OFF OFF ON
COM2 OFF ON ON ON
Timing Sequences
T1 0110 6h
T2 0111 7h
T3 1000 8h
T4 1001 9h
Status
Segments
Status
MCU
Output
Sequences
MCU
Output
Sequences
Digit
Required
Digit
Required
Segments
COM1 ON OFF ON ON
COM2 OFF ON ON OFF
Timing Sequences
T1 0100 4h
T2 0110 6h
T3 1001 9h
T4 1011 Bh
COM1 ON ON ON ON
COM2 OFF ON ON OFF
Timing Sequences
T1 0000 0h
T2 0110 6h
T3 1001 9h
T4 1111 Fh
Status
Segments
Status
MCU
Output
Sequences
MCU
Output
Sequences
Direct LCD Drive
Digit
Required
Digit
Required
Segments
COM1 OFF OFF OFF ON
COM2 OFF ON OFF ON
T1 1110 Eh
T2 0101 5h
T3 1010 Ah
T4 0001 1h
COM1 ON ON ON ON
COM2 OFF ON ON ON
T1 0000 0h
T2 0111 7h
T3 1000 8h
T4 1111 Fh
Status
Timing Sequences
Segments
Status
Timing Sequences
MCU
Output
Sequences
MCU
Output
Sequences
Digit
Required
Segments
COM1 ON OFF ON ON
COM2 OFF ON ON ON
Timing Sequences
T1 0100 4h
T2 0111 7h
T3 1000 8h
T4 1011 Bh
Status
MCU
Output
Sequences
7/28
Direct LCD Drive

Example of duplexed LCD drive with ST6265x

In this example the LCD drive tasks are controlled by interrupts from an on-chip timer. This soft­ware block can be easily included in a central task such as motor control, temperature measure­ment or heating. Figure 6 shows the circuit of the application. Only 4 resistors are added to drive the LCD in the duplexed mode.
Figure 6. ST6265x based example
8/28
Direct LCD Drive
The software for the LCD display operates in interrupt mode, driving I/O pins by the CPU at in­stants defined by the Timer1 interrupts. When the LCD drive tasks are finished, the main appli­cation program can continue.
The major tasks of the LCD display routine are:
generation of the alternate signals which control the backplanes (PB0, PB1)
-
drive of the LCD segments through PortA
-
conversion of the hexadecimal data to decimal data
-
program Timer1 for the next drive sequence
-
The backplane pattern sequences are different between ST6215x and ST6265x examples. The ST6215x software is based on non-symetrical signals (see Figure 4). The backplane pat­terns are symetrical in the ST6265x software. Both are equivalent on the LCD viewpoint.
The ROM code size used is 300 bytes for the program and 256 bytes for the tables. With an CPU frequency of 8MHz, the display task duration is 240μs and the full task duration including decimal conversion is 510μs. With an LCD period signal of 14ms, the CPU duty cycle of occu­pation is 2.5% for the LCD drive task. The program can be adjusted to other applications by modifying the timer duration (FASTIM) and the segment drive byte table. The LCD drive phase may also be synchronized to the mains zero crossing or a software loop duration, saving the timer for other tasks.

Summary

The examples presented in this note show that a simple LCD can be driven directly by standard ST621x/2x/6x/9x microcontrollers. The ST62’s flexible I/O configuration and the large voltage range of operation of the ST62 family MCU allow an LCD driver to be achieved with very few surrounding components, small CPU time occupation and reduced ROM program size.
Such an approach is a very cost effective solution for simple LCD displays operating with a multiplexing rate of 1 or 2 and up to 36 segments. For LCDs requiring more segment drive ca­pability and/or higher multiplexing rates ST624x and ST628x provide highly integrated and easy to implement solutions.
Such LCD drive features can easily be included in a larger application including keyboard inter­face, sensor display or motor control.
We thank the company Akotronic for the ST6215x application example they have developed for this note.
Annex 1: Software of the ST6215x based application Annex 2: Flowchart and software of the ST6265x based application
9/28
Loading...
+ 19 hidden pages