http://www.eetasia.com/STATIC/PDF/200910/EEOL_2009OCT12_OPT_EMS_AN_01.pdf?SOURCES=DOWNLOAD

LCD Direct Drive Basics
AN52927
Author: Geethesh NS
Associated Project: Yes
Associated Part Family: CY8C38xxx
Software Version: PSoC Creator™ 1.3
Associated Application Notes: AN2228
Application Note Abstract
This application note discusses the electrical parameters that affect the operation of LCD glass. It also describes how to
control them using the LCD driver available in PSoC3 and PSoC5. This document illustrates two examples: one using the CY
DVK CY8CKIT-001 kit with simple LCD glass and the other using LCD EVK board with complex glass.
Introduction
This application note discusses how to control the
electrical parameters of LCD glass using PSoC Creator™.
It helps you understand the following:


Effect of electrical parameters on LCD operation.
Controls and settings available in PSoC Creator and
the effect of these settings on LCD operation.
Section 1: LCD Basics
LCDs are classified based on light source, operating
modes, and viewing angle.
Light Source
Based on light source, there are three types of LCDs:



Operating Modes
Based on operating modes, there are four types of LCDs:




Twisted Nematic (TN)
Super Twisted Nematic (STN)
Film Compensated STN (FSTN)
Color STN (CSTN)
In each of these, the orientation of the light passing
through the LCD structure is twisted differently to affect
contrast and coloration.
Transmissive
Reflective
Transflective
Transmissive displays have a clear polarizer in the front
and back. They depend on light coming from behind the
display towards the observer, to be visible.
Reflective displays have an opaque rear polarizer that
includes a diffuse reflector. This layer reflects polarized
ambient light that has entered the front of the display back
through the LCD cell. Reflective displays require ambient
light to be visible. They exhibit high brightness, excellent
contrast, and wide viewing angles. They are particularly
suitable for use in battery operated equipment where an
adequate level of light is always available. Reflective
LCDs cannot be backlit; they can be front lit in some
applications.
May 26, 2009
Transflective displays have a rear polarizer that includes
a translucent material which reflects part of the ambient
light and also transmits backlighting. As the name implies,
it is a compromise between the transmissive and reflective
LCD types. When used in reflection, it is not as bright and
has lower contrast than the reflective type LCD. However,
it can be backlit for use in low light conditions.
TN displays have a twist (the rotation of molecules from
one plane of the display to the other) of 90 degrees or
less.
STN LCDs have a twist greater than 90 but less than 360
degrees. Most STN displays have a twist between 180
and 270 degrees.
FSTN displays add a retardation film to the STN display
that compensates for the color added by the birefringence
(double refraction) effect. It provides a higher contrast and
wider viewing angle.
CSTN provides full color reproduction by inserting an
internal RGB color filter layer in the LCD with features
such as wide viewing angles and 65k colors. It is suited for
telecommunication and handheld consumer devices.
Document No. 001-52927 Rev. **
1
[+] Feedback
AN52927
Viewing Angle
The orientation of an LCD‟s bias angle is often stated with
reference to a clock face. The bias angle is the angle from
the perpendicular from which the LCD glass is best
viewed.
If the offset is above the display, it is referred to as a
"12:00" or "top" view. If the offset is below the display, it is
referred to as a “6:00" or “bottom" view.
The viewing angle is the angle formed on either side of the
bias angle, at which the contrast of the display is still
considered acceptable.
Image
Positive Image
The display appears as a dark image on a light
background. Unenergized pixels allow light and energized
pixels obstruct the light creating dark images on the light
background.
Negative Image
The display appears as a light image on a dark
background. Unenergized pixels inhibit light from passing
through the display. Energized pixels allow the light to
pass creating a light image on a dark background.
Drive Mode
The LCD must only be driven with AC voltages. DC
voltage deteriorates the liquid crystal fluid so it cannot be
energized.
LCD driver waveforms are designed to create 0-Vdd
potential across all LCD segments.
Frequencies for direct drive displays are typically between
30 Hz and 100 Hz, depending on display size and design.
Displays can operate at higher frequencies, but this
increases power consumption. LCDs mimic a capacitive
load, which reduces the load impedance as frequency
increases. However, operation below 30 Hz usually results
in visible flicker of the segments.
LCDs are overdriven by a combination of voltage and
frequency, which result in cross talk or "ghosting".
Ghosting is the appearance or partial activation of an "off"
segment. This condition occurs when high drive voltage
and frequency are applied. Because the current is directly
proportional to the frequency, the voltage-frequency
product must not be exceeded. It is also important to
connect all unused segments to the backplane, and not
allow them to float.
The main advantage of static drive is that it is simple to
implement. You only have to worry about which segment
line to turn on and off, while activating the common signal
all the time. Another advantage is that voltage levels can
go from rail to rail and do not require multiple intermediate
levels.
The disadvantage is that it requires more pins. Every pixel
must have a segment line tied to it, and segment lines are
connected to pins on a PSoC or an MCU.
Figure 1 shows an example of static LCD waveforms. If
the segment waveform equals a common waveform, then
the segment is in OFF state. If the segment waveform
equals an inverted common waveform, then the segment
is in ON State.
Figure 1. Static LCD Waveforms
Common
VDD
Common
There are two types of drive modes:


