ST AN1447 Application note

AN1447
APPLICATION NOTE
SOFTWARE DRIVER F OR
4-MULTIPLEXED LCD WITH A STANDARD ST62
by Microcontroller Division Applications
DESCRIPTION
This note describes a technique for driving a 4-multiplexed Liquid Crystal Display (LCD) with a standard ST62 microcontroller (MCU), without any dedicated LCD driver peripheral. 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 ST6240. Solutions on how to use a standard ST6 to drive an LCD with a multiplexing ratio of 2 (duplex) can be found in Application Note AN594.
The first sect ion of this not e describ es the typic al wavefo rms re quired to driv e an LCD, fi rst
without multiplexing (“direct” drive), then with a multiplexing rate of 4. The second section ex­plains how to use a software library written in assembly language (MAST6 syntax) imple­menting a solution based on a standard ST62 MCU driving directly the LCD.
The program size and the CPU time occupation due to the LCD drive are minimized. Conse­quently many additional tasks can be added to the MCU program. Only few cheap additional components are required.
AN1447/0901 1/26
1
4-MULTIPLEXED LCD WITH A STANDARD ST62
1 LCD DRIVING PRINCIPLES
1.1 LCD REQUIREMENTS
An LCD segment can either be transparent (“off”) or opaque (“on”), depending on the voltage
COM
applied to it. On Figure 1, this voltage is the di fference between LCDs (ref lective pos itive d isplay s) an o paq ue segm e nt is se en dark and a tra nsp aren t seg ­ment is seen clear (same colour as the background).
Figure 1. Equivalent Electrical Schematic of an LCD Segmen t
and S voltages. On most
segment
electrode
backplane
S
C
R
s
COM
If no voltage is applied to it, a segment is transparent. To make it opaque, the LCD driver must apply an AC voltage which Root Mean Square (RMS) value is above a certain threshold. This voltage threshold depends on the LCD characteristics.
Segment voltage must also comply with the following conditions: – Its absolute DC (mean) value must be very low (under 100 mV typically). Otherwise, the life
time of the LCD can be shortened.
– Its frequency must be in the range 30 – 2000 Hz typical ly. If too low, the disp lay flickers. If
too high, driving generates more power consumption.
1.2 DIRECT LCD DRIVE
Each LCD segment is located between a segment electrode and a bac kplane common to al l
N
the segments (see Figure 2). Therefore, a display using connections:
2/26
N
“segment electrode” pins (S0, S1,…) and 1 “common” pin (COM).
segments contains (N+1) external
2
4-MULTIPLEXED LCD WITH A STANDARD ST62
d
0
d
0
d
0
d
Figure 2. Connections inside a direc t drive L CD
S
0
S
1
segment
electrodes
COM
backplane
All these pins are connected to MCU I/O pins operating in output mode, either at l ogic level 0 or at logic level 1.
COM
The backplane is driven with a signal
controlled between 0 and
50%. When se lectin g a segm ent ON , a sign al with oppos ite po larity to
sponding segment electrode pin. When the non-inverted signal electrode pin, the segment is OFF.
V
with a duty cycle of
DD
COM
is sent to the corre-
COM
is sent to the segment
Figure 3. LCD signals for non-multiplexed drive
COM
V
d
S
V
d
S∆
= COM - S
S
V
d
-V
d
Note: on Figure 3,
(
S∆)
RMS
S
signal is the “segment electrode voltage” and
= 0 ⇒ segment OFF
(
S∆)
RMS
= V
segment ON
dd
t
t
t
S
the “segment voltage”.
3/26
4-MULTIPLEXED LCD WITH A STANDARD ST62
1.3 4-MULTIPLEXED LCD DRIVE
For 4-multiplexed drive, four backplanes are used instead of one. The LCD segments are equally distributed between the four backplanes. They form groups of 4 segments, where each segment is allocated to a different backplane. All the segment electrodes (or frontplane electrodes) belonging to the same group are connected to a single external pin. Thus, a dis-
N
play using
segments contains (N/4+4) external connections:
ment electrodes (S
, S1,…) and 4 “common” pins (COM0, COM1, COM2 and COM3). On the
0
N/4
pins driving groups of seg-
rest of this document, the pins driving groups of segment electrodes are called “frontplane pins”.
Figure 4. Connections inside a 4-multiplexed LCD
COM
COM COM COM
segment
electrodes
S
3
2
1
0
pins driving groups of
segment electrodes
0
S
1
backplanes
Three different voltage levels have to be generated on the backplanes: 0, frontplane voltage levels are 0 and
V
only. Figure 5 shows typical backplane, frontplane and
DD
segment voltage waveforms. Each period is divided into 8 phases ϕ
continuously, whereas on S during phase ϕ
4/26
S
waveforms de pend on the r equired display. T he logic level ap plied
is the negation of the one applied during phase ϕ0, and so on for ϕ5 and
4
to ϕ7. Like in direct drive,
0
COM
waveforms are applied
V
DD
/2 and
V
. The
DD
4-MULTIPLEXED LCD WITH A STANDARD ST62
ϕ1, ϕ6 and ϕ5, ϕ7 and ϕ3. Changing the levels applied during phases ϕ0 and ϕ4 does not
change the DC value nor the RMS of value of
S
voltage, but affects its RMS, as explained in Table 1.
0
S
, S
and
S
1
2
voltages. It does not change the DC
3
Table 1. How to switch on e segment on and off in 4-multiplexe d d rive
S
waveform
H during ϕ0, L during ϕ L during ϕ0, H during ϕ
Segment S
DC RMS state DC RMS state
4
4
0 (3/4).V 0 (7/4).V
DD
DD
0
OFF 0
ON 0
Other segments
only depend on the rest of
S
waveform
Note that even if a segment is OFF, its RMS voltage is not zero. As a result, contrast is not as good as in direct drive. In addition, there is a risk of cross-talk (or ghosting): if segment voltage (
S
) frequency is too high, a s egment c an become opaq ue ev en though the RMS voltage is
i
below the threshold. So make sure that the driving frequency (considering the whole cycle, i.e. the 8 phases) is under 2000 Hz ty pically.
V
The intermediate voltage connected to the backplanes are configured by software to output mode for 0 or to high impeda nce i nput mod e fo r
/2 is only required for the backplane voltages. The ST62 I/O pins
DD
V
levels o r
dd
V
/2. This inte rmedia te vol tage i s defi ned by two eq ual-
DD
valued resistors externally connected to the I/O pin. By using an MCU w ith flexible I/O pi n confi guration such as a standa rd ST 62, 4-multip lexed
LCD drive can be made with only 8 additional resistors.
5/26
4-MULTIPLEXED LCD WITH A STANDARD ST62
d
d
d
d
d
d
d
d
d
d
d
d
d
Figure 5. LCD signals for 4-multiplexed m ode (used in library)
COM
COM
COM
COM
S
-V
S
-V
S
-V
S
-V
ϕ
0
V
d
0
1
V
d
0
2
V
d
0
3
V
d
0
S
V
d
0
= COM0 - S
0
V
d
0
d
1
V
d
0
d
2
V
d
0
d
3
V
d
0
d
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
ϕ
0
1
2
3
4
5
6
7
0
1
2
3
4
5
ϕ
6
7
t
t
t
t
t
t
(
S
0)RMS
= (3/4).
S0 OFF
V
dd
(
S
0)RMS
= (3/4).
S0 OFF
V
dd
t
(
S
1)RMS
= (3/4).
S1 OFF
V
dd
S
1)RMS
= (7/4).
(
S1 ON
V
dd
t
(
S
2)RMS
= (3/4).
S2 OFF
V
dd
S
2)RMS
= (3/4).
(
S2 OFF
V
dd
t
(
S
3)RMS
= (3/4).
S3 OFF
V
dd
S
3)RMS
= (7/4).
(
S3 ON
V
dd
6/26
4-MULTIPLEXED LCD WITH A STANDARD ST62
2 LCD DRIVING SOFTWARE LIBRARY
This library consists in one MAST6 source file, LCD_drv.st6, and its associated include file, LCD_drv.inc. It is targeted to a certain kind of LCD structure. Source code is provided to fa-
cilitate customisation to a particular LCD and application. T he following section presents some guidelines on how to use and customize the library.
The targeted LCD is organized into four classical 7-segment digits, plus four icons (e.g. a
colon at the middle), creating four “8-segment digits”. Each digit uses the four backplane pins and two frontplane pins.
Figure 6. Connections for an 8-segment digit (example with a colon)
S
3
2
COM
3
COM
2
COM
1
COM
0
AM PM
S
°C
Typically, this kind of LCD is suited to 24-hour c lock display. Therefore, the dig its are called, from left to right: “hours digit 1”, “hours digit 0”, “minutes digit 1”, “minutes digit 0”.
The first part of this section explains how to use the library provided the LCD is wired exactly like the target is, and provided the MCU pin allocations are compatible with the rest of the ap­plication. The second part give s m ore details on the data o perations pe rformed intern ally by the driver, to be able to customise it if necessary. Finally, the thi rd part gives an example of how to manage timing resources to combine LCD requirements with the main tasks of the ap­plication.
2.1 NON-CUSTOMISED USAGE
2.1.1 Allocation of I/O resources
S
All the MCU output pins generating the
signals are located in the same I/O port, cal led “seg-
ments port”. A diff eren t I/O po rt, c alle d “com mon s po rt” is u sed fo r the pi ns ge nera tin g the
COM
signals. The software driver has no effect on the other I/O pins, even if they are located
in one of those ports.
7/26
4-MULTIPLEXED LCD WITH A STANDARD ST62
The code uses DR_seg, DDR_seg and OR_seg labels to access the configuration registers of the segments port. DR_com, DDR_com and OR_com labels are used for the commons port. DR_seg_2 and DR_com_2 are labels referring to RAM variables used as shadow I/O port Data Registers. The se 8 labe ls are decla red as e xterna l at t he beginning o f L CD_d rv.st6. Therefore, to make the library work, y ou mus t define th em as sy nonyms o f actual configura­tion registers, like in the following example:
DDR_com DATA DDRB DR_com DATA DRB OR_com DATA ORB
DDR_seg DATA DDRA DR_seg DATA DRA OR_seg DATA ORA
DR_com_2 DATA DRB_2 DR_seg_2 DATA DRA_2
These definitions must be performed in another source file which is to be linked with LCD_drv.st6.
Note: in this example, DRA_2 and DRB_2 definitions must be in the same source file as DR_seg_2 and DR_com_2 definitions, otherwise the DATA directive does not wor k.
Once the segments and commons ports defined, the MCU must be wired according to Figure
6. Note that a pair of S pins is assigned to each “8-segment digit”. To understand the roles of each of the two pins, refer to Figure 6.
8/26
Loading...
+ 18 hidden pages