Now a days almost all the mcu projects use a normal 16x2 char LCD or the LED to display the data, but the problem with those 16x2 LCD and LED is , they consumes a lot of power , they are very thick , bulky and the font size is really very small , and if you go for a big font size then they are really very expensive and some times we just don't want that may lines and character , what we want is just a 3 - 4 digit numbers and a big display font size.
so here is a quick tutorial on how to use a microchip pic mcu to drive an 4 common 7 segment lcd .
TYPES OF SEGMENTED(controller les "RAW") LCD
These type of LCD have no controllers built in all they are is just a liquid crystals sandwiched between to pieces of glass and sometimes a reflective plate at the back. The LCD who have that plate on the back (like my LCD has) called reflective and the LCD who don't have those plate looks quite a transparent called Transreflective.
There is another criteria for classification of the raw lcd glasses
Non Multiplexed (single Common) ( STATIC )
These LCD are simplest of it's type and very easy to drive , but the only problem is , each segment need a dedicated pin , so need too may pins lead to a big package mcu.
|Picture 1 (STATIC LCD driver signals)|
Multiplexed ( more than 1 common)
`Thse type of LCD have more than one common pins or Backplane. they can have 2 ,3 ,4 or so may back panes (the HD44780 16x2 char drive has 16 common). so driving these lcd is not a easy task i guess you can drive up to 2 common lcd without a dedicated lcd controller but beyond 2 common lcd you gonna need a lcd controller.
if you need more details how the lcd works please refers to the microchip application notes AN658
THE PIC16F917 LCD Microcontroller
the PIC16F917 microcontroller from Microchip has a LCD controller built-in,
comes is DIP 40 , TQFP44, and QFN 44 package.
Support up to 24 segments with up to 4 common or back planes
The lcd i m gonna use to demonstrate the PIC16F917 LCD controller is a multiplexed LCD which has 4 common and 8 segments. total 4 digits .
PIN CONFIGURATION of MY LCD
|Picture 3 pinout|
Check list:- Before you Go ahead there are some things you have to be sure about
1. you must some how verify how may Common back planes your LCD have,, if you don't have the data sheet of the LCD or you don't know the source from where it came . then you have to do lots of hit and trial to determine how may back plane your lcd have .. what i can suggest in this condition is take two signals of about 100Hz who are invert to each other ( phase difference of 180). CAUTION::don't supply DC voltage to the raw lcd it gonna damage the liquid crystal. , and don't even touch the lcd pins if the some other pin is connect to a drive signal. now you have to try every single pin with respect of every other pin. let me remind you two things one is that "few pins could be NC" and two or more pins may have the same function like my lcd have COM0 is on pin 1,2 . well it don't matter much which pin you use both them will work same.
2. what is the maximum voltage the lcd can take , most of the raw lcd will work in the range of 2 to 5 volts but after that if you supply more than 5v you gonna damage the pixels if you supply less voltage then the contrast will be really less.
3. you need to know the pinout of the lcd. if you don't know it go google for the datasheet or do some hit and trial test with two 180 degree phase difference(invert) signals.
5. how may segment your lcd has , if you are driving a non multiplexed lcd(STATIC lcd "having one common plane") then you need a single dedicated pin for each segment. so the required number of pins may go to very high . look whether the mcu has that much of segment pins . and even if it has check if these segment pins of the mcu are multiplexed pin some other peripheral like adc or timer input that you are gonna use then it may cause a problem.
|picture 4 schematic LCD Driver prototype|
DOWNLOAD SOURCE Code and Firmware.
THINGS TO KEEP IN MIND
* I guess most important thing in the hardware is the VLCD pins the there the total 4 VLCD pins VLCD0 is internally connected to ground and not available on the package pins so rest VLCD1 VLCD2 VLCD3 pins are available on the package. these the pins where you have to supply the proper voltage for diffrent levels of the signal V0 , V1,V2,V3 ( please refer to Picture 2 of this page "4 common driving signal")
you have to set these voltages according to your lcd ,like my lcd is 5 volts lcd so i use the resistor network configuration in such a way that VLCD3 pins has about 4.30 volts which is V3 level , VLCD2 pins to 3.40 volts which is V2 level and VLCD 1 pins got about 1.3 volts which goes as V1 level voltage.
let me remind you some facts about these voltage pins first is that microcontroller use voltage of these pins to generate the LCD driving signal . so if you left them unconnected then there will be nothing on the lcd.
second is that you have to first enable them in the software before using them , in our example code i also enabled them.
third is that you have to keep sufficient diffrence between these voltages, if you failed to maintain the sufficient difference then you will saw that if you on one segment then some other segment will also lit up( but with very less contrast.) .
and you have to keep these LCD voltage as close as possible so that every back plane's pixel's contrast will remain same.
so the all you have to do is keep all the voltage as high as possible for best contrast but blow the maximum tolerance of the lcd .
as you can see in the schematic there is pot on between the VCC and the VLCD3 pin actually this pin is used to adjust the control the voltage on all three pins , by which you can adjust the contrast
thanks for reading
any Questions ??? feel free to ask.