Você está na página 1de 14

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 Transflective displays have a rear polarizer that includes


a translucent material which reflects part of the ambient
This application note discusses how to control the light and also transmits backlighting. As the name implies,
electrical parameters of LCD glass using PSoC Creator™. it is a compromise between the transmissive and reflective
It helps you understand the following: LCD types. When used in reflection, it is not as bright and
has lower contrast than the reflective type LCD. However,
 Effect of electrical parameters on LCD operation. it can be backlit for use in low light conditions.
 Controls and settings available in PSoC Creator and Operating Modes
the effect of these settings on LCD operation.
Based on operating modes, there are four types of LCDs:

Section 1: LCD Basics  Twisted Nematic (TN)


LCDs are classified based on light source, operating
modes, and viewing angle.  Super Twisted Nematic (STN)

Light Source  Film Compensated STN (FSTN)


Based on light source, there are three types of LCDs:  Color STN (CSTN)
 Transmissive In each of these, the orientation of the light passing
through the LCD structure is twisted differently to affect
 Reflective contrast and coloration.

 Transflective
TN displays have a twist (the rotation of molecules from
one plane of the display to the other) of 90 degrees or
Transmissive displays have a clear polarizer in the front less.
and back. They depend on light coming from behind the
STN LCDs have a twist greater than 90 but less than 360
display towards the observer, to be visible.
degrees. Most STN displays have a twist between 180
Reflective displays have an opaque rear polarizer that and 270 degrees.
includes a diffuse reflector. This layer reflects polarized
FSTN displays add a retardation film to the STN display
ambient light that has entered the front of the display back
that compensates for the color added by the birefringence
through the LCD cell. Reflective displays require ambient
(double refraction) effect. It provides a higher contrast and
light to be visible. They exhibit high brightness, excellent
wider viewing angle.
contrast, and wide viewing angles. They are particularly
suitable for use in battery operated equipment where an CSTN provides full color reproduction by inserting an
adequate level of light is always available. Reflective internal RGB color filter layer in the LCD with features
LCDs cannot be backlit; they can be front lit in some such as wide viewing angles and 65k colors. It is suited for
applications. telecommunication and handheld consumer devices.

May 26, 2009 Document No. 001-52927 Rev. ** 1

[+] Feedback
AN52927

Frequencies for direct drive displays are typically between


Viewing Angle 30 Hz and 100 Hz, depending on display size and design.
The orientation of an LCD‟s bias angle is often stated with Displays can operate at higher frequencies, but this
reference to a clock face. The bias angle is the angle from increases power consumption. LCDs mimic a capacitive
the perpendicular from which the LCD glass is best load, which reduces the load impedance as frequency
viewed. increases. However, operation below 30 Hz usually results
If the offset is above the display, it is referred to as a in visible flicker of the segments.
"12:00" or "top" view. If the offset is below the display, it is LCDs are overdriven by a combination of voltage and
referred to as a “6:00" or “bottom" view. frequency, which result in cross talk or "ghosting".
The viewing angle is the angle formed on either side of the Ghosting is the appearance or partial activation of an "off"
bias angle, at which the contrast of the display is still segment. This condition occurs when high drive voltage
considered acceptable. 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
Image
connect all unused segments to the backplane, and not
Positive Image allow them to float.
The display appears as a dark image on a light The main advantage of static drive is that it is simple to
background. Unenergized pixels allow light and energized implement. You only have to worry about which segment
pixels obstruct the light creating dark images on the light line to turn on and off, while activating the common signal
background. all the time. Another advantage is that voltage levels can
go from rail to rail and do not require multiple intermediate
Negative Image
levels.
The display appears as a light image on a dark
background. Unenergized pixels inhibit light from passing The disadvantage is that it requires more pins. Every pixel
through the display. Energized pixels allow the light to must have a segment line tied to it, and segment lines are
pass creating a light image on a dark background. connected to pins on a PSoC or an MCU.
Figure 1 shows an example of static LCD waveforms. If
Drive Mode the segment waveform equals a common waveform, then
The LCD must only be driven with AC voltages. DC the segment is in OFF state. If the segment waveform
voltage deteriorates the liquid crystal fluid so it cannot be equals an inverted common waveform, then the segment
energized. is in ON State.

