Author Topic: LCD INTERFACING WITH AVR  (Read 15898 times)

0 Members and 1 Guest are viewing this topic.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
LCD INTERFACING WITH AVR
« on: April 07, 2008, 11:00:42 AM »
DO ANY OF YOU HAVE ANY EXPERIENCE IN INTERFACING LCD'S WITH AVR???

If yes then can u tell me how you interfaced lcd with your avr or any microcontroller and how you displayed letters and stuff on your lcd.

Please be clear in the following points..

How to connect an lcd with avr?

How to command the lcd to display characters on its screen?

How to program your avr for interfacing with an lcd?
]
Any kind of code example will be highly helpful..

Thanks in advance...

JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #1 on: April 07, 2008, 11:40:29 AM »
There are 2 kinds of simple alphanumeric LCDs: parallel and serial.

The parallel LCD can be controlled by 8 or just 4 controll bits. I am not sure how this works in C, but in Bascom-AVR they are easy to use. For Arduino I have found a library to use them.

The serial LCD has a microcontroller (or other driver) that takes serial commands and displays them on the parallel LCD. The advantage is that you may use regular serial commands like for printing on the computer's screen (when you use Terminal).

For the ease of use, I would recomend a serial LCD. This way there is no need for any code change. If you really want to get down and dirty, get a smaller AVR (like ATtiny26 for example) and serialize a parallel LCD.
Check out the uBotino robot controller!

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #2 on: April 07, 2008, 11:44:56 AM »
so serial lcd's will be cool but how do i use them and how i program them??
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: LCD INTERFACING WITH AVR
« Reply #3 on: April 07, 2008, 12:29:53 PM »
Quote
The parallel LCD can be controlled by 8 or just 4 controll bits. I am not sure how this works in C,
in c you have to embedd the lcd.h library, its as easy as gum
you have functions to send a whole string or one char
you have functions to move the cursor,,an so many things
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #4 on: April 07, 2008, 12:40:38 PM »
please tell me the exact schematic diagram and how to program the serial or paralle lcd in C.

By programming i mean which functions to declare and how to transmit data and all
« Last Edit: April 07, 2008, 12:41:32 PM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #5 on: April 07, 2008, 01:03:01 PM »
Check this out: http://www.sparkfun.com/commerce/product_info.php?products_id=461 In the links section, you will find schematic, datasheet, code samples.