VDD
Static Drive
OFF Segment
Multiplexed Drive
VDD
ON Segment
Static Drive
The LCD is an RMS voltage responsive device. This
means that the contrast of a given segment is dependent
upon the RMS value of the applied voltage across it,
measured with respect to common plane.
Segments
In static drive, the display uses only one common or
backplane signal. Every pixel has its own segment and
frontplane line.
VDD
0V
Resulting Voltage
(Common-Segment)
OFF Segment
-VDD
VDD
0V
Resulting Voltage
(Common-Segment)
ON Segment
-VDD
The common line acts as an “activation” signal, preparing
all the pixels that it touches to be turned on by respective
segment lines.
The segment lines act as a “selector” signal, specifying
whether a pixel is turned ON or OFF. When the common
line is not activated, the segment lines have no effect on
the pixel state.
May 26, 2009
Document No. 001-52927 Rev. **
2
[+] Feedback
AN52927
Multiplexed Drive
In multiplexed drive, the display uses two or more
common signals. The activation of pixels is timemultiplexed (staggered), using the number of time
divisions equal to twice the number of common planes.
Similar to conventional LCDs, the voltage at all segment
locations must be caused to reverse polarity periodically
so that zero net DC voltage is applied. This is necessary
to prevent irreversible electrochemical action from
destroying the display. This is the reason for doubling in
time divisions—each common plane must be alternately
driven with a voltage pulse of opposite polarity. The cycle
between the first and second time frames is fast enough
for the naked eye to see selected pixels turning on at the
same time.
The following are important terms associated with the
multiplexed drive.