LCD driver waveforms are designed to create 0-Vdd Figure 1. Static LCD Waveforms
potential across all LCD segments. Common
VDD
Common
There are two types of drive modes:

 Static Drive
VDD
OFF Segment

 Multiplexed Drive VDD


ON Segment

Static Drive
The LCD is an RMS voltage responsive device. This Segments
VDD

means that the contrast of a given segment is dependent 0V


Resulting Voltage
(Common-Segment)
upon the RMS value of the applied voltage across it, OFF Segment

measured with respect to common plane. -VDD

VDD
In static drive, the display uses only one common or
Resulting Voltage
backplane signal. Every pixel has its own segment and 0V (Common-Segment)
ON Segment
frontplane line.
-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

contains a stair-stepped waveform. This maintains specific


Multiplexed Drive AC voltages across any given segment, dot, and pixel to
In multiplexed drive, the display uses two or more keep it in its "on" or "off" state. The LCD bias number (for
common signals. The activation of pixels is time- example, 1/5 bias) indicates how many voltage reference
multiplexed (staggered), using the number of time points are created to drive a specific LCD. Table 1 shows
divisions equal to twice the number of common planes. the relationship between the number of driving bias
Similar to conventional LCDs, the voltage at all segment voltages and the display multiplex ratios typically used.
locations must be caused to reverse polarity periodically
so that zero net DC voltage is applied. This is necessary Table 1. Driving Biases and Mulitplex Ratios
to prevent irreversible electrochemical action from
destroying the display. This is the reason for doubling in Mux Ratio Biases
time divisions—each common plane must be alternately Static 2
driven with a voltage pulse of opposite polarity. The cycle
½ ½ bias (3)
between the first and second time frames is fast enough
for the naked eye to see selected pixels turning on at the 1/3,1/4 1/3 bias (4)
same time. 1/7,1/8,1/11,1/12 ¼ bias (5)
The following are important terms associated with the 1/14,1/16 1/5 bias (6)
multiplexed drive.
As shown in Table 1, the relation between mux and bias is
 Frame frequency 1/(sqrt(commons)+1) and the voltage level amount used to
power the LCD display is equal to voltage steps+1 (the
 Duty ratio (Mux ratio) number indicated in the bracket).

 Bias type Waveform Type


Multiplexed LCDs can be driven by two types of
 Waveform type waveforms. These are called Type A and Type B in LCD
specifications and data sheets (see Figure 2). Type A
Frame Frequency waveforms take single frames to maintain 0 Vdd. Type B
The LCD frame frequency is the rate at which the waveforms take two frames to maintain 0 Vdd.
backplane and segment outputs change to their energizing
levels. The typical range of frame frequency is between 50 Figure 2. Type A and Type B Waveforms
and 150 Hz. Higher frequencies result in higher power Type-A Type-B

consumption and lower frequencies cause image flickering 1 Frame 1 Frame 1 Frame

3 3
on the LCD. Common
Waveform 2 2
(generated by 1 1
driver)
0 0
Duty Ratio Segment
3 3
2 2
Duty cycle ratio or duty cycle indicates the number of Waveform
(generated by
driver)
1 1

commons, normally defined as the inverse of the number 0


3
0
3

of commons/backplanes. For example if the display has 2


1
2
1
four commons, then the duty ratio is 1/4. Common-Segment
(as seen across pixel)
0 0
-1 -1
-2 -2
The process of refreshing an LCD with n backplanes -3 -3

