0% found this document useful (0 votes)
18 views

How To Drive An LCD Glass With Your Own Processor

This document provides instructions for driving an LCD display using a custom processor rather than a preassembled controller module. It identifies the pins needed to control the common and segment lines. Timing is critical, with each common line getting a repeating pattern of voltages (Vcc, Vcc/2, ground) 180 degrees out of phase. Segments are controlled by applying Vcc or ground to the segment pin at the same time as a specific common voltage. The document walks through controlling a single segment pair and puts the pieces together to display a digit by sending a repeating code to the segment pins timed to the common patterns.

Uploaded by

hansolosnah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

How To Drive An LCD Glass With Your Own Processor

This document provides instructions for driving an LCD display using a custom processor rather than a preassembled controller module. It identifies the pins needed to control the common and segment lines. Timing is critical, with each common line getting a repeating pattern of voltages (Vcc, Vcc/2, ground) 180 degrees out of phase. Segments are controlled by applying Vcc or ground to the segment pin at the same time as a specific common voltage. The document walks through controlling a single segment pair and puts the pieces together to display a digit by sending a repeating code to the segment pins timed to the common patterns.

Uploaded by

hansolosnah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

technology workshop living food play outside

How to Drive an LCD glass with your own processor


by solowdiver on March 26, 2015

Table of Contents

How to Drive an LCD glass with your own processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: How to Drive an LCD glass with your own processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: Identifying the pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: Exploring the matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3: It's all about the timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 4: Looking at one segment pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 5: Controlling a segment pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 6: Putting it all together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Intro: How to Drive an LCD glass with your own processor
Practically speaking it is much easier to use a preassembled module consisting of a controller and glass. But if you ever wondered how the controller actually controls the
segments, read on.

Step 1: Identifying the pins


Using a two digit LCD glass I came across recently I explored how to drive it. None of the documentation I could find really spells out how they are controlled. And there
seems to be a real dearth of identification on any of the glasses I've looked at. As in non-existent. If the glass you're using is in an operating circuit, use a 'scope to look
for the pins with the complex pattern shown in the COM0 and COM1 figures. These are the COMs. All the segment pins will have simple Vcc or Gnd patterns. To identify
the pins remove the glass from the circuit and connect one side of low voltage AC to a COM and apply the other side to the pins one at a time to find the segment pairs. A
few volts AC will be enough.

If you don't have the luxury of a working circuit to start with, experiment with the AC, applying it to various combinations till you see a pattern. Stay away from using
elaborate glasses at first, it gets way too complicated.

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Step 2: Exploring the matrix
This particular glass has 2 back plane pins and 8 segment pins, 4 per digit. Glasses with more digits or figures require more back planes but I will be exploring this 2 back
plane glass only. And only the left digit. The right digit is just more of the same. Glass pins 3-6 are for the right digit.

Each pair of segments is controlled by one SEG pin and the two COM pins. Segments c and e of the left digit are controlled by pin 10 plus COM pins 1 and 2. Segments f
and g are controlled by pin 9 plus COM pins 1 and 2 and so on. All the segments are multiplexed between the individual segment pins and the COM pins. Segment d
alone is controlled by pin 7 and the COMs.

This is quite different than a standard LED display plus while LEDs use DC, LCDs require AC. In fact if you apply DC to an LCD for very long it will damage the glass.

The 2 COMs of a two back plane glass require 3 different voltage levels to operate: Vcc, Vcc/2 and Gnd. Since the glass draws extremely little current (think RC with high
R and low C), Vcc/2 is easily achieved with a resistor divider with both ends controlled by the uP. The center points of the dividers are connected to the COMs. With one
end of the divider high and one low the (1,0 or 0,1) the divider output is Vcc/2. Both high (1.1) the output is Vcc, both low (0,0) the output is Gnd.

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Step 3: It's all about the timing
In t1 COM0 is Vcc, t2 and t3 are Vcc/2 and in t4 COM0 is Gnd. COM1 is identical to COM0 but 180 degrees out of phase with COM0; t1 is Vcc/2, t2 Gnd, t3 Vcc and t4
Gnd. With more than 2 back planes you will have more divisions in every frame (period). This frame is 40 mS wide or 25Hz. The documentation I have found says that is
too slow but it works OK. Any problems just shorten all the times to increase the frequency, it’s looks issue; with the frequency too low you will notice the flicker, too high
causes ghosting.