contains a stair-stepped waveform. This maintains specific
AC voltages across any given segment, dot, and pixel to
keep it in its "on" or "off" state. The LCD bias number (for
example, 1/5 bias) indicates how many voltage reference
points are created to drive a specific LCD. Table 1 shows
the relationship between the number of driving bias
voltages and the display multiplex ratios typically used.
Table 1. Driving Biases and Mulitplex Ratios
Mux Ratio
Biases
Static
2
½
½ bias (3)
1/3,1/4
1/3 bias (4)
1/7,1/8,1/11,1/12
¼ bias (5)
1/14,1/16
1/5 bias (6)
Duty ratio (Mux ratio)
As shown in Table 1, the relation between mux and bias is
1/(sqrt(commons)+1) and the voltage level amount used to
power the LCD display is equal to voltage steps+1 (the
number indicated in the bracket).
Bias type
Waveform Type
Frame frequency
Waveform type
Frame Frequency
The LCD frame frequency is the rate at which the
backplane and segment outputs change to their energizing
levels. The typical range of frame frequency is between 50
and 150 Hz. Higher frequencies result in higher power
consumption and lower frequencies cause image flickering
on the LCD.
Duty Ratio
Duty cycle ratio or duty cycle indicates the number of
commons, normally defined as the inverse of the number
of commons/backplanes. For example if the display has
four commons, then the duty ratio is 1/4.
The process of refreshing an LCD with n backplanes
(commons) and m frontplanes (segments) is similar to the
matrixed keyboard operation. The driver selects one
backplane BPx (corresponding to a column on a
keyboard) and drives the appropriate voltage levels to all
frontplanes FP1 to FPm associated with that backplane
(corresponding to keyboard rows). The remaining
backplanes are driven to an unselected voltage level. This
process is then repeated for all backplane electrodes of
the display. Therefore, the full refresh cycle of the display
has n phases, one for each backplane electrode. The cells
corresponding to the visible segments are driven to the
“active” voltage level only in one (selected) phase of the
refresh cycle and to an “inactive” voltage level in the
remaining (unselected) phases. This is why the number of
phases of the refresh cycle is typically expressed as a
duty ratio 1/n.
Bias Type
Bias is the number of voltage steps to be applied to the
LCD. To control LCDs with a larger multiplex ratio, you
must provide the waveform generator with multiple bias
voltage level points. The resulting waveform sent to the
LCD segment control lines and backplane/commons
May 26, 2009
Multiplexed LCDs can be driven by two types of
waveforms. These are called Type A and Type B in LCD
specifications and data sheets (see Figure 2). Type A
waveforms take single frames to maintain 0 Vdd. Type B
waveforms take two frames to maintain 0 Vdd.
Figure 2. Type A and Type B Waveforms
Type-A
Type-B
1 Frame
Common
Waveform
(generated by
driver)
Segment
Waveform
(generated by
driver)
1 Frame
3
3
2
2
1
1
0
0
3
3
2
2
1 Frame
1
1
0
0
3
3
2
2
1
Common-Segment
0
(as seen across pixel)
-1
-1
-2
-2
1
0
-3
-3
Liquid Crystals
are energized
Liquid crystals
is energized
The main difference between the two types of waveform is
in the frequencies of voltages applied to the LCD pixels.
From Figure 2, it is clear that type A waveforms contain
many more edges than type B waveforms. The lower
frequencies in type B waveforms have one major
advantage. Because the LCD represents a capacitive
load, the drive current rises with frequency. Therefore,
type B waveforms result in lower power consumption. This
is especially important in battery powered applications.
The length of the refresh cycle is the same for both types
of waveform. Therefore, there are no differences between
type A and type B waveforms in refresh rate dependent
optical parameters of the LCD segments. Contrast is
dependent on the light source available, viewing angle,
multiplex mode, and the LCD voltage levels. The first three
parameters are directly related to LCD glass and the
fourth can be controlled by the LCD driver. The LCD bias
adjustment controls the contrast between the LCD
segment in on and off states. This voltage must be
optimized for best appearance. A greater voltage
Document No. 001-52927 Rev. **
3
[+] Feedback
AN52927
separation between common and segment pins allows
better contrast.
Figure 3 Front Panel of LCD Glass
The main advantage of multiplex drive is that it saves pins.
Using more common lines for more complex displays can
save a significant number of pins.
The disadvantage of multiplex drive is that it provides less
contrast than the static drive. To get the same contrast as
static drive, higher LCD voltages or a different type of
liquid crystal is needed.
Section 2: Interfacing to a Simple
LCD Glass using DVK1 Development
Board
The pin connection for segment and commons in the LCD
glass are shown in Table 2.
Requirements






