Pages: [1]   Go Down
Author Topic: Rotate and reverse characters in LCD display  (Read 1070 times)
0 Members and 1 Guest are viewing this topic.
New Jersey
Offline Offline
God Member
Karma: 2
Posts: 535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a 128x64 LCD display and I want to rotate the text so the display can be read from the other side.  Basically the character would have to be inverted, then displayed right to left.  See attached images.

I'm using this library:

The function that displays character is below.  Can someone tell me what changes to the code I can make to get the text to flip?

void ST7565::drawchar(uint8_t x, uint8_t line, char c) {
  for (uint8_t i =0; i<5; i++ ) {
    st7565_buffer[x + (line*128) ] = pgm_read_byte(font+(c*5)+i);
  updateBoundingBox(x, line*8, x+5, line*8 + 8);

* LCD Text 2.jpg (17.78 KB, 317x182 - viewed 35 times.)

* LCD Text 1.jpg (18.33 KB, 317x182 - viewed 31 times.)

Offline Offline
Edison Member
Karma: 38
Posts: 1012
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure if it's that easy, but maybe like this:

change everywhere you see "x", to "(128 - x)"
and everywhere you see "line", to "(8 - line)"

It's probably not only this, but it's a start smiley

It should reverse lines and character positions, but not the character itself, you have to try things to get the desired result smiley
« Last Edit: January 24, 2013, 09:39:22 pm by guix » Logged

Sydney, Australia
Offline Offline
Edison Member
Karma: 33
Posts: 1283
Big things come in large packages
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


This tells you that the character definitions are stored in an array called font.

You need to look at what the bit patterns in there are and then create the new bit pattern (reversed and upside down) either on the fly when you need to display or as a new font table.

The normal LCD libraries allow you to have text going right to left instead of the normal left to right. Combine the two and you should have what you need.

An alternative is to just mount the LCD display upside down :-)
« Last Edit: January 24, 2013, 11:30:55 pm by marco_c » Logged

Arduino libraries
Parola hardware & library

Pages: [1]   Go Up
Jump to: