Thursday, March 1, 2012

PIC MCU LCD Driver 4 commmon 7 Segmented LCD & PIC16F917

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 .

Prototype

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 )

In this Type of there is one common signal called Backplane .and a dedicated pin for each of the segment of LCD to drive them you have to input a square wave (~100 Hz) to that..if u wanna switch on a segment you the provide a wave 180 degrees out of phase with the backplane and if u wanna turn it off then give same phase wave as the backplane. and you have to keep the square wave going for all the time you want the display to be on other wise in the mean time display will got fade.

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.

Picture 2

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.

* 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

sorry tom i picked up this lcd in local market, it doesn't have any part no. but the only thing the shopkeeper told me is that this lcd is used in petrol pump machines. the only thing i can suggest you should look lumex lcd website there are similar module available

Hello,For the same pic16f917 i interfaced the lcd display its working fine. But i want to communicate this pic16f917 with one arduino. I need a reference code for i2c communication to this pic16f917. Please help me to find out. Thank you.

Search This Site

About Me

I am an Electronics/Software Design Engineer.
Anybody have questions about Embedded system design and software system design may ask questions here. if you have custom project in mind please ask for quote.