| Author |
Message |
|
|
Posted: Jan 12, 2007 - 12:33 AM |
|

Joined: Apr 07, 2006
Posts: 407
Location: Braga, Portugal
|
|
Hi,
It works perfectly. I gave a light look across all the code and i have some doubts that i would like to put you.
Not now because i need to sleep. But tomorow! If you are available to answer them, of course!
Thx,
Nuno |
|
|
| |
|
|
|
|
|
Posted: Jan 12, 2007 - 12:56 AM |
|


Joined: May 30, 2004
Posts: 8141
Location: Cincinnati, Ohio
|
|
|
JohanEkdahl wrote:
...it might be that Carls code does not follow that sequence to the letter):
This might, in fact, be the case! Although, it will be very close.
I have since done a lot more work on my LCD project, though, it doesn't apply to a tutorial and, it also dosen't use 4 bit mode anymore but, rather; it is for a project that is required to write data to the LCD text based display at a serial communications rate of 115.2K BAUD.
I seriously doubt that a standard text based LCD display can reliably deal with processing and displaying data at 115.2K BAUD using 4 bit mode.
This project has been a real trip - especially getting it to work reliably on about 10 different manufacturers at 115.2K BAUD. But be advised, my current project was inspired by this thread and this thread caused me to get off of my lazy AS.. and, finally get through it. Thanks!
Oh! This is one project that I plan to deposit into the "Projects" forum. |
_________________ Carl W. Livingston, KC5OTL
microcarl@roadrunner.com
"There are only two ways to sleep well at night... be ignorant or be prepared."
The original Dragon Slayer !
Long live the AVR!!!
|
| |
|
|
|
|
|
Posted: Jan 12, 2007 - 12:47 PM |
|

Joined: Apr 07, 2006
Posts: 407
Location: Braga, Portugal
|
|
Nice!  |
|
|
| |
|
|
|
|
|
Posted: Jan 12, 2007 - 01:59 PM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
|
Quote:
i have some doubts that i would like to put you. Not now because i need to sleep. But tomorow!
You are most welcome.
Quote:
If you are available to answer them, of course!
There is a high probablility that I will spend much of the weekend in front of my computer (as if I didn't do that all week...), and I will be focusing on LCD issues. Yes, it is about the Tutorial, and I wantyour feedback, which very well could be in form of questions or doubts. Bring it on! |
|
|
| |
|
|
|
|
|
Posted: Jan 12, 2007 - 02:27 PM |
|

Joined: Nov 14, 2005
Posts: 20
|
|
Hi,
I also have some issues with LCD's. I use several (4 bit mode) with the cvavr library. In general all works well but sometimes the LCDs do not reset correctly.
I assume that one can repeat the init sequence anytime to get clean conditions but I have some doubts about it now. On several occasions the LCD seems to hang (must be revived by interrupting the Vcc) if the init is applied after doing some output.
BTW in 4 bit mode do you ground the D0..D3 pins on the LCD and use pull-ups for the others? |
|
|
| |
|
|
|
|
|
Posted: Jan 12, 2007 - 02:59 PM |
|


Joined: May 30, 2004
Posts: 8141
Location: Cincinnati, Ohio
|
|
|
Fried wrote:
BTW in 4 bit mode do you ground the D0..D3 pins on the LCD and use pull-ups for the others?
That's what my Optrex datasheet says.
But you do not need "Pull-Up" resistors on the active DB7:DB4 nibble. |
_________________ Carl W. Livingston, KC5OTL
microcarl@roadrunner.com
"There are only two ways to sleep well at night... be ignorant or be prepared."
The original Dragon Slayer !
Long live the AVR!!!
|
| |
|
|
|
|
|
Posted: Jan 14, 2007 - 03:27 PM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
| On Jan 12, 2007
sinosoidal wrote:
I gave a light look across all the code and i have some doubts that i would like to put you.
Not now because i need to sleep. But tomorow!
It's the day after "tomorrow". I'm just about to start another writing pass. It would be nice if you could post what your "doubts" where so I can take them into consideration. Please... |
|
|
| |
|
|
|
|
|
Posted: Jan 14, 2007 - 09:10 PM |
|

Joined: Jan 01, 2007
Posts: 7
|
|
Hi all,
I am using very simple C code program with standard lcd.c and lcd.h libraries for managing 16x1 LCD with KS0066 driver. Trouble is that on LCD is visible only
first half of characters and second half is empty.
I assume that program is working properly (first 8 characters is always visible). In lcd.h is setting only for D44780 and KS0073 controllers. I think that trouble is maybe in internal KS0066 addressing???
Do you know this type of LCD trouble? Can you help me? Thank you. Tomas  |
|
|
| |
|
|
|
|
|
Posted: Jan 14, 2007 - 09:38 PM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
WE had the same problem in another recent thread. There are 16x1 LCDs that actually function as two-line displays. The first eight characters are on line 1, and the last eight characters are on line two. Try to set your display to two lines and see if that helps. Please note that the addressing is not linear, but rather like this (hex): 00, 01, ... 07, 41, 42, ... 47.
The recent thread with similar topic is here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=280670&highlight=#280670. |
|
|
| |
|
|
|
|
|
Posted: Sep 28, 2007 - 03:55 AM |
|

Joined: Aug 01, 2006
Posts: 55
Location: Gainesville, FL
|
|
Thank you JohanEkdahl, your code was very helpful. I really like the way you commented your functions. It was very easy to understand.
One question, why did you use the volatile qualifier before the while loop?
Code:
volatile int i = 0;
|
|
|
| |
|
|
|
|
|
Posted: Sep 28, 2007 - 05:57 AM |
|

Joined: Aug 01, 2006
Posts: 55
Location: Gainesville, FL
|
|
JohanEkdahl,
In your code you state
Quote:
/*
* This holds as long as you have the four data signals
* connected to the upper 4-bit nibble of the AVR port,
* and you run at a maximum frequency of 8 MHz.
*/
What changes if you are running at 16 MHz? |
|
|
| |
|
|
|
|
|
Posted: Sep 28, 2007 - 09:05 AM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
|
Quote:
What changes if you are running at 16 MHz?
Without looking at the code again, I think you'd have to look at two things:
1) The short timing constraints that is required while sending one byte/nibble. Eg the "data steady time" before E drops. For up to 4 MHz you cant break this constraint even in hand-optimized assembly (IIRC, I actually have the same program in assembler with timing comments but I'm at work now). You might have to insert short "time-wasters"/NOPs.
2) The longer delays are done with delay_ms/delau_us. When the clock is frequency is raised the maximum time that these routines can delay falls. See the avr-libc documentation for the nitty-gritty... |
|
|
| |
|
|
|
|
|
Posted: Sep 28, 2007 - 09:08 AM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
|
Quote:
why did you use the volatile qualifier before the while loop?
Oppps. Must have copied/pasted some code. The volatile qualifier is not needed. |
|
|
| |
|
|
|
|
|
Posted: Nov 07, 2008 - 03:38 AM |
|

Joined: Feb 20, 2008
Posts: 41
|
|
Hello,newbie here,
When I build avr-gcc4bit.c in Studio4 14.489...
I get a ../LCDJohann.c:10:24: util/delay.h: No such file or directory.
I tried building it for an atmega 88 and 128, just to see if one of them had that library or not....util/delay.h something I have to install or should it be part of the library already?
thanks in advance!!! |
|
|
| |
|
|
|
|
|
Posted: Nov 07, 2008 - 11:07 AM |
|

Joined: May 10, 2007
Posts: 58
Location: Woodbridge, NJ, USA
|
|
You should really start a new topic instead of posting your question at the end of a 1 year old 4 page thread.
util/delay.h is part of WinAVR.
David. |
|
|
| |
|
|
|
|
|
Posted: Nov 07, 2008 - 02:38 PM |
|

Joined: Feb 20, 2008
Posts: 41
|
|
hmm, i don't understand why the "build" process doesn't find the util/delay.h file .....i guess I need to look into what files are in MY WinAvr library, bad installation if missing?
I'll start a new thread if this gets's any more involved. |
|
|
| |
|
|
|
|
|
Posted: Nov 18, 2008 - 01:33 AM |
|


Joined: May 01, 2002
Posts: 846
Location: Texas
|
|
In case you missed it, the CodeVisionAVR C compiler comes with library function to support your LCD Char. display. I think they offer limited student or eval version and the full price is only a few hundred dollars so maybe you might consider buying that compiler then you could move on with your project.
Al Welch |
|
|
| |
|
|
|
|
|
Posted: Nov 18, 2008 - 01:17 PM |
|

Joined: Jul 18, 2008
Posts: 10
Location: San Jose California
|
|
THANK YOU. After hours of tearing my hair out after never using LCD's before, i finally got my 2x20 lcd working correctly and have a bit of a better understanding of how the commands are sent after examining your code, very helpful.  |
|
|
| |
|
|
|
|
|
Posted: Nov 18, 2008 - 04:50 PM |
|


Joined: Mar 27, 2002
Posts: 18749
Location: Lund, Sweden
|
|
So, what did you end up with? Did you solve the avr-libc issue with util/delay.h? If so, what was it? Or did you take the CodeVision AVR approach?
Can I rub my ego with another running instance of my demo code?  |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2008 - 04:30 AM |
|

Joined: Feb 23, 2008
Posts: 162
Location: Bangkok
|
|
Johan,your code looks very nice; even an illiterate like me can follow it without a problem. It was just the right thing I needed to get a grip on LCD control.
But... I'm sure the code is right but my display just pulls out a pixel version of a Jackson Pollock art piece and goes blank in a second.It didn't came with instructions so I probably have some of the wiring wrong.
Thanks for sharing it and I'll let you know if I can make the display work later. |
|
|
| |
|
|
|
|
|