I want to make a rotation on 5110 lcd.But ada's library don't work

I have made a portable fm device.But when I burnt the test program to avr.I found the direction of text showed by lcd is wrong.I used setRotation function,but it didn't work.
like this

xxxxxxxxx

?I can't type in wrong direction?
But i want my lcd show like this

hello,world


Seems no library can do this.Anybody can help me about this?

Halry:
Seems no library can do this.

U8glib can do this: Google Code Archive - Long-term storage for Google Code Project Hosting., see commands here: Google Code Archive - Long-term storage for Google Code Project Hosting.

Oliver

Thanks for your replying.But I saw the wiki.Use setRot180 just x,y is change,not the text direction.Have you tested this function.

The picture might be misleading. U8glib will rotate everything including any text, lines, bitmaps, etc. Infact it has been one of the design goals of u8glib to provide easy 180 degree rotation.

Oliver

I have tested it.It works.Thank you so much.But when I try to write code.I got error.Even I use u8g’s example code.

//==========================
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
//============================
#include "U8glib.h"
//================================
#include <Wire.h>
#include <SPI.h>
//==============================
#define LED A3
#define ScreenLED 9
#define RFCSN A1
#define RFCE A0
#define BluetoothSW 2
#define ScreenCLK 8
#define ScreenDIN 7
#define ScreenDC 4
#define ScreenCE 6
#define ScreenRST 5
#define DHT 10
#define LightSensorRight A2
#define InteruptPin 3
//======================
U8GLIB_PCD8544 u8g(8, 7, 6, 4, 5);
RF24 radio(RFCE,RFCSN);
//=======================
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
  
  // flip screen, if required
  u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}

void loop(void) {
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(500);
}
//

then it show
libraries\U8glib/utility/u8g.h:105: error: section attribute not allowed for 'u8g_pgm_uint8_t

Can you be more specific regarding "it works" and "I got error"?
Under which conditons does it work? Under which conditions do you get the error?
And: What is your environment (Arduino IDE)? What is your target system (Hardware board)?

Oliver

If I compile your example with uncomment "U8GLIB_PCD8544" line.It works fine.But If I compile your example with adding "#define screenclk 8" and some library.It showed error

environment:arduino 1.0.5
target:Arduino Uno

olikraus:
Oliver

Finally,I solved the problem because I put rf24 library before u8glib.
But I found your library use too much program memory.How can I reduce the memory usage.I saw compilation detail.It compile other screen's c files.

Thanks for the solution. I'm also kinda stick with that before!

Halry:
Finally,I solved the problem because I put rf24 library before u8glib.
But I found your library use too much program memory.How can I reduce the memory usage.I saw compilation detail.It compile other screen's c files.

U8glib contains a lot of files, but only code which is really used goes to PROGMEM area. In general, i would say that it should be comparable with the adafruit library.

Second answer is: There is a huge impact of the fonts that you use.
Have a look here:
http://code.google.com/p/u8glib/wiki/fontgroupx11#5x7
Compare u8g_font_5x7 and u8g_font_5x7r. u8g_font_5x7 will use 1624 bytes (as you can see on the web page) but it will contain some none ANSI chars like german umlaut äÄ öÖ üÜ. If you do not need such chars, you can use u8g_font_5x7r which only requires 789 bytes. You can optimize your code size by selecting a suitable font.

Oliver

Edit: Spelling

Thank you.lol.That is useful.
And can you tell me how to set pcd8544 to powerdown mode.And make the screen clear.I can't find any reference about powerdown in the library.I am making portable device and need it very much.

If the device supports a power down mode, the it can be implemented.
I have created an issue for this: Google Code Archive - Long-term storage for Google Code Project Hosting.

The screen is cleared as soon as you start a new "picture" loop. U8glib is a little bit different to other graphics libs. You must always build the complete screen, so "clear screen" is not required. By doing so, U8glib does not require so much RAM.

Oliver

I have added a sleep mode sequence for your display (see attachment), this means you can use the commands sleepOn and sleepOff.

Oliver

u8glib_arduino_v1.15pre2.zip (1.03 MB)

You are so good.Thank you.I think there is no problem right now.Thank you so much