A BIG PROBLEM with VK5081 Graphical LCD!

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

Hi, All!

I have a graphical LCD module and as the subjects says It is VK5081 with resolution 80x160. So I'm driving It with Mega128. I tried to use It in a character mode. So i initialized It, as the datasheet says, and I've choosed a character pitch 8x8, so 20 columns and 10 lines. And when I try to write some data to It, I can, but It seems that the internal character generator is not working properly. For example if I write symbol '0' or anything else, the character is drawn with missing or added dots in the pattern. I have tried to write only one type of symbol in all the 200 positions, and everywhere the symbol is not displayed correctly. And also from position to position It's pattern is not the same. The symbol looks like the desired but with missing or added points. The graphical controller is HD81630 from HITACHI.
I've also disabled the cursor and I It's position is at the bottom of the symbol, i.e. position=7.

So, fellows, does anybody have ever seen something like that. I really need help because that LCD was the only one from the store, because is OBSOLETED may be and if something is wrong inside in It, I'll get mad, because my PCB is already manufactured for It's mechanical and electrical connections.

Thanks to all, that will reply, in advance!

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

Firstly - how is the lcd connected? Have you made sure all the i/o timing is correct? The AVR bus timing is reasonably fast and can cause problems with slower peripherals.

Assuming this is correct, then it's time to look at the code. Sometimes it makes thing easier if you write a little program that you can enter values through the serial port - a little monitor program so you can manipulate the lcd registers manually. This can be faster than change code- burn flash - run - repeat!

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

Thanks, Kartman for you reply!
The connections are OK, and timings also. I have a lot of NOP instructions before falling or rising edge of ENABLE signal, so the problem is somewere else.
I'm sure for that because I entered the LCD in graphical mode, and also I builded my own character generator, with options to scale the character, determine position on the screen and also I made a negative of the character. And It works OK after 2 days struggle.
I didn't want to make It that way, but only to use the internal LCD character generator for my menus, but I think that using graphical mode gives me the advatages that I mentioned before.
Obviously I have NO luck with the bulded in charater generator with that sample of LCD.

Thanks for your reply!

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

I googled for vikay vk5081 and it says it has a hitachi 61830 controller. This is a fairly popular midsize lcd controller... I think the avrlib has 61830 code and also some of the avr projects here... I used on a couple years ago... the problem with porting lcd code is: which port is the data lines, which port is the control lines (if in IO mode) or what address is the display located if in memory mapped mode? What is the avr speed (to adjust all the little delays)... my app was all graphics... I drew into main ram then copied the whole ram screen buffer to the display in a tight loop. Could get 7 frames/sec like that. Had scrolling tapes. Looked OK!

Imagecraft compiler user

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

I have had a similar problem with the same controller in 160x160 LCD working in text mode. With wrong init settings the character output was wrong.
My actual init routine with settings:

void lcd_inittext(void)
{
	LCD_CTRL = LCD_RESET;  // reset lcd
	delay_us(250);
	LCD_CTRL = LCD_CMD | LCD_WR | LCD_DIS;

	lcd_out(SETLCDMODE,0x30); // init text mode
	lcd_out(SETCHPITCH,0x76);  // Number of bits per byte
	lcd_out(SETCHARNUM,0x16);  // Number of horizontal bytes
	lcd_out(SETTIMEDIVS,159);  // duty ratio 1/160
	lcd_out(SETCURSPOS,7);  // cursor in 8th char line
	lcd_out(SETHOMLADDR,0);  // VRAM start address 0
	lcd_out(SETHOMHADDR,0);
	lcd_out(SETCURLADDR,0);  // home cursor
	lcd_out(SETCURHADDR,0);
	lcd_txtcls();  // clear VRAM
}

An sample picture how it works:
Click

Btw: I think you have to change the duty cycle for your LCD size.

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

Mr MIC wrote:
I have had a similar problem with the same controller in 160x160 LCD working in text mode. With wrong init settings the character output was wrong.
My actual init routine with settings:

void lcd_inittext(void)
{
	LCD_CTRL = LCD_RESET;  // reset lcd
	delay_us(250);
	LCD_CTRL = LCD_CMD | LCD_WR | LCD_DIS;

	lcd_out(SETLCDMODE,0x30); // init text mode
	lcd_out(SETCHPITCH,0x76);  // Number of bits per byte
	lcd_out(SETCHARNUM,0x16);  // Number of horizontal bytes
	lcd_out(SETTIMEDIVS,159);  // duty ratio 1/160
	lcd_out(SETCURSPOS,7);  // cursor in 8th char line
	lcd_out(SETHOMLADDR,0);  // VRAM start address 0
	lcd_out(SETHOMHADDR,0);
	lcd_out(SETCURLADDR,0);  // home cursor
	lcd_out(SETCURHADDR,0);
	lcd_txtcls();  // clear VRAM
}

An sample picture how it works:
Click

Btw: I think you have to change the duty cycle for your LCD size.

Thanks to all!

To bobgardner:

Yes controller is Hitachi 61830 not as I said in the first post 81630, MY FAULT!
My port mapping on Mega128 and that LCD is DB0-DB7 to PORTF0-7, PA0 to E, PA1 to RW and PA2 to RS. I have also and sink driver to switch ON the LCD Backlight for 5s, after the last pushed button on my keyboard (4x5). I have disabled JTAG to use PORTF as general IO. The Mega128 Clock is 10MHz, and my timings are OK, because in graphical mode I can write to any pixel. So this mean that my INIT routine is also correct.

To Mr MIC:

My settings are similar:

MODE=$30
PITCH=$77 (8x8 including space between characters in HOR and VER direction)
CHARNUM=$14 (20 because my LCD is 80 rows and 160 columns, so 160/8=20 )
DUTYRATIO=79 (Number of ROWS-1)
CURSOR POSITION=7 (8 line from TOP of the symbol)
DISPLAY ADDRESS=0 (I write in LOW byte first)
CURSOR ADDRESS=0 (I write in LOW byte first)

I have build a subroutine that writes an instruction to LCD, which varaibles LCD_INSTRUCTION and LCD_DATA, I load before calling that subroutine, and I'm sure that It works correctly.
My INIT settings are in table and graphical mode works perfectly.

But I'm dissapointed from automatically increment of the address. If I have to SET two pixels in one byte, after first pixel I have to return the address and then set the other pixel. That "OPTION" slows my access. The Alpha Numerical LCDs have a more instructions, like clear screen and etc.....But graphical LCDs have several pages, which is option to make a scroll easyer than the other.

Ok, Thanks to ALL!