(commons) and m frontplanes (segments) is similar to the Liquid Crystals Liquid crystals
are energized is energized
matrixed keyboard operation. The driver selects one
backplane BPx (corresponding to a column on a The main difference between the two types of waveform is
keyboard) and drives the appropriate voltage levels to all in the frequencies of voltages applied to the LCD pixels.
frontplanes FP1 to FPm associated with that backplane From Figure 2, it is clear that type A waveforms contain
(corresponding to keyboard rows). The remaining many more edges than type B waveforms. The lower
backplanes are driven to an unselected voltage level. This frequencies in type B waveforms have one major
process is then repeated for all backplane electrodes of advantage. Because the LCD represents a capacitive
the display. Therefore, the full refresh cycle of the display load, the drive current rises with frequency. Therefore,
has n phases, one for each backplane electrode. The cells type B waveforms result in lower power consumption. This
corresponding to the visible segments are driven to the is especially important in battery powered applications.
“active” voltage level only in one (selected) phase of the The length of the refresh cycle is the same for both types
refresh cycle and to an “inactive” voltage level in the of waveform. Therefore, there are no differences between
remaining (unselected) phases. This is why the number of type A and type B waveforms in refresh rate dependent
phases of the refresh cycle is typically expressed as a optical parameters of the LCD segments. Contrast is
duty ratio 1/n. dependent on the light source available, viewing angle,
Bias Type multiplex mode, and the LCD voltage levels. The first three
Bias is the number of voltage steps to be applied to the parameters are directly related to LCD glass and the
LCD. To control LCDs with a larger multiplex ratio, you fourth can be controlled by the LCD driver. The LCD bias
must provide the waveform generator with multiple bias adjustment controls the contrast between the LCD
voltage level points. The resulting waveform sent to the segment in on and off states. This voltage must be
LCD segment control lines and backplane/commons optimized for best appearance. A greater voltage

May 26, 2009 Document No. 001-52927 Rev. ** 3

[+] Feedback
AN52927

separation between common and segment pins allows Figure 3 Front Panel of LCD Glass
better contrast.
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
Requirements
glass are shown in Table 2.
 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. A unique feature of PSoC® LCD direct drive is that any pin
can be configured either as common or segment. This
Following are few important specification of the simple
makes routing much easier. For this example, route the
LCD glass:
LCD pins to Port 3 and Port 5, which are wired to port A
 Display type: TN
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]
This glass has four 7-segment digits and three decimal
points. The front panel drawing is shown in Figure 3. 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]

May 26, 2009 Document No. 001-52927 Rev. ** 4

[+] Feedback
AN52927

With this information on the glass and its interface details To start, rename the component as SegLCD in the Name
with PSoC, you can work with the segment LCD field.
component available in PSoC Creator. The following
operations are performed using this component: Figure 4. Configure Window

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

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
Follow these steps to create a project: in Figure 4. They include the following.
1. Select Start > Programs > Cypress > PSoC Number of common lines: This setting is dependent on
Creator. the glass used. For this exercise, set it to „3‟ because the
2. In PSoC Creator, select File > New > New Project. glass used has three commons, as shown in Table 2 on
page 4.
3. In the new project window, select Empty PSoC3
Number of segment lines: This parameter is also glass
Design and enter „LCDExercise1‟ in the project name
dependent. For this exercise, set it to 12 because the
field.
glass used has 12 commons, as shown in Table 2 on
4. Browse to select a suitable location for the project. page 4.
5. To select the device, click Advanced; in the Device Bias type: This parameter is read only and is set by the
field, launch the device selector to select a suitable tool depending on the number of commons. Refer Bias
device. For this exercise, CY8C3866AXI-040 is Type on page 3.
selected. The other settings are at default.
Waveform type: This affects the current consumption, as
6. Click OK to create the project or workspace. explained in Waveform Type on page 3. Initially, select
default type A for this exercise.
Selecting Segment LCD Component
Frame rate: This parameter determines how many times
When the project is open, two tabs are displayed: Start each segment is refreshed in a second. For this example,
Page and TopDesign.cysch. In the TopDesign.cysch tab, set it to 50 Hz. This means that each of the 31 segments
select Segment LCD from the component catalog under in the glass are refreshed 50 times in one second. It can
display category. Drag and drop it to the canvas. also mean that each of the commons and their respective
Configuring the LCD segments are refreshed 50 times in one second.

