Thread: Help with LCD code

  1. #1
    Registered User
    Join Date
    Mar 2005

    Help with LCD code

    Hello Forum,

    I'm new to this forum, but I would like to receive some help on a project I'm working on right now. Basically, it involves a microcontroller and an LCD (8 bit interface). The LCD is connected to Port A of the controller (PA0-PA7).

    Basically I would like to know how to output to Port A in order to initialize the LCD and have it display characters. I understand that there are lots of resources on this already, but I would like to learn the whole programming aspect of it, as well the controller I'm using is not the typical pic16 or pic18 microcontroller.

    I would like to thank you for any help ahead of time.


  2. #2
    Registered User
    Join Date
    Feb 2005
    The commands depend on the LCD. Basically what you are going to want to do is set up the command register first and then load the data register. For example if PortA was at 0x392 then you could do this

    mov dx, 392H
    mov ax, 91H
    out dx, ax
    This is assuming that 91H sets all the command register for say 2x20 line lcd screen, set's the curser to blink and set it at the beginning of the first line.

    Then say your data register was at 393H. You could send data out the same way. So put that in an _ASM directive and use an unsigned char to hold the ascii text [You said 8-bit interface] to transfer the data.

    Other than that could you give the model number of the lcd?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well you could start by saying which "microcontroller" and which "lcd" module you have.
    We're not psychics you know!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Welcome to the forum Dara,

    Do you have a compiler for this particular microcontroller?

    There is no standard C++ way to write to an I/O port. The C++ compiler for that chip will have its own custom I/0 library. In the unlikely event that you have a compiler for the "system", then cout will write characters to the display. But even then, you'll probably want to more control than just writing characters on the display.

    You'll have to consult the LCD's data sheet to learn how to talk to it.

    The hardware & software tasks are similar. You have to learn how each part works, then figure-out how to make them work together. Of course, this sometimes involves adding some additional custom hardware, or writing a custom software library.
    Last edited by DougDbug; 03-10-2005 at 01:16 PM.

  5. #5
    Registered User
    Join Date
    Mar 2005
    The LCD controller is a ST70066U, but the spec sheet says that the pin function is compatible with the HD44780, KS0066 and SED1278 controllers.

    The microcontroller that I am using is the atmel at43usb355 chip.

    The compiler for this microcontroller is the WinAVR or IAR embedded workbench. I have both of these downloaded as of right now, but the IAR is on a trial period of about 27 more days.

    Thank you all for your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Proposal: Code colouring
    By Perspective in forum A Brief History of
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM