Professional Documents
Culture Documents
Application Note Abstract: LCD Direct Drive Basics
Application Note Abstract: LCD Direct Drive Basics
Application Note Abstract: 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
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.
[+] Feedback
AN52927
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
Static Drive
The LCD is an RMS voltage responsive device. This Segments
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
[+] Feedback
AN52927
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) 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
[+] 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.
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]
[+] 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
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.
[+] 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.
[+] 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
[+] Feedback
AN52927
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.
[+] Feedback
AN52927
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
Connection: Pin
Table 4 shows the pin connection between LCD glass and
PSoC.
[+] Feedback
AN52927
[+] 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]
[+] Feedback
AN52927
[+] 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();
while (1)
{
[+] 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.
[+] Feedback