If I want to display a sequence or any character that what are the steps. I have a LCD that is attached with this and I want to know that how can I use this LCD to display my name or number etc. I read some datasheets and documents.From there, I get that how LCD works ,their COM pins and segments pins.The thing that I am not getting is how to generate the segment value for a particular digit. I have attached a pdf file that is on which I have to work with. As a begineer in the field of software I want to display some sequences on the LCD.

Any new idea would be really appreciated

Thanks.enter image description here


closed as unclear what you're asking by Joe Hass, Dave Tweed, Stephen Collings, Daniel Grillo, Samuel Jan 30 '14 at 20:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


The approach I usually take is to create a bitmap of the segments in memory, and write what is to be displayed to that bitmap.

If the microcontroller you are using has an LCD controller, then that bitmap would be part of the peripheral. If you are rolling your own, the bitmap would likely be accessed by a periodic interrupt service routine (ISR) to periodically write the data to the pins (you must keep the DC component of the voltage on the LCD 'glass' to a very low level or you will damage the LCD by electrochemical action (50mV is frequently set as a limit, but read your LCD datasheet). Your LCD controller code (or LCD controller hardware) will control each segment on/off depending on the bits in the bitmap, so if the bit is '1' for that particular segment, it will see the waveform specified in your LCD datasheet.

Note that you've chosen a 1/3 bias 4-common LCD rather than a static drive (fewer connections) so the waveforms get a bit complicated and you'll need a resistor divider if you don't have a dedicated LCD controller peripheral. Here's a Microchip app note this subject, which can easily be applied to almost any microcontroller.

enter image description here

Your question:

The thing that I am not getting is how to generate the segment value for a particular digit.

I typically do something like this (in C)

enter image description here

This is mapped to the display segments directly, segment 'A' = LSB all the say up to segment 'G' = bit 6, (and decimal point is the MSB). You could use another byte or two for the annunciators such as 'TIME'.

Then a digit 'n' can be written into the i'th digit of the bitmapped buffer by..

enter image description here

When the buffer is all nice and pretty, with the final data you want your user to see, it can be copied into the display bitmap, so it's analogous to a frame buffer in a bitmapped graphic display.

You probably don't want to write intermediate data to your display bitmap because it could make the display appear erratic and less attractive.

Generating the correct digits in each position for (say) a 2's complement binary number in decimal with an implied decimal point and leading zero suppression is an interesting programming exercise, and I'll leave that for you. It has nothing to do with electronics- the code would be the same for an LED display. You have to do something like convert binary to unpacked BCD and format it. The code above will convert each unpacked BCD digit to a 7-segment bitmap.

The segments in digits of 7-segment displays are numbered as follows: enter image description here

Bit 0 is mapped to segment A, bit 1 to B and so on.

  • \$\begingroup\$ Thanks for the answer. I got your points but still there is something that I don't understand that why did you use % 10 in displaying the buffer? Another thing is that what is i'th digit.If I want to display digit '0' and placed it in buffer 1 then it works or not? \$\endgroup\$ – SSS Jan 31 '14 at 9:27
  • \$\begingroup\$ % 10 -- the array is 10 elements long, the %10 prevents the index from going out of bounds if the input n (typically an unsigned char on an 8-bit MCU) is >= 10. \$\endgroup\$ – Spehro Pefhany Jan 31 '14 at 13:05
  • \$\begingroup\$ Say the display you want is 1234. i = 1; n=3; buffer[....]; puts the segment bitmap for '3' (which is 0x4F) in buffer digit 1. Each bit (0..6) in 0x4F represents a segment, and 1 means the segment is 'on' (whichever state that means for your display type). Bit 0 is segment A, bit 0 is segment B, etc. \$\endgroup\$ – Spehro Pefhany Jan 31 '14 at 13:12

I want to display some sequences on the LCD.

Generally these LCD panels are driven by applying a frequently reversing DC voltage to the segments individually. The voltage must be frequently reversed or the display will be damaged.

The driver circuitry determines which LCD segments need to be turned on to make up a specific character at a specific position.

If you want to do this the hard way, you can read an appropriate application note such as AVR241: Direct driving of LCD display using general IO or Universal LCD driver for low multiplex rates

The thing that I am not getting is how to generate the segment value for a particular digit.

To display say "3" at position 2, you must turn on five specific segments. This will be described in the data sheet for the LCD. Displays with a low segment-count have one pin per segment. Displays like the one in your question are multiplexed (as described in the application notes above).

enter image description here See Wikipedia

If you are new to software and to electronics you will find it easier to use a serial (e.g.) or parallel (e.g.) display module which incorporates driver circuitry.

  • \$\begingroup\$ As you mention that to display '3' I have to turn on the 5 segment but how do I know at which position I have to put the value?e.g. if I put buffer[1]=0x3F then is it display '0' on the display?? \$\endgroup\$ – SSS Jan 31 '14 at 9:38
  • \$\begingroup\$ @SSS: Putting 0x3F into a memory slot in a microcontroller won't make anything appear on the display unless you put in place the additional code to read those values and activate the appropriate IO pins and circuitry to drive the display (or to drive a display controller IC). Do you have experience driving 7-segment LED (not LCD) displays? \$\endgroup\$ – RedGrittyBrick Jan 31 '14 at 9:50
  • \$\begingroup\$ No I don't have any experience in LED also. But I know the basic principle how it works. I also read some documents that mostly help me but there is still some doubt \$\endgroup\$ – SSS Feb 1 '14 at 5:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.