128x64 GLCD (KS0108) Text Orientation

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

Hello everyone,

 

I am using Fabian Maximilian Thiele library and my GLCD is working very well. However I am having hard time to display text in portrait mode. Is there a way to display portrait text? Any input is highly appreciated.

 

Thanks,

Niral

Last Edited: Tue. Nov 7, 2017 - 05:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess this is probably obvious but I'll say it anyway. In this code:

 

        // last but not least, draw the character
	for(uint8_t i=0; i<bytes; i++) {
		uint8_t page = i*width;
		for(uint8_t j=0; j<width; j++) {
			uint8_t data = ks0108FontRead(ks0108Font+index+page+j);
			
			if(height < (i+1)*8) {
				data >>= (i+1)*8-height;
			}
			
			if(ks0108FontColor == BLACK) {
				ks0108WriteData(data);
			} else {
				ks0108WriteData(~data);
			}
		}
		// 1px gap between chars
		if(ks0108FontColor == BLACK) {
			ks0108WriteData(0x00);
		} else {
			ks0108WriteData(0xFF);
		}
		ks0108GotoXY(x, ks0108Coord.y+8);
	}

You need to switch the X and Y directions.

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

Hello,

 

Till now I have used it in landscape mode. But now I have to use portrait mode. I have try to switch X and Y position but text is not rotating.

 

Thank you,

nIk

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

Show what you changed.
.
At the end of the day a character is just a rectangle of dots. To drawy it you go up/down the Y and across the X. So to rotate you should use the same data but now draw by going across the X then up/down the Y within that instead.

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

BTW In the above code both the data and the screen are being indexed by the same i/j. You will have to break that link obviously.

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

Hello,

 

I have changed position of X and Y but it places new character slightly lower than previous char for all. I want to rotate text.

 

// last but not least, draw the character
	for(uint8_t i=0; i<bytes; i++) {
		uint8_t page = i*width;
		for(uint8_t j=0; j<width; j++) {
			uint8_t data = ks0108FontRead(ks0108Font+index+page+j);
			
			if(height < (i+1)*8) {
				data >>= (i+1)*8-height;
			}
			
			if(ks0108FontColor == BLACK) {
				ks0108WriteData(data);
				} else {
				ks0108WriteData(~data);
			}
		}
		// 1px gap between chars
		if(ks0108FontColor == BLACK) {
			ks0108WriteData(0x00);
			} else {
			ks0108WriteData(0xFF);
		}
		ks0108GotoXY(y, ks0108Coord.x+8);
	}
	ks0108GotoXY(y+width+1, x);
	
	return 0;

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

So perhaps an index is off by one?

 

JC

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

note that you can also most likely rotate the display, it has an inverse X and inverse Y bit in a register by swapping these you can write test in any direction you want ans this will give the orientation of the display.

It has been a long time since I played with a 108 display and do not have the code at work, but it should be very obvious from the datasheet.

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

Hello everyone,

 

I have switched to universal library for KS0108 and created customized fonts and that works..

 

Regards,

nIk

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

For the benefit of future readers:

 

Initially, MeNik wrote:
 Fabian Maximilian Thiele library 

Would you care to give a link for that?

 

Finally, MeNik wrote:
I have switched to universal library for KS0108

And would you care to give a link for that?

 

and that works..

Excellent. Now please mark the thread as solved: https://www.avrfreaks.net/comment...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFAIK Thiele's web site (http://www.apetech.de) is no more. His LCD library is floating around as copies here and there on the Web. E.g.: http://www.codeforge.com/article...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
AFAIK Thiele's web site (http://www.apetech.de) is no more. His LCD library is floating around as copies

Indeed.

 

Which is why it would be particularly helpful for the OP to say specifically which copy (s)he used

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

KS0108 Library I used : http://en.radzio.dxp.pl/ks0108/

 

For Creation of 8x8 font : https://www.riyas.org/2013/12/on...

 

also you have to replace code of 'GLCD_WriteChar(char charToWrite)' with following..

 

    int i;
	charToWrite -= 32;
	for(i = 0; i<8; i++)
	GLCD_WriteData(GLCD_ReadByteFromROMMemory((char *)((int)font8x8 + (8 * charToWrite) + i)));
	GLCD_WriteData(0x00);

 

Regards,

nIk

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

Thanks - and mark the solution ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFAIK Thiele's web site (http://www.apetech.de) is no more. His LCD library is floating around as copies here and there on the Web. E.g.: http://www.codeforge.com/article...

"We're goin' way back, WAY back.  'Cuz that's where the fun is... WAY BACK!"

https://web.archive.org/web/20070202061106/http://www.apetech.de:80/

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

On that page:

Jippi, die neue Seite ist fertig! 

So, should we now say 

 

Verdamt, die alte Seite ist kaput! 

 

?

 

:-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]