Introduction
The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions.  We hope you enjoy it.  If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to[email protected].
Backbone of the display world
The seven-segment display has been the backbone of the display world for more than 4 decades.  In the beginning, they used LED’s to illuminate the segments.  It was not until the 1970’s that a century old technology, LCD, was patented in a usable display format.
A useful configuration, but not the only one, is a microcontroller connected to a 7-segment display driver chip connected to the display itself.  To start, with let’s talk about the LED display.  The display itself, commonly consists of 8 LED’s; 7 segments that make up a shape like the number 8 and a decimal point. They are usually connected at a common anode.  The anode is connected to a high voltage source and the cathodes are connected to a switch through a current limiting resistor.  You could, if you chose hook these 8 resistors to the outputs of an MCU and drive them directly.  However, there is an easier way.

A little help from my friends
Companies have developed driver chips for 7-segment displays, e.g. HEF4543B (BCD to 7-segment latch/decoder/driver).  The inputs consist of 4 data lines, D0-D3, that represent the data to be displayed as binary coded decimal.  The outputs are Qa-Qg, the seven segment drivers that connect to the current limiting resistors. The decimal point must be driven directly by the MCU or hooked permanently on or off.  Data is presented to the display by putting data on the bus (D0-D3) and toggling the latch from low, to high, to low again.  This will then latch the data, decode it to the appropriate 7 lines and set those outputs appropriately (low for common anode, high for common cathode.
There are some niceties such as the phase, used to select common anode or common cathode or to drive LCD displays (more on that below) and the blanking line that will allow you to essentially turn off the display.  This is useful if, for example, you wish to drive an entire generation crazy by having the default state of the clock be to blink until set.

A horse of a different color
The LCD shares many of the same drive requirements of the LED but has one key difference.  The voltage to drive the LCD is AC, of sorts.  Let me explain.  There is still a common, now called the backplane, and the individual segments.  However, if you drive these segments with a DC voltage it will degrade and permanently damage the LCD very quickly.  Saying that the LCD must be driven with an AC voltage is very misleading.  What must happen is that the voltage on the back plane and the voltage on the individual segments must switch from high to low or low to high at a rate of 30-90 hz.  To get an individual segment to become active (turn black) the voltage between the segment and the backplane must be high (or different).  If the voltage is the same the segment will be inactive.  

Figure 1, The LCD-S401C52TR using 3 digits and a colon.
This all sounds terribly complicated but in actuality is very straight forward to accomplish. A signal is set up from the MCU to flip at a rate of say 50 hz.  That signal is connected to the backplane of the display.  I used the LCD-S401C52TR.  This is a 4 digit 0.52” reflective twisted nematic display made by Lumex. I only needed 3 segments, no decimal points and a colon.  The unused pins I tied to the common.  The common I then tied to the oscillating pin from my MCU.  I also tied the oscillating pin to the phase pin on the driver chip.  It changes the outputs so that if the segment should be on it is the opposite state as the common and it turns black.  That is it.  Everything else is the same and it works.

That darn colon
Just like the decimal points, the colon must be driven by the MCU.  If you want a decimal point or colon permanently on it must be opposite in value of the common.  This can be done with an inverter connected to the oscillating pin, or just another pin from the MCU with the opposite phase of your oscillating pin.  To turn them off, just tie them to common (NOT to ground).
But what if you want to have the colon flash once a second?  That is a useful thing.  It lets the user know the device is active.  The complication is that not only does the value of the colon pin need to change state 30 to 90 times a second but twice a second it need to change phase relative to the common.  Again, what sounds complicated is really straight forward.  I have an MCU pin that I tie to the colon.  I toggle the value at the same time I toggle the oscillating pin (50 times a second).  But independent of that I also toggle the value twice a second based on another timer.  It doesn’t matter what the value is, half a second it will be in phase with the common and half a second it will be out of phase.  So, it blinks. Ta Da.

Keeping up with technology
I had a great time working on this project. I had never used an LCD before.  Why use something so complicated when I could just use a straight forward LED.  Well for one thing, a typical LED 7-segment display uses about ¼ watt per character. While the entire LCD display uses micro-watts.  And now I am current with 1970’s technology, go me.  This, of course, means I will have to work on OLED displays soon!
Final thoughts
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan, Utah, which can be found on the web at: www.celticengineeringsolutions.com.  You can find the newsletter on the company blog, LinkedIn or by subscribing.  Send your emails to The Celtic Engineer at:  [email protected].