Maker Pro
Maker Pro

16 Bit LCD programming

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Hi Guys,

I'm trying to learn how to program LCD modules with a pic16f73.

Does anyone have some useful information on what I need to know? I understand how to connect each pin up and what there functions are.. but I'm struggle to understand how to write text to it in code. For example how to set the data bus to write "Hello".

I'm using C but assembly is fine if it's easier to explain =)

Thanks,
Ash
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,738
Joined
Nov 17, 2011
Messages
13,738
Please give us more details to work with:
  • Which LCD module?
  • Is it a graphic or text LCD?
  • How is it connected to the PIC?
The manual of the LCD should tell you most of what you need to know. You may even be able to find a library for the PIC that controls just your type of LCD as many LCDs are built around only a handful of different controllers.

For example how to set the data bus to write "Hello".
Typically (but details depend on the type of LCD) you set a "cursor" by telling the LCD where on the display to put the next characters. If necessary, you also tell the LCD to advance the cursor automatically one position after it has received the first character (if your LCD doesn't have that feature you'd have to advance the cursor by another command).Then you write the next character. And so on.

Personally I'd search for a suitable library and if you can't find one, write your own set of routines so you won't have troble next time.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
The datasheet has limited information. Please wait until I can get to a computer to provide the datasheet and how I've connected it to the pic.

It's a standard text lcd.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Okay, I've attached the datasheet and the circuit diagram.

The LCD used in the circuit diagram is standard, but the pins match up.
There might be a library I can use in the Hi-Tech C Compiler I'm using, but I'm not sure.
 

Attachments

  • LCD PC 0802-L.pdf
    77 KB · Views: 170
  • LCD Display.PDF
    27.1 KB · Views: 109

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Thanks,

I'm not sure how the LCD actually works though, so the controller is confusing me further.

How does the dots work? Do you have to program each segment one at a time, with the right dots?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,738
Joined
Nov 17, 2011
Messages
13,738
How does the dots work? Do you have to program each segment one at a time, with the right dots?
No, fortunately not.
  • The controller has a "Display Data RAM" (datasheet page 10) where you store the text to be displayed as sequence of 8 bit characters.
  • It also has a "Character Generator ROM" which translates the 8 bit codes from the data ram into the right codes for displaying text on the matrix display (cf. table 4, page 13).
  • There is also a "Characer Generator RAM" that you can use to create your own translation table from 8 bit code to matrix display. Ignore this for starters.
  • Starting on page 17 the instructions for the LCD controller are explained. You'll have to work through this section to understand how to have your data displayed at the right locations.
  • On page 24 there is an example program (albeit in 8051 code) wich should help you get started once you translate it into PIC code, which should be fairly straightforward.
Unfortunately I''m not familiar with this controller, so I'm afraid you have to sweat through this by yourself - unless someone else is able to jump in.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
I'll understand eventually, I think I'd prefer to connect it directly to the PIC though.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,738
Joined
Nov 17, 2011
Messages
13,738
I think I'd prefer to connect it directly to the PIC though.
Hmm, I don't understand. Of course you'll have to interface the LCD to the PIC. The 8051 code is given as an example and you will have to convert it into equivalent PIC code naturally.
You can use the LCD with an 8 bit or a 4 bit interface. You'll have to provide data and control signals (read/write etc.) which you can create using port pins of the PIC.
 

Minder

Apr 24, 2015
3,478
Joined
Apr 24, 2015
Messages
3,478

Attachments

  • lcd2.pdf
    116.9 KB · Views: 156
  • lcd1.pdf
    258.8 KB · Views: 137
Last edited:
Top