View previous topic :: View next topic |
Author |
Message |
Acktung
Joined: 05 Jun 2005 Posts: 10
|
LCD truble!!! is not possible but ... |
Posted: Mon Jun 13, 2005 5:19 pm |
|
|
I have a problem whit a 4x20 LCD Display whit ks0073 controller ...
my init string is: {0x20 | (lcd_type << 2), 0xc,1,6}
my memory map is
line1 0x80
line2 0xc0
line3 0x94
line4 0xd4
ok ... so I write 12 characters for any line and this is my lcd:
____________________
|111111111111________|
|________333333333333|
|222222222222________|
|________444444444444|
(this "_" a blank digit!!)
if i write 20 character my display is :
____________________
|11111111111111111111|
|11111111333333333333|
|22222222222222222222|
|22222222444444444444|
but i have think to write this:
____________________
|11111111111111111111|
|22222222222222222222|
|33333333333333333333|
|44444444444444444444|
i use lcd420.c library ... and for write i use the lcd_putc("1111111111111111111\n"); command ....
the memory over my lcd is bad?
what is wrong?
help me please ... tanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 14, 2005 12:21 am |
|
|
If you look at the data sheet for the KS0073, on page 14, it shows
the line addresses for a 4x20 display should be 0, 0x20, 0x40, 0x60.
http://www.microtipsusa.com/driver_pdfs/samsung/KS0073.PDF
Edit the lcd_gotoxy() routine in the CCS driver, to use those values
(of course, also set the top bit = 1). See if that fixes the problem.
The changes are shown below in bold:
Quote: | void lcd_gotoxy( BYTE x, BYTE y)
{
BYTE address;
switch(y) {
case 1 : address=0x80;break;
case 2 : address=0xA0;break;
case 3 : address=0xC0;break;
case 4 : address=0xE0;break;
}
address+=x-1;
lcd_send_byte(0,address);
} |
|
|
|
Acktung
Joined: 05 Jun 2005 Posts: 10
|
|
Posted: Tue Jun 14, 2005 5:35 am |
|
|
whit your adress the lcd is like this:
____________________
|44444444444411111111|
|11111111____________|
|33333333333333333333|
|33333333____________|
?
there are someone that have idea? |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Tue Jun 14, 2005 10:24 am |
|
|
Try this:
line1 = 0
line2 = 0
line3 = 20
line4 = 20
To set the cursor at position x of line 1:
address = line1 + x - 1
lcd_send_byte(0, 0x80 | address)
To set the cursor at position x of line 2:
address = line2 + x - 1
lcd_send_byte(0, 0xC0 | address)
To set the cursor at position x of line 3:
address = line3 + x - 1
lcd_send_byte(0, 0x80 | address)
To set the cursor at position x of line 4:
address = line4 + x - 1
lcd_send_byte(0, 0xC0 | address) |
|
|
Acktung
Joined: 05 Jun 2005 Posts: 10
|
tanks newguy!!! |
Posted: Fri Jun 17, 2005 12:32 pm |
|
|
OK i have resolved ... ... whith the datasheet i have resolved ...
I hope that this can help others that use EA DIP204-4NLED ELECTRONIC ASSEMBLY display as me.
So for solve the problem the libray lcd420.c is good but the INIT_STRING is a little different ... whit this work good!!!!
BYTE const LCD_INIT_STRING[7] = {0x20,0x24,0x9,0x28,0xf,0x1,0x6};
by by |
|
|
Acktung
Joined: 05 Jun 2005 Posts: 10
|
... |
Posted: Fri Jun 17, 2005 12:34 pm |
|
|
and it is clear ... the init function become:
void lcd_init() {
BYTE i;
set_tris_b(LCD_WRITE);
lcd.rs = 0;
lcd.rw = 0;
lcd.enable = 0;
delay_ms(15);
for(i=1;i<=3;++i) {
lcd_send_nibble(3);
delay_ms(5);
}
lcd_send_nibble(2);
for(i=0;i<=6;++i)
{
lcd_send_byte(0, LCD_INIT_STRING[i]);
}
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 17, 2005 12:54 pm |
|
|
There were two different sets of line addresses that were
proposed for use with a 4x20 LCD.
Which line addresses were correct for your LCD ? |
|
|
Acktung
Joined: 05 Jun 2005 Posts: 10
|
|
Posted: Fri Jun 17, 2005 4:03 pm |
|
|
the adress is standard ....
case 1 : address=0x80;break;
case 2 : address=0xA0;break;
case 3 : address=0xC0;break;
case 4 : address=0xE0;break;
in any case this controller is 100% compatible con hitachi but the library lcd420.c don't init correctly this controller ... |
|
|
|