PDA

View Full Version : Serial LCD interfacing.



ankitmutha
10-23-2008, 08:08 PM
Hi all,

For 16*2 LCD based on Hitachi 44780.
Interfacing this LCD directly to AVR mcu requires atleast 9-10 wires and a lot of I/O pins of the mcu.

Aim is to reduce the no of I/O pins consumed for LCD interfacing to ONE like the LCD modules already available at Robokits:
http://robokits.co.in/shop/index.php?main_page=product_info&cPath=6&products_id=191

I just googled over this subject and found following interesting results.

Interfacing LCD by 3 wires:
http://www.scienceprog.com/connect-lcd-to-atmega-using-3-wires/
Using 2 wires:
http://www.scienceprog.com/interfacing-lcd-to-atmega-using-two-wires/

Interfacing Over UART:
http://members.shaw.ca/climber/avrserial.html
(this link provides only the software implementation)

http://www.stelioscellar.com/AVR/SerialLCD/serial_lcd_interface_using_avr.htm
(this is a good link provides with basic LCD funtionality and also gives crcuitry.)

http://www.beyondlogic.org/serial/serial3.htm
(It talks about LCD interface to UART)

I invites all, to post their views or anything that could help in interfacing LCD serially to mcu.

suggestion invited for the hardware implementation.

avinash_g
10-24-2008, 09:30 AM
Hi,

The robokits solution is expensive. :cry: Its just a MCU which takes serial (RS232 data) and drives the LCD. In this case it is engaging a much precious peripheral (The USART). You can make the same your self by writing a program for ATmega8. This slave ATmega8 can communicate with the master processor over SPI, whcih is much easier to implement in software than to use the Hardware SPI of Master. If you don't need the hardware SPI of master u can use it too. This way you don't waste some precious peripheral that u can use for much series jobs than the LCD.

If peoples are interested we can write a solution and make available publicly.

Also LCDs can be driven in nibble mode which uses 4 data bits and 3 other control lines. So in total u need 7 io lines. Learn more about it here ...
http://extremeelectronics.co.in/avr-tutorials/using-lcd-module-with-avrs/

ankitmutha
10-24-2008, 04:05 PM
@avinash_g
U said:
"....This slave ATmega8 can communicate with the master processor over SPI, whcih is much easier to implement in software than to use the Hardware SPI of Master."

the software implementation of SPI... how to do that??

I can understand that in hardware implementation of the same we can take the serial input form the master mcu and feed it to serial input of slave mcu (Atmega8 or ATtiny mcu ) and this slave can drive the LCD. Or better have a level converter before slave mcu so that it can be interfaced with PC as well.

Okay I think i know wat ur talking about.. I think u want to implement software routines for usart so that we can take input from any one general I/O pin of the master mcu. Is that right??? Im not sure how's that gonna work.

avinash_g
10-24-2008, 06:44 PM
@ankitmutha

Hi,

I think you are confusing SPI with USART. SPI is different than SPI the robokits version is using USART. I suggested using SPI because it is easier to implement in software that implementing USART in software.

And yes by implementing SPI in software will use any general purpose IO lines of MCU.

By implementing SPI in software we can save the REAL SPI hardware for other serious purpose like a fast interface to SD card etc ...

While on the slave side the actual hardware SPI can be used.

References for your help
Application Note describing soft SPI
http://www.atmel.com/dyn/resources/prod_documents/DOC3041.PDF

SPI Overview
http://www.scienceprog.com/serial-peripheral-interface-spi-bus-overview/

A very nice tutorial for Soft RS232 (USART) (Must See !!!)
http://winpicprog.co.uk/pic_tutorial7.htm

Once the slave is done you can provide a library in C which internally does the communication over soft spi (so that this library uses minimal resources of the system i.e. user is free to use USART,SPI etc for his/her our purpose) and present the user with easy to use functions like

LCDWriteString("Hi ankit");

Thats it have fun !!! :D

MohitM
10-24-2008, 09:13 PM
Also LCDs can be driven in nibble mode which uses 4 data bits and 3 other control lines. So in total u need 7 io lines. Learn more about it here ...
Actually, you can make do with 2 control lines (the LCD's R/W control pin can be grounded). So you just need 6 I/O.