DVK1 board and accessories
Table 2. Pin Connections
Processor module with CY8C3866AXI-040
LCD glass (Digikey part no153-1046-ND)
MiniProg3 and accessories
PSoC Creator
PSoC Programmer™
For the first example, use the simple glass with three
commons and 31 segments. Choose VIM-404 from
Varitronix with Digikey part number 153-1046-ND.
Following are few important specification of the simple
LCD glass:







Display type: TN
A unique feature of PSoC® LCD direct drive is that any pin
can be configured either as common or segment. This
makes routing much easier. For this example, route the
LCD pins to Port 3 and Port 5, which are wired to port A
on the DVK1 board (Table 3).
Table 3. Pin Connections between LCD Glass and PSoC
Viewing direction: 6 o‟clock
Function
LCD Pin
PSoC Pin
Drive method: 1/3 duty, 1/3 bias
COM0
11
P3[5]
Operating voltage: 5V
COM1
20
P5[6]
COM2
8
P3[4]
Polarizer mode: Reflective
SEG0
4
P3[0]
Operating temperature: -10oC to 60oC
SEG1
5
P3[1]
Connection: Pin
SEG2
6
P3[2]
SEG3
7
P3[4]
SEG4
12
P3[6]
SEG5
13
P3[7]
SEG6
14
P5[0]
SEG7
15
P5[1]
SEG8
16
P5[2]
SEG9
17
P5[3]
SEG10
18
P5[4]
SEG11
19
P5[5]
This glass has four 7-segment digits and three decimal
points. The front panel drawing is shown in Figure 3.
May 26, 2009
Document No. 001-52927 Rev. **
4
[+] Feedback
AN52927
With this information on the glass and its interface details
with PSoC, you can work with the segment LCD
component available in PSoC Creator. The following
operations are performed using this component:
1.
Select number of commons and segments
2.
Select type of waveform required
3.
Set frame rate or refresh rate
4.
Select bias voltage or set up contrast level
5.
Set driver power level
6.
Select display helpers
To start, rename the component as SegLCD in the Name
field.
Figure 4. Configure Window
Creating a Simple Project using a Segment
LCD Component
Exercise 1
Display numbers from 0 to F in sequential order on each
digit of an LCD glass starting from the left.
Creating the Project
The parameters for the Basic Configuration tab are shown
in Figure 4. They include the following.
Follow these steps to create a project:
1.
Select Start > Programs > Cypress > PSoC
Creator.
2.
In PSoC Creator, select File > New > New Project.
3.
In the new project window, select Empty PSoC3
Design and enter „LCDExercise1‟ in the project name
field.
4.
Browse to select a suitable location for the project.
5.
To select the device, click Advanced; in the Device
field, launch the device selector to select a suitable
device. For this exercise, CY8C3866AXI-040 is
selected. The other settings are at default.
6.
Click OK to create the project or workspace.
Selecting Segment LCD Component
When the project is open, two tabs are displayed: Start
Page and TopDesign.cysch. In the TopDesign.cysch tab,
select Segment LCD from the component catalog under
display category. Drag and drop it to the canvas.
Configuring the LCD
This section focuses on how each parameter set during
configuration affects the display rather than on what each
parameter setting does. You can find the functions of each
parameter setting in the component data sheet. To access
these data sheets, right click the component and select
the data sheet.
To configure the LCD, right click the component and select
Configure. A configure window is displayed, as shown in
Figure 4. There are three tabs of interest, Basic
Configuration, Driver Power Settings, and Display Helpers.
The other is Built-in, which is not discussed in this
application note. Set the parameters in that tab to default.
With the following settings and small piece of code, you
can build, run, and test the project.
May 26, 2009
Number of common lines: This setting is dependent on
the glass used. For this exercise, set it to „3‟ because the
glass used has three commons, as shown in Table 2 on
page 4.
Number of segment lines: This parameter is also glass
dependent. For this exercise, set it to 12 because the
glass used has 12 commons, as shown in Table 2 on
page 4.
Bias type: This parameter is read only and is set by the
tool depending on the number of commons. Refer Bias
Type on page 3.
Waveform type: This affects the current consumption, as
explained in Waveform Type on page 3. Initially, select
default type A for this exercise.
Frame rate: This parameter determines how many times
each segment is refreshed in a second. For this example,
set it to 50 Hz. This means that each of the 31 segments
in the glass are refreshed 50 times in one second. It can
also mean that each of the commons and their respective
segments are refreshed 50 times in one second.
Bias voltage: This parameter controls the contrast of the
display. Refer Waveform Type on page 3. Intially, set it to
3.3.
Enable ganging commons: This is useful when driving a
glass with very large segments or when the capacitance
offered by commons is greater than 5000 pF. For this
exercise, leave it unchecked.
Document No. 001-52927 Rev. **
5
[+] Feedback
AN52927
Next, set the parameters in the Driver Power Settings tab
as seen in Figure 5. The settings in this tab directly control
the parameters related to driver implementation.
Figure 5. Driver Power Settings Tab
Low drive initial time: This is active only when Low
Power is selected in Driver Power Mode. It specifies the
duration that the low drive buffer should be active before
going to no drive mode.
Low drive duty cycle: This is active only when Low
Power is selected in Driver Power Mode. It refers to the
time that the drive signal must be low between
transistions. A greater duty cycle means the drive signal
stays high between trasistions for a less time. This is set
based on the size of the dispay. If the display is small, this
parameter is set to a high value. It should be set low when
the display is large.
The parameters in the Display Helpers tab are set as
shown in Figure 6. The settings in this tab helps to map
pixel information to the frame buffer or the display RAM
and generates the APIs to use them.
If display helper is not used, you have to map the pixel
information to the frame buffer and also create the library
functions that write the data.
Driver Power Mode: There are two options: Always
Active and Low Power.


Figure 6. Display Helpers Tab
In Always Active mode, the analog resources
connected with the LCD driver are always ON.
In Low Power mode, these resources are ON only
between voltage transistions.
For this example, select Always Active. The last three
settings, which are related to low power, remain inactive.
1
These settings help to reduce the current consumption by
the driver. They are decided by the type of application the
LCD is used for. For example, in battery operated
applications, it is best to work with Low Power settings .
Hi drive time: This parameter is set to its minimum value
by the tool, depending on the frame rate, number of
commons, and type of waveform selected. It determines
the time that high drive buffer in the driver implementation
should stay high to charge the capacitor (pixel). More time
means more current is drawn. Keep the default value that
is set by the tool.
Low drive mode: This is active only when Low Power is
selected in Driver Power Mode.
When implementing the LCD driver there are two low drive
modes: low range and high range. The low range mode
takes over from the high drive mode and charges the
display capacitor to the required level and turns it off. High
range provides high currrent to compensate for any
leakage in the display.
2
3
For this exercise use the glass that has 4-digit, 7-segment
display as shown in Figure 3 on page 4.
1.
Select „7 Segment‟.
2.
Click the right arrow (Helper_7Segment_0 is seen in
the Selected Helpers field).
3.
Click Helper_7Segment_0 (the 7-segment symbol
appears as shown in Figure 7).
The selection of mode is dependent on the type and size
of the display. For large displays, high range is selected if
any leakage is observed in the low range.
May 26, 2009
Document No. 001-52927 Rev. **
6
[+] Feedback
AN52927
Figure 7. Number of Symbols
The next steps are to select a pixel, rename it, and assign
it to the pixel mapping table. These steps are indicated in
Figure 8. Renaming the pixel is easy if you use the same
name as that of the LCD glass. For this execise, follow
Figure 3 on page 4 and Table 2 on page 4.
1
The display used in this exercise has four 7-segment
symbols. Click the “+” button to add four symbols. Figure 8
shows the dialog box after four symbols are added.
Click segment A of the fourth symbol referring to LCD
glass.
2.
In the Selected pixel name field “H7SEG0_A”
appears. When renaming, do not change the
complete name; only change the second part.
Rename it as “H7SEG0_4A.” This is also explained in
the component data sheet.
3.
Drag and drop the selected pixel to pixel mapping
table. Make sure that the pixel matches Table 2 and
Table 3 on page 4
After repeating the above procedure for all the pixels,
verify that the relationship between the segments and
commons of the glass is maintained in the pixel mapping
table. Notice that the index of common and segments of
glass starts from 1, whereas in the tool it starts from 0.
This does not cause any problems as long as the common
and segment relationship between glass and pixel table
are maintained. After pixel mapping is completed for all
pixels of the display the pixel mapping appears as shown
in Figure 9.
Figure 9. Pixel Mapping
Figure 8. Four Symbols Added
1
1.
3
2
After complete pixel assignment, the Display Helpers tab
appears as shown in Figure 10.
May 26, 2009
Document No. 001-52927 Rev. **
7
[+] Feedback
AN52927
Figure 10. Pixel Assignment
Build and Test the Project
Click main.c located in the source files in the workspace
explorer window. Copy the following code into main.c.
C Code for LCDExcercise1
#include <device.h>
void main()
{
//variables for delay routine
uint16 iDelay;
char cXiDelay;
//variables for code Sample1
char
cValue=0;
char cPosition=3;
CY_SET_REG8(0x46F0,0xD4);
//Magic analog key
CY_SET_REG8(0x46F1,0xAA);
CY_SET_REG8(0x46F2,0x56);
CY_SET_REG8(0x46F3,0xC9);
CY_SET_REG8(0x43a8,0x0f);
CY_SET_REG8(0x5876,0x66);
//global and mux bus pump enable
CY_SET_REG8(0x5877,0x66);
SegLCD_Start();
Click Apply and
configuration.
then
click
OK
to
complete
the
LCD to PSoC Pin Assignment
To map the LCD glass pins to PSoC, open the design
wide resource tab “LCDExercise1.cydwr” by either right
clicking the project in the workspace explorer window or
clicking the LCDExcercise1.cydwr seen in the source files.
The cydwr tab has many other tabs, but our interest is in
the pins tab. Click this tab; the pinout of the chip appears
at the centre and to its right is the pin assignment window.
In that window, click the last column and assign the pins to
its respective name, which are seen in the second column.
This must match Table 2 on page 4. After pin assignment,
the window appears as shown in Figure 11.
Figure 11. Pin Assignment Window
for(;;)
{
for(cXiDelay=0;cXiDelay<0x8;cXiDelay++)
{for(iDelay=0;iDelay<0xFFFF;iDelay++);
}
SegLCD_Write7SegDigit_0(cValue,cPosition);
cValue++;
if(cValue>16)
{
cValue=0;
cPosition--;
SegLCD_ClearDisplay();
if(cPosition==0)cPosition=3;
}
}
}
Build the project by clicking the Build button or going
through build menu. After successful build, note that in the
cydwr pins all pins are assigned in the routing results
column.
Now, program the chip using either PSoC Programmer or
PSoC Creator. To do this, click the program button or
select program in the debug menu.
After successful programming, the display on the LCD
glass matches the goals set for Exercise1. The hardware
setup should be ready as shown in Table 3 on page 4.
May 26, 2009
Document No. 001-52927 Rev. **
8
[+] Feedback
AN52927
Application Programming Interface (API)
One of the main advantages of PSoC is that it generates
the APIs required to control the component. This saves
time when you create the library functions. All the APIs
generated by PSoC Creator is in C language. This makes
it easy to understand and can be modified to suit the
particular application.
The APIs generated for the segment LCD component is
explained in the component data sheet. An example of
using the API is shown in the LCDExercise1 code.
SegLCD_Write7SegDigit_0(cValue,cPosition);
This API is used to write a specific value at the desired
position of the display. This API does not support writing to
the decimal point. For that, there is another API to write to
any desired pixel in the display.
For example to display the decimal point connected with
the fourth digit of the LCD glass following API is used.
SegLCD_WRITE_PIXEL(H7SEG0_4DP,SegLCD_PIXEL_
STATE_ON);
To turn the same pixel off, use
SegLCD_WRITE_PIXEL(H7SEG0_4DP,SegLCD_PIXEL_
STATE_OFF);
There are APIs to support some of the configuration
parameters on the run. These are listed and explained in
the component data sheet.
If the display helpers are not used, you must map the pixel
to display buffer and create the set of library files for
different forms of display similar to APIs provided by the
PSoC Creator.
Section 3: Interface to a Complex
LCD Glass using LCD Drive
Evaluation Kit
Requirements





