PCD8544 /Nokia 3310 background noise

Background stripes (noise) on my NUElectronics Nokia 3310 LCD screen!

When I use the library from NUelectronic everything works fine.

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=12

When I use the library from ADAfruit (Limor Fried) everything works but I get background noise (random horizontal stripes). https://github.com/adafruit/PCD8544-Nokia-5110-LCD-library

I want to use this library becuase it has some functions and a font I want to use.

Can I adjust something? (Timing or ...)

Regards,

Derk

What about http://code.google.com/p/u8glib/?

Oliver

Thanks. Library works perfect.

No noise, pinsettings defineable, contrast adjustable!

Nice features and the fonts I needed!

Regards,

Derk

I want to use the library with the shield from NUelectronics. When I use the menu I need to invert the chosen menu. Is this possible with the U8glib ? The command i'm searching for is something like "highlight".

Regards,

Derk

Code mostly taken from the third tutorial. Idea is to draw a black box and put a white text on it (the drawStr procedure uses the current ColorIndex)

u8g.setFontRefHeightExtendedText();
u8g.setFontPosTop();
...
h = u8g.getFontAscent(u8g)-u8g.getFontDescent(u8g);
w = u8g.getStrWidth(u8g, "(AgI)");
u8g.setColorIndex(1);
u8g.drawBox(u8g, 3-1, 10, w+2, h+2) ;
u8g.setColorIndex(0);
u8g.drawStr(u8g, 3, 10, "(AgI)");

It probably makes sense to put the last part into a procedure:

void draw_boxed_string(u8g_uint_t x, u8g_uint_t y, const char *s)
{
  // precondition: setFontRefHeightExtendedText(), setFontPosTop
  u8g_uint_t h, w; 
  h = u8g.getFontAscent(u8g)-u8g.getFontDescent(u8g);   // get height of the string
  w = u8g.getStrWidth(u8g, s);  // width of the string
  u8g.setColorIndex(1);  // black pixel
  u8g.drawBox(u8g, x-1, y, w+2, h+2) ;  / draw a black box, larger than the string
  u8g.setColorIndex(0);  // use white pixel
  u8g.drawStr(u8g, x, y, "(AgI)");   // draw white pixel on the black box
  u8g.setColorIndex(1);  // restore black pixel
}

Oliver

Thank you,

This solution works. Thank you very much. I appreciate the many different font choises. The upside down function and the universal principle for a lot of different LCD type's.

In the other library's I only have a "reverse" command. Do you think this is gonna be an option for the future in your library?

Regards,

Derk van der Wal

What is a "reverse" command? What should it do?

Oliver

I mean “inverted”, not reverse.
Something like: Menu_normal vs menu_highlight

 case UP_KEY:
          // current item to normal display
          lcd.LCD_3310_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
          current_menu_item -=1;
          if(current_menu_item <0)  current_menu_item = NUM_MENU_ITEM -1;
          // next item to highlight display
          lcd.LCD_3310_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
          break;
        case DOWN_KEY:
          // current item to normal display
          lcd.LCD_3310_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_NORMAL );
          current_menu_item +=1;
          if(current_menu_item >(NUM_MENU_ITEM-1))  current_menu_item = 0;
          // next item to highlight display
          lcd.LCD_3310_write_string(MENU_X, MENU_Y + current_menu_item, menu_items[current_menu_item], MENU_HIGHLIGHT );
          break;

I think the previously mentioned procedure

draw_boxed_string(u8g_uint_t x, u8g_uint_t y, const char *s)

could be extended like this:

my_string_draw(u8g_uint_t x, u8g_uint_t y, const char *s, is_inverted)
{
  if ( is_inverted )
   draw_boxed_string(x,y,s);
  else
   u8g.drawStr(u8g, x, y, s);
}

It is a little bit difficult to make a general procedure out of this, which can be added to the library. There are two points: First, the concept of the u8glib is to draw with one current color. Indeed, when using u8g.drawStr on a pattern, the pattern "shines" trough the glyphs. To be flexible for all displays I would need a background and a foreground color, which are not available at the moment.

The second problem is to define the height of the background. Is it ascent + descent? or is it the line spaceing? Or should u8g examine the hight of the provided string.

I think it is easy to implement your own definition, but difficult to find a generic procedure for that.

Oliver

Thank you, I understand and agree.

Regards,

Derk