This note describesatechnique for drivingaLiquid Crystal Display (LCD) withastandard ST62
microcontroller (MCU), without any dedicated LCD driver. This technique offersadisplay capability for applications which require a small display atalow 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
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 interrupts.
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 voltage 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 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
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, 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 waveforms.
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 configuration 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 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 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 DisplaySegment Connections
Digit
Required
Digit
Required
a
fb
g
e
c
d
Segments
COM1 ON ON ON ON
COM2 OFF ON OFF ON
T100000h
T201015h
T31010Ah
T41111Fh
COM1 OFF OFF OFF OFF
COM2 OFF ON OFF ON
T11111Fh
T210105h
T30101Ah
T400000h
Status
Timing Sequences
Timing Sequences
Segment LinePB3PB2PB1PB0
COM1 (PA6)defa
COM2 (PA7)OFFcgb
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
T11111Fh
T200000h
T31111Fh
T400000h
COM1 OFF OFF ON OFF
COM2 OFF ON ON ON
Timing Sequences
T11101Dh
T201117h
T310008h
T400102h
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
T100102h
T200113h
T31100Ch
T41101Dh
COM1 ON OFF OFF ON
COM2 OFF ON ON ON
Timing Sequences
T101106h
T201117h
T310008h
T410019h
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
T101004h
T201106h
T310019h
T41011Bh
COM1 ON ON ON ON
COM2 OFF ON ON OFF
Timing Sequences
T100000h
T201106h
T310019h
T41111Fh
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 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
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.