LCD EVK board( Rev1) and accessories
CY8C3866AXI-040 processor
MiniProg3 and accessories
PSoC Creator
PSoC Programmer
Exercise 2
This section demonstrates how to set up a complex glass
and work with it.
In this exercise, use the LCD EVK board that has a large
LCD, custom made for Cypress Semiconductor. It has 16
commons and 28 segment lines to support 448 segments.
This LCD has different types of displays such as dot
matrix, 7-segment, 14-segment, 16-segment, bar graphs,
and a few symbols. The front panel of the glass along with
its display naming is shown in Figure 12. The common to
segment relation of this glass is shown in Figure 13.
The following are few important specification of this glass:







Display type: FSTN
Viewing direction: 6 o‟clock
Drive method: 1/16 duty, 1/5 bias
Operating voltage: 3.3V
Polarizer mode: Reflective
Operating temperature: 0oC to 50oC
Connection: Pin
Table 4 shows the pin connection between LCD glass and
PSoC.
May 26, 2009
Document No. 001-52927 Rev. **
9
[+] Feedback
AN52927
Figure 12. Front Panel with Display Naming
Figure 13. Common to Segment Relation
May 26, 2009
Document No. 001-52927 Rev. **
10
[+] Feedback
AN52927
Table 4. Pin Connection between LCD Glass and PSoC
Function
LCD Pin
PSoC Pin
COM0
8,60
P2[2]
COM1
7,59
P2[5]
COM2
6,58
P2[6]
COM3
5,57
P2[7]
COM4
4,56
P6[4]
COM5
3,55
P6[5]
COM6
2,54
P6[6]
COM7
1,53
P6[7]
COM8
29,37
P0[5]
COM9
30,38
P0[4]
COM10
31,39
P0[3]
COM11
32,40
P0[2]
COM12
33,41
P0[1]
COM13
34,42
P0[0]
COM14
35,43
P4[1]
COM15
36,44
P4[0]
SEG0
9
P2[1]
SEG1
10
P2[0]
SEG2
11
P15[5]
SEG3
12
P15[4]
SEG4
13
P6[3]
SEG5
14
P6[2]
SEG6
15
P6[1]
SEG7
16
P6[0]
SEG8
17
P4[7]
SEG9
18
P4[6]
SEG10
19
P4[5]
SEG11
20
P4[4]
SEG12
21
P4[3]
SEG13
22
P4[2]
SEG14
23
P0[7]
SEG15
24
P0[6]
SEG16
25
P2[4]
SEG17
26
P2[3]
SEG18
27
P15[0]
SEG19
28
P15[1]
SEG20
52
P5[0]
SEG21
51
P5[1]
SEG22
50
P5[2]
SEG23
49
P5[3]
SEG24
48
P5[4]
SEG25
47
P5[5]
SEG26
46
P5[6]
SEG27
45
P5[7]
May 26, 2009
The configuration settings for Basic Configuration and
Driver Power tabs are similar to those explained in Section
2. The challenge here is to set the Display Helpers tab.
This is because the glass has different types of displays
from dot matrix to symbols. Also, take care to maintain the
relation between commons and glass. If this is done, the
tool makes it easy to set up these complex 448 segments.
There are many types of display in the LCD glass used for
this exercise. Select one display type at a time and place
the exact numbers of that type on the glass. For example,
there are eight dot matrix displays, so place eight dot
matrix displays and map them following the common
segment relation. In another case, there are two instances
of 7-segment display on the glass at different locations. So
create two instances of 7-segment helpers, one having
five 7-segment displays and the other having four 7segment displays. This is shown in the screen shot of
display helper settings in Figure 14. The complete pixel
map for the glass as created and generated by the tool is
shown in Figure 15.
Document No. 001-52927 Rev. **
11
[+] Feedback
AN52927
Figure 14. Display Helper Settings
Selected Display Helpers
Figure 15. Complete Pixel Map Generated by Tool
May 26, 2009
Document No. 001-52927 Rev. **
12
[+] Feedback
AN52927
SegLCD_WriteStringDotMatrix_0("PSoCLCD",0);
for(cBarPos=1;cBarPos<=10;cBarPos++)
LCD to PSoC Pin Assignment
As explained in Section 2, map the LCD glass pins to
PSoC using the tab found in the design wide resource tab
LCDExercise1.cydwr. Assign each pin to its respective
name to match Table 4 on page 11.
{
for(iDelay=0;iDelay<0xFFFF;iDelay++);
SegLCD_WriteBargraph_5(cBarPos,0);
}
Build and Test the Project
Click main.c located in the source files in the workspace
explorer window. Copy the following code into main.c.
This code displays string “PSoC-LCD” and “eZtoWork”
alternately on the dot matrix display. It also controls each
segment of the bar graph display, increasing in steps with
each string. The Cypress logo and its ticker symbol are
displayed continuously.
C code for LCDExcercise2
#include <device.h>
void main()
{
//variables for delay routine
uint16 iDelay;
//variable for bargraph display
char cBarPos;
// Magic analog key
CY_SET_REG8(0x46F0,0xD4);
CY_SET_REG8(0x46F1,0xAA);
CY_SET_REG8(0x46F2,0x56);
CY_SET_REG8(0x46F3,0xC9);
// Pump enable
CY_SET_REG8(0x5876,0x66);
CY_SET_REG8(0x5877,0x06);
// Enable DAC
CY_SET_REG8(0x43A8,0x0F);
// Start LCD
SegLCD_Start();
//over-ride the bias voltage
the tools
SegLCD_SetBias(127);
SegLCD_ClearDisplay();
//clear bargraph
SegLCD_WriteBargraph_5(0,0);
SegLCD_WriteStringDotMatrix_0("eZtoWork",0);
for(cBarPos=1;cBarPos<=10;cBarPos++)
{
for(iDelay=0;iDelay<0xFFFF;iDelay++);
SegLCD_WriteBargraph_5(cBarPos,0);
}
//clear bargraph
SegLCD_WriteBargraph_5(0,0);
}
}
Build and program as described in Section 2. After
successful programming, you can see the display on the
LCD glass matching the goals set in Exercise2.
setting in
//Display Cypress logo and CY
continuously
SegLCD_WriteBargraph_6(2,0);
//Display Cy on 16 and 14
segment
display respectively
SegLCD_WriteString16Seg_3("C",0);
SegLCD_WriteString14Seg_4("y",0);
while (1)
{
May 26, 2009
Document No. 001-52927 Rev. **
13
[+] Feedback
AN52927
Document History
Document Title: LCD Direct Drive Basics
Document Number: 001-52927
Revision
ECN
Orig. of Change
Submission Date
**
2711107
GDN
05/26/09
Description of Change
New application note
PSoC is a registered trademark of Cypress Semiconductor Corp. PSoC Creator is a trademark of Cypress Semiconductor Corp. All other
trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone: 408-943-2600
Fax: 408-943-4730
http://www.cypress.com/
© Cypress Semiconductor Corporation, 2009. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress‟ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
May 26, 2009
Document No. 001-52927 Rev. **
14
[+] Feedback