This section focuses on how each parameter set during Bias voltage: This parameter controls the contrast of the
configuration affects the display rather than on what each display. Refer Waveform Type on page 3. Intially, set it to
parameter setting does. You can find the functions of each 3.3.
parameter setting in the component data sheet. To access Enable ganging commons: This is useful when driving a
these data sheets, right click the component and select glass with very large segments or when the capacitance
the data sheet. offered by commons is greater than 5000 pF. For this
To configure the LCD, right click the component and select exercise, leave it unchecked.
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 Document No. 001-52927 Rev. ** 5

[+] Feedback
AN52927

Next, set the parameters in the Driver Power Settings tab Low drive initial time: This is active only when Low
as seen in Figure 5. The settings in this tab directly control Power is selected in Driver Power Mode. It specifies the
the parameters related to driver implementation. duration that the low drive buffer should be active before
going to no drive mode.
Figure 5. Driver Power Settings Tab
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.
Figure 6. Display Helpers Tab
Driver Power Mode: There are two options: Always
Active and Low Power.

 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 2 3
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 For this exercise use the glass that has 4-digit, 7-segment
the time that high drive buffer in the driver implementation display as shown in Figure 3 on page 4.
should stay high to charge the capacitor (pixel). More time
means more current is drawn. Keep the default value that 1. Select „7 Segment‟.
is set by the tool. 2. Click the right arrow (Helper_7Segment_0 is seen in
Low drive mode: This is active only when Low Power is the Selected Helpers field).
selected in Driver Power Mode. 3. Click Helper_7Segment_0 (the 7-segment symbol
When implementing the LCD driver there are two low drive appears as shown in Figure 7).
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.
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. 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.
1 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
The display used in this exercise has four 7-segment pixels of the display the pixel mapping appears as shown
symbols. Click the “+” button to add four symbols. Figure 8 in Figure 9.
shows the dialog box after four symbols are added.
Figure 9. Pixel Mapping
Figure 8. Four Symbols Added

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();