There is a schematic for a I2C LCD interface and a sample code for Arduino. You can check it out here: http://www.arduino.cc/playground/Code/I2CPortExpanderAndLCDs
Check out the uBotino robot controller!

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: LCD INTERFACING WITH AVR
« Reply #6 on: April 07, 2008, 01:12:49 PM »
don't you just enable UART and then you can do printf(); to the LCD?

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #7 on: April 07, 2008, 01:22:17 PM »
UART with lcd since i never used it i dont know
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #8 on: April 07, 2008, 01:29:09 PM »
somebody got to have a detailed sschematic coz i am not going to get that oone on sparkfun , i have a different 16*2 lcd
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #9 on: April 07, 2008, 02:09:40 PM »
Check out the uBotino robot controller!

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #10 on: April 07, 2008, 02:41:00 PM »
thanks for the schematic but still i have to learn how to program lcd's , u got any sample codes or something or is it the same as normal uart
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #11 on: April 07, 2008, 03:12:19 PM »
Well, the explanations are in hungarian (I don't speak the language) but the code and schematics are in english. So you may figure something out of it as I did. http://avr.tavir.hu/modules.php?name=Content&pa=showpage&pid=15
Check out the uBotino robot controller!

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: LCD INTERFACING WITH AVR
« Reply #12 on: April 07, 2008, 04:36:30 PM »
I'd think it would be normal UART.

there would be power and ground wires

and then some sort of TX/RX wires

I'm not sure though, I havent gotten their yet.

Check the UART tutorial though, I think I saw some mention of LCD in there.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: LCD INTERFACING WITH AVR
« Reply #13 on: April 07, 2008, 05:48:58 PM »
You just send printf's to UART. Its as easy as a bunny with a pancake on its head:
http://www.societyofrobots.com/microcontroller_uart.shtml
http://www.societyofrobots.com/microcontroller_uart_50_robot.shtml

Oh and please don't demand schematics, thats what google is for:
http://www.societyofrobots.com/robot_faq.shtml#read_datasheet

 ;D

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: LCD INTERFACING WITH AVR
« Reply #14 on: April 08, 2008, 05:49:49 AM »
When you say:

Quote
i have a different 16*2 lcd

Its not clear whether you mean you just have the bare LCD or whether it is serial enabled.

If its not serial enabled then you will need to get a pin-out diagram for the exact model of LCD you've got. Hard to give any more help without knowing what you've got.

If it is serial enabled then it will have connections for: ground, power (normally +5v), signal in/receive, and some also have a signal out/transmit. The last pin, if its there, is used to reply to command like 'tell me you model number and firmware revision'. Obviously the ability to do this, and the exact commands you can send to do things like 'clear screen', 'backlight on' etc vary from one suppllier to another.

You will then follow the UART tutorial and you can use Admins 'rprintf' tools to send text and commands to the LCD.

Its very easy ! Got mine up and going in about 5 minutes.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #15 on: April 08, 2008, 07:52:01 AM »
i dont have problem with uart as i have implemented them bfore but i dont know if they are serial based or not only think i know that is based on the hitachi 44780 controller with 8 bit and 4 bit operation
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #16 on: April 09, 2008, 02:36:02 AM »
and yes it has a contrast adjustable feature
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: LCD INTERFACING WITH AVR
« Reply #17 on: April 09, 2008, 02:57:06 AM »
as a first time lcd programing just dont use UART,
open the file lcd.h in your compiler library folder
,watch the functions you can use
,read the hitachi driver datasheet for the commands

maybe if you read the library functions only you can get to program an lcd without looking at the datasheet

i cant give you functions as i use the codevision compiler and im not sure the functions are written the same

there should be functions to send one character
function to send a whole string
function to initialize the lcd
function to move the cursor (x,y)
..........................................................etc

google for some lcd projects ,im sure there are many
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #18 on: April 09, 2008, 03:03:08 AM »
well i have no problems with uart as i have used them bfore i just wanted to know is passing charcacters to lcd different from passing characters to uart and how to initialize the lcd as i got no lcd.h in my winavr iclude directory
« Last Edit: April 09, 2008, 03:10:08 AM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: LCD INTERFACING WITH AVR
« Reply #19 on: April 09, 2008, 03:17:24 AM »
you can download yourself a lcd.h , search the net
or if you dont want to use it you have to build the functions yourself so you would surely need the driver datasheet
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #20 on: April 09, 2008, 03:27:14 AM »
ok ill do that but after i initialize , where do i connect the tx and rx pins from mcu to lcd and do i need to use max232
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: LCD INTERFACING WITH AVR
« Reply #21 on: April 09, 2008, 09:39:06 AM »
Quote
where do i connect the tx and rx pins from mcu to lcd and do i need to use max232

max232?? this ic is made to interface TTL (5v(1) - 0v(0))logic into RS-232 levels(+15v(0)  -15v(1)),,,,and vice-versa

i dont think you want it,,although you should check with your lcd datasheet maybe it uses the rs-232 levels? i dont think so
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #22 on: April 09, 2008, 09:43:05 AM »
no it doesnt i can connect directly to tx and rx but how do u think i should start
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #23 on: April 09, 2008, 10:15:27 AM »
So you don't have any documentation on your LCD? How expensive it was? If it was under $15 it is a parallel LCD. If it was over $20, it is a serial LCD.

A serial LCD has a second board connected to the board of the LCD with 12-15 pins. this second board has a microcontroller or other circuit that transfers serial data into parallel data. The connections on this second board should be 3 or 4 pins. One for +5V, one for GND, one for Rx and perhaps one for Tx. The first 2 you know how to connect. The Rx pin you need to connect to your microcontroller Tx pin (your microcontroller Transmits data that it is Received by the LCD board). The Tx pin you need to connect to your microcontroller Rx pin for acknoledge or other possible response.

I bet that your LCD is a parallel one. Can you take a picture of the back of the LCD?
Check out the uBotino robot controller!

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #24 on: April 09, 2008, 10:29:49 AM »
no it doesnt contain 4 pins it contains more than 8 pins , yup i think its parallel so what do i do? it cost under $20 around $8
« Last Edit: April 09, 2008, 10:33:45 AM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #25 on: April 09, 2008, 12:29:22 PM »
I allready gave you the schematic...
Check out the uBotino robot controller!

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #26 on: April 09, 2008, 12:30:58 PM »
so what do i do abt the coding?
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #27 on: April 09, 2008, 01:17:00 PM »
do i need to copy paste the code from the links i gave you?
Check out the uBotino robot controller!

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: LCD INTERFACING WITH AVR
« Reply #28 on: April 10, 2008, 10:32:54 AM »
lol no ill see what i can do but can i expect some help from u like-----a little fundamentals on lcd interfacing just not the circuit schematics...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: LCD INTERFACING WITH AVR
« Reply #29 on: April 10, 2008, 11:05:20 AM »
Take a look at this page: http://www.ladyada.net/learn/arduino/lcd.html
Even if your LCD pins are different, read about the connections of the pins, download the library and take a look at the code, you will get an idea of what to do. Other than that, you're on your own. Or ask for C programmers around here.
Check out the uBotino robot controller!

 


Get Your Ad Here

data_list