Connect with us

16 Bit LCD programming

Discussion in 'Microcontrollers, Programming and IoT' started by Sadlercomfort, Dec 4, 2015.

  1. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    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
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    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.

    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.
     
  3. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    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.
     
  4. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    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.
     

    Attached Files:

  5. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
  6. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    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?
     
  7. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    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.
     
  8. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    I'll understand eventually, I think I'd prefer to connect it directly to the PIC though.
     
  9. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    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.
     
  10. Minder

    Minder

    2,826
    585
    Apr 24, 2015

    Attached Files:

    • lcd2.pdf
      File size:
      116.9 KB
      Views:
      156
    • lcd1.pdf
      File size:
      258.8 KB
      Views:
      137
    Last edited: Dec 4, 2015
  11. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    Sorry, Where is Nigels C code? I haven't been able to find it.
     
  12. Minder

    Minder

    2,826
    585
    Apr 24, 2015
  13. Sadlercomfort

    Sadlercomfort Ash

    424
    53
    Feb 9, 2013
    Thank you! :D
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-