for(;;)
Click Apply and then click OK to complete the {
configuration. for(cXiDelay=0;cXiDelay<0x8;cXiDelay++)
{for(iDelay=0;iDelay<0xFFFF;iDelay++);
}
LCD to PSoC Pin Assignment SegLCD_Write7SegDigit_0(cValue,cPosition);
To map the LCD glass pins to PSoC, open the design cValue++;
wide resource tab “LCDExercise1.cydwr” by either right if(cValue>16)
{
clicking the project in the workspace explorer window or
cValue=0;
clicking the LCDExcercise1.cydwr seen in the source files. cPosition--;
The cydwr tab has many other tabs, but our interest is in SegLCD_ClearDisplay();
the pins tab. Click this tab; the pinout of the chip appears if(cPosition==0)cPosition=3;
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. Build the project by clicking the Build button or going
through build menu. After successful build, note that in the
Figure 11. Pin Assignment Window 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) Section 3: Interface to a Complex


One of the main advantages of PSoC is that it generates LCD Glass using LCD Drive
the APIs required to control the component. This saves
time when you create the library functions. All the APIs
Evaluation Kit
generated by PSoC Creator is in C language. This makes Requirements
it easy to understand and can be modified to suit the
particular application.  LCD EVK board( Rev1) and accessories

The APIs generated for the segment LCD component is  CY8C3866AXI-040 processor
explained in the component data sheet. An example of
using the API is shown in the LCDExercise1 code.  MiniProg3 and accessories
SegLCD_Write7SegDigit_0(cValue,cPosition);
 PSoC Creator
This API is used to write a specific value at the desired
position of the display. This API does not support writing to  PSoC Programmer
the decimal point. For that, there is another API to write to Exercise 2
any desired pixel in the display. This section demonstrates how to set up a complex glass
For example to display the decimal point connected with and work with it.
the fourth digit of the LCD glass following API is used. In this exercise, use the LCD EVK board that has a large
SegLCD_WRITE_PIXEL(H7SEG0_4DP,SegLCD_PIXEL_ LCD, custom made for Cypress Semiconductor. It has 16
STATE_ON); commons and 28 segment lines to support 448 segments.
This LCD has different types of displays such as dot
To turn the same pixel off, use matrix, 7-segment, 14-segment, 16-segment, bar graphs,
and a few symbols. The front panel of the glass along with
SegLCD_WRITE_PIXEL(H7SEG0_4DP,SegLCD_PIXEL_ its display naming is shown in Figure 12. The common to
STATE_OFF); segment relation of this glass is shown in Figure 13.
There are APIs to support some of the configuration The following are few important specification of this glass:
parameters on the run. These are listed and explained in
the component data sheet.  Display type: FSTN
If the display helpers are not used, you must map the pixel  Viewing direction: 6 o‟clock
to display buffer and create the set of library files for
different forms of display similar to APIs provided by the  Drive method: 1/16 duty, 1/5 bias
PSoC Creator.
 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 The configuration settings for Basic Configuration and
Driver Power tabs are similar to those explained in Section
Function LCD Pin PSoC Pin 2. The challenge here is to set the Display Helpers tab.
COM0 8,60 P2[2] This is because the glass has different types of displays
COM1 7,59 P2[5] from dot matrix to symbols. Also, take care to maintain the
relation between commons and glass. If this is done, the
COM2 6,58 P2[6] tool makes it easy to set up these complex 448 segments.
COM3 5,57 P2[7]
There are many types of display in the LCD glass used for
COM4 4,56 P6[4] this exercise. Select one display type at a time and place
COM5 3,55 P6[5] the exact numbers of that type on the glass. For example,
COM6 2,54 P6[6]
there are eight dot matrix displays, so place eight dot
matrix displays and map them following the common
COM7 1,53 P6[7] segment relation. In another case, there are two instances
COM8 29,37 P0[5] of 7-segment display on the glass at different locations. So
COM9 30,38 P0[4]
create two instances of 7-segment helpers, one having
five 7-segment displays and the other having four 7-
COM10 31,39 P0[3] segment displays. This is shown in the screen shot of
COM11 32,40 P0[2] display helper settings in Figure 14. The complete pixel
COM12 33,41 P0[1] map for the glass as created and generated by the tool is
shown in Figure 15.
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 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("PSoC-
LCD to PSoC Pin Assignment LCD",0);
As explained in Section 2, map the LCD glass pins to for(cBarPos=1;cBarPos<=10;cBarPos++)
PSoC using the tab found in the design wide resource tab {
LCDExercise1.cydwr. Assign each pin to its respective for(iDelay=0;iDelay<0xFFFF;iDelay++);
name to match Table 4 on page 11.
SegLCD_WriteBargraph_5(cBarPos,0);
Build and Test the Project }
Click main.c located in the source files in the workspace //clear bargraph
explorer window. Copy the following code into main.c. SegLCD_WriteBargraph_5(0,0);
This code displays string “PSoC-LCD” and “eZtoWork”
SegLCD_WriteStringDotMatrix_0("eZtoWork",0);
alternately on the dot matrix display. It also controls each
segment of the bar graph display, increasing in steps with for(cBarPos=1;cBarPos<=10;cBarPos++)
each string. The Cypress logo and its ticker symbol are {
displayed continuously. for(iDelay=0;iDelay<0xFFFF;iDelay++);
SegLCD_WriteBargraph_5(cBarPos,0);
C code for LCDExcercise2 }
//clear bargraph
#include <device.h> SegLCD_WriteBargraph_5(0,0);
void main() }
{ }
//variables for delay routine
uint16 iDelay; Build and program as described in Section 2. After
//variable for bargraph display successful programming, you can see the display on the
char cBarPos; LCD glass matching the goals set in Exercise2.
// 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 setting in
the tools
SegLCD_SetBias(127);
SegLCD_ClearDisplay();

//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 Description of Change
** 2711107 GDN 05/26/09 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

Você também pode gostar