ST AN594 Application note

AN594

Application note

Direct LCD drive with

ST621xx and ST626xx

Introduction

This note describes a technique for driving a Liquid Crystal Display (LCD) with a standard ST62 microcontroller (MCU), without any dedicated LCD driver. This technique offers a display capability for applications which require a small display at a low cost together with the versatile capabilities 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 with a multiplexing rate of 1 or 2 (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 interrupts.

In both examples the program size, the CPU time 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

With a zero 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 give a zero DC value in order to ensure a long life time of the LCD. The higher the multiplexing rate is, the lower the contrast, also the period of the signal has to be short enough to avoid visible flickering of the LCD display. The LCD voltage for each segment equals to the difference between the S and COM voltages (see Figure 1).

Figure 1. Equivalent electrical schematic of an LCD segment

- 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.

October 2008

Rev 2

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 VDD with a duty cycle of 50%.

When selecting a segment “ON”, a signal with opposite polarity to “COM” is sent to the corresponding “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

Direct LCD Drive

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 generated on the backplanes : 0, VDD/2 and VDD. 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 waveforms.

The intermediate voltage VDD/2 is only required 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 VDD/2. This voltage Vdd/2 is defined by two equal valued resistors externally connected to the I/O pin.

By using an MCU with flexible I/O pin configuration such as the ST6215x or ST6265x, duplexed LCD drive can be made with only 4 additional resistors.

Figure 3. Basic LCD segment connection 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 values, from 0 to 9 and no display.

Each value to be displayed is associated to a certain LCD waveform. One LCD waveform period is separated in 4 steps corresponding to the 3 I/O configurations (1-0-input). A look-up table 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 sequences. 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 defines a segment 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 of a digit with ST6215

Digit Segments to Display

Segment Connections

 

 

 

 

a

Segment Line

PB3

PB2

PB1

PB0

f

 

b

 

COM1 (PA6)

d

e

f

a

 

g

 

e

 

c

COM2 (PA7)

OFF

c

g

b

 

d

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Digit

Segments

 

 

 

 

 

Required

Status

 

 

 

 

 

 

 

COM1

ON

ON

ON

ON

 

MCU

 

 

 

COM2

OFF

ON

OFF

ON

 

Output

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

T1

0

0

0

0

 

0h

 

 

 

 

 

T2

0

1

0

1

 

5h

 

 

 

T3

1

0

1

0

 

Ah

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T4

1

1

1

1

 

Fh

 

Digit

 

Segments

 

 

 

Required

 

 

Status

 

 

 

 

 

 

COM1

OFF

OFF

OFF

OFF

 

MCU

 

 

 

COM2

OFF

ON

OFF

ON

 

Output

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

 

 

 

T1

1

1

1

1

 

Fh

 

 

 

T2

1

0

1

0

 

5h

 

 

 

T3

0

1

0

1

 

Ah

 

 

 

T4

0

0

0

0

 

0h

 

Digit

 

Segments

 

 

 

Required

 

 

Status

 

 

 

 

 

 

COM1

ON

ON

OFF

ON

 

MCU

 

 

 

 

 

 

 

 

 

COM2

OFF

OFF

ON

ON

 

Output

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

T1

0

0

1

0

 

2h

 

 

 

T2

0

0

1

1

 

3h

 

 

 

T3

1

1

0

0

 

Ch

 

 

 

 

 

T4

1

1

0

1

 

Dh

 

Digit

 

Segments

 

 

 

Required

 

 

Status

 

 

 

 

 

 

COM1

ON

OFF

OFF

ON

 

MCU

 

 

 

 

 

 

COM2

OFF

ON

ON

ON

 

Output

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T1

0

1

1

0

 

6h

 

 

 

T2

0

1

1

1

 

7h

 

 

 

T3

1

0

0

0

 

8h

 

 

 

 

 

T4

1

0

0

1

 

9h

 

Digit

 

 

Segments

 

 

 

Required

 

 

 

Status

 

 

 

 

 

 

 

COM1

OFF

OFF

OFF

OFF

 

MCU

 

 

 

 

COM2

OFF

OFF

OFF

OFF

 

Output

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

Blank

T1

1

1

1

1

 

Fh

 

 

 

 

T2

0

0

0

0

 

0h

 

 

 

 

T3

1

1

1

1

 

Fh

 

 

 

 

T4

0

0

0

0

 

0h

 

Digit

 

 

Segments

 

 

 

Required

 

 

 

Status

 

 

 

 

 

 

 

COM1

OFF

OFF

ON

OFF

 

MCU

 

 

 

 

COM2

OFF

ON

ON

ON

 

Output

 

 

 

 

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

 

 

T1

1

1

0

1

 

Dh

 

 

 

 

T2

0

1

1

1

 

7h

 

 

 

 

T3

1

0

0

0

 

8h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T4

0

0

1

0

 

2h

 

Digit

 

 

Segments

 

 

 

Required

 

 

 

Status

 

 

 

 

 

 

 

COM1

ON

OFF

ON

ON

 

MCU

 

 

 

 

 

 

 

 

 

COM2

OFF

ON

ON

OFF

 

Output

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

T1

0

1

0

0

 

4h

 

 

 

 

T2

0

1

1

0

 

6h

 

 

 

 

T3

1

0

0

1

 

9h

 

 

 

 

 

 

 

 

T4

1

0

1

1

 

Bh

 

Digit

 

 

Segments

 

 

 

Required

 

 

 

Status

 

 

 

 

 

 

 

COM1

ON

ON

ON

ON

 

MCU

 

 

 

 

 

 

 

 

 

COM2

OFF

ON

ON

OFF

 

Output

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

T1

0

0

0

0

 

0h

 

 

 

 

 

 

 

 

T2

0

1

1

0

 

6h

 

 

 

 

T3

1

0

0

1

 

9h

 

 

 

 

T4

1

1

1

1

 

Fh

6/28

Direct LCD Drive

Digit

Segments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Required

Status

 

 

 

 

 

 

 

Digit

 

Segments

 

 

 

 

 

COM1

OFF

OFF

OFF

 

ON

 

MCU

Required

 

 

Status

 

 

 

 

 

COM2

OFF

ON

OFF

 

ON

 

Output

 

 

 

COM1

ON

OFF

ON

 

ON

 

MCU

 

 

 

 

 

 

 

 

 

Sequences

 

 

 

COM2

OFF

ON

ON

 

ON

 

Output

 

 

 

Timing Sequences

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T1

1

1

1

 

0

 

Eh

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T2

0

1

0

 

1

 

5h

 

 

 

 

T1

0

1

0

 

0

 

4h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T2

0

1

1

 

1

 

7h

 

 

T3

1

0

1

 

0

 

Ah

 

 

 

 

 

 

 

 

T4

0

0

0

 

1

 

1h

 

 

 

 

T3

1

0

0

 

0

 

8h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T4

1

0

1

 

1

 

Bh

Digit

 

Segments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Required

 

 

Status

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

COM1

ON

ON

ON

 

ON

 

MCU

 

 

 

 

 

 

 

 

 

 

 

 

 

COM2

OFF

ON

ON

 

ON

 

Output

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Timing Sequences

 

 

Sequences

 

 

 

 

 

 

 

 

 

 

 

 

 

T1

0

0

0

 

0

 

0h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T2

0

1

1

 

1

 

7h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T3

1

0

0

 

0

 

8h

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T4

1

1

1

 

1

 

Fh

 

 

 

 

 

 

 

 

 

 

 

 

7/28

ST AN594 Application note

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 software block can be easily included in a central task such as motor control, temperature measurement 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 instants defined by the Timer1 interrupts. When the LCD drive tasks are finished, the main application 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 patterns 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 occupation 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 capability 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 interface, 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