LCD routines

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am having troubles writing to a standard 4*20 lcd using 4 bit mode.
I am using AtmanAVR and the the functions that is built in the IDE.

The problem is that lcd_init locks up my atmega.

lcd_init(20, &PORTA); <- locks up my atmega

while(1) <- never reached
{
}

The while(1) loop is never reached. Outcomment/disabling the lcd_init causes normal execution.

As far as I can withdraw from other lcd drivers available (for standard line lcds), there is no handshaking between the mcu and the lcd so the driver should not cause the mcu to lock up even if connections from mcu to lcd are bad.

The irritating part is that it has worked once, but after problems with correct settings of fuses in the m16, my home manufactured atmega16 board causes a bunch of problems.

My question is, does anyone have simple drivers for lcd so I can debug my code.

Any suggestions to what causes the problem would be great.

Thanks in advance
Kahr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"As far as I can withdraw from other lcd drivers available (for standard line lcds), there is no handshaking between the mcu and the lcd so the driver should not cause the mcu to lock up even if connections from mcu to lcd are bad."

Not true. Many drivers, including CodeVision's, look for the "ready" status bit to be returned. I do not know how your library does it, but it would be very common to operate in this manner.

Lee

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Lee,

exactly the kind of comments i need and the reason I need a lcd driver
with source code to be able to turn of the read back of any status to determine whether my lcd is damaged.

Kahr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Build a timer into the loop that looks for the status bit so if the status is never returned as clear you can leave the loop and return an eror code.

You have posted a code line for the init of the display. Does this mean you do not know what is happening at the actual port pin bashing level, at this point?
Mike

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

paste the program into a message... let us look at it.... make sure you show us all the bits....

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Better yet, attach it.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

There is no program to attach due to the fact that the lcd driver source code in atman is not available. I cant debug the driver and thats the reason why i need another simple driver to be able to debug to find out wether my problem is caused by hardware og software.

Kahr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attached is a c file for LCD drivng.

You will need to allocate the port pins as you are using them and modify the read and send nibble routines to suit the pin allocation. Also there is a timer used which is interrupt controlled. This timer decremented during my main 'heartbeat' timing interrupt routine.
MIke

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Log in to the 'academy' section here, and read the title of each project... there are several pages, it will only take a few minutes, but you will see several projects using text mode lcd with hd44780 controller chip, toshiba controller chip, even hitachi 63180 controller chip. If you use the hd44780 controller, I would download 3 or 4 projects that use that controller, look at each one, use the one that is easiest for you to read and understand as the starting point for your project.

admin's test signature