The COM patterns remain unchanged regardless of the digits displayed.

For coding:

PORTD.6=1;

PORTD.7=0;

PORTD.2=1;

PORTD.3=1; For 10mS. Then

PORTD.6=0;

PORTD.7=0;

PORTD.2=1;

PORTD.3=0; For the next 10mS and so on to produce the above waveforms.

Once you have the above waveforms functioning forget about them. From now on you just have to manipulate the segments.

Step 4: Looking at one segment pair


The segments require Vcc or Gnd. Even though only DC voltages are present WRT (With Respect To) Gnd, the segments see AC from the presentation of the voltages
at the proper time (COM WRT SEG). Remember the Alternating Current comes from the SEG in relation to COM0. Imagine putting the negative lead of a voltmeter to the
SEG terminal, and the positive to COM0. In t1 the meter will read +5VDC (0V and 5V). Now in t4 the meter will read –5VDC (5V and 0V). The voltage across the segment
alternates as shown in the bottom waveform.

That is how the AC is realized. You don’t need to think about that any more; we will be only working with DC levels at the proper time.

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Step 5: Controlling a segment pair
Timing of the voltages is the key to controlling the segments. Each segment pair requires its own uP pin and follows this timing pattern:

t1 t2 t3 t4

Gnd Vcc Gnd Vcc both segments on

Vcc Gnd Vcc Gnd both off

Vcc Vcc Gnd Gnd 1st segment on

Gnd Gnd Vcc Vcc 2nd segment on

For the segments ab, ce, fg and d the 1st segments are a, c, g and d. 2nd are b, e and g.

For coding:

0101 = both segments on

1010 = both off

1100 = 1st segment on

0011 = 2nd segment on

All the SEGs and COMs are controlled in the same t1-t4 time frame based on a 10 mS interrupt.

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Step 6: Putting it all together
Controlling all the segments gets a little confusing. Each segment pair (d is considered a pair here) requires its own group of 4 bits, one each for t1-t4. Since there are 4
sets of segment pairs, 16 bits of refreshed data are needed for every frame. And that's just for the one digit.

So to display "4", send 0xC35A to the segment terminals. The code uses switch statements. One function for the COMs has a single switch statement and runs whenever
the program is running. Then another function with 4 switch statements (one for each pair of segments) which gets the refreshed data. All switch statements key off the
same 10mS interrupt to keep all the uP pins timed correctly.

Take a look at the code and hopefully it will all make sense. It's written in C using Code Vision. There is a lot of extraneous stuff, SPI (Serial Port Interface) etc. Initially I
thought I was going to have to produce four voltages for each pin to get the "result" pattern. So I connected to a DAC to get the various voltages only to find they weren't
needed. Too lazy (project fatigue!) to take it out. Really it's all about producing the proper levels at the proper time.

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
File Downloads

LCD Driver.c (18 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'LCD Driver.c']

Related Instructables

How electricity
and electronics
works by
rickharris test Grab Bag Paul's
Effect of Static with misc. Electronics Pit
Electricity on Electronics for Electricity? by electronics (Photos) by
Electronics by Absolute grenadier provided by pfred2
Ins Trucktibles Beginners, Jameco by wxh
Study Guide,
Chapter 1 by
elektrobot

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/
Advertisements

Comments
1 comments Add Comment

tomatoskins says: Mar 28, 2015. 8:19 PM REPLY


I've always wondered how these work!

http://www.instructables.com/id/How-to-Drive-an-LCD-glass-with-your-own-processor/

You might also like