Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: LCD Display Problems

2008-12-02 by Jeremy

I am sorry if the formatting of my post is off. Not quite sure whether 
yahoo groups wants it to look good or not. If I read the post from the 
group there is no formatting but if I post a reply, the text is 
formatted. 

I also wanted to add that I'm using AVR Studio with AVR-GCC.

--- In AVR-Chat@yahoogroups.com, "Jeremy" <luminare@...> wrote:
>
> I'm tinkering with a 16x2 HD44780 LCD display attached to my dragon 
> rider. The uC is a ATmega32 feeding the LCD through PortA and using 
> JTag as the debugger/programmer. I am using Peter Fleury's lcd 
> libraries (http://jump.to/fleury). The only thing I've changed in 
the 
> header is that Im connecting to a 2 line LCD on PortA and running at 
> 8Mhz.
> 
> The problem I am getting is pertaining to the code I have posted 
> below. It seems I am getting artifacts on my screen and I'm not 
quite 
> sure why? I am running a couple loops in order to marquis topstr and 
> lowstr across the lcd display on both lines. The top one comes from 
> the right and the lower from the right. They work fine except for 
> erroneous text I keep seeing on the display. (I drew an image as an 
> example. The ¶- artifact starts in the middle and scrolls opposite 
of 
> what that line is suppose to do. I thought maybe it's displaying 
extra 
> information in memory as when I have put userChars into memory to 
> display it, the ¶ changes to the character from userChars but 
reverts 
> if I remove the code which introduces userChars (as you can see I 
have 
> it commented out now). Erasing the Flash and EEPROM memory doesnt 
seem 
> to change anything. After a reprogramming, it just reverts back to 
the 
> same problem. 
> 
> If any of you have used Peter Fleury's lcd code or might know what 
is 
> going on through this rough but I hope extensive description, I 
would 
> appreciate the help. Thanks
> 
> What it should look like (the two stars move towards eachother to 
the 
> opposite side)->
>             *---... |
> ..---*              |
> 
> What it looks like (the artifact moves with the upper star from the 
> middle till it meets the bottom star and disappears)->
>             *---... |
> ..---*  ¶-          |
> 
> 
> -Code-
> #include <avr/io.h>
> #include "lcd.h"
> #include <util/delay.h>				// 
_delay_ms(#) Header
> #include <avr/pgmspace.h>			// To access eeprom
> 
> //static const PROGMEM unsigned char userChars[] =
> //{
> //	0x0,0xA,0x1F,0x1F,0xE,0x4,0x0,0x0            // Test character
> //};
> 
> void delay_ms(int cnt)
> {
>   	while(cnt-->0) _delay_ms(1);
> }
> 
> int main(void)
> {
>   	const char topstr[16]="*---...         ";
>   	const char lowstr[16]="*---...         ";
> 	
> 	int i = 15;
> 	int j = 0;
> 	int k = 0;
> 
>   	lcd_init(LCD_DISP_ON);  //Initialize LCD with the cursor off
>   	lcd_clrscr();           //Clear the LCD screen
>   	lcd_home();
>   	
>  	for (i = 15; i >= 0; i--)
>   	{
>   		lcd_gotoxy(i,0);
> 		lcd_puts(topstr);
> 		
> 		
> 		for ( j = 0; j < k+1; j++)
> 		{
> 			lcd_gotoxy(k-j,1);
> 			lcd_putc(lowstr[j]);
> 		}
> 
> 		k++;
> 
> 		delay_ms(500);
> 		lcd_clrscr();
>   	}
> 
> //	lcd_command(_BV(LCD_CGRAM));
> //  for(int i=0; i<8; i++)
> //  {
> //  	lcd_data(pgm_read_byte_near(&userChars[i]));
> //  }
> //
>   	for (;;)
>   	{
> //  	lcd_gotoxy(0,1);
> //		lcd_putc(0);
>   			// Do nothing forever (Message already 
> displayed on LCD)
>   	}
> }
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.