The 5110 LCD is a graphical 84x48 pixels monochrome display.
It features a modest Backlight illumination, that can be blue or white. It only needs 3V to run, and it is 5V signal tolerant (not the backlight, so be careful, the leds need 3V max!) Its cost is also low, making it an excellent choice for DIY projects.
nokia_5110_lcd_atmega_1 nokia_5110_lcd_atmega_2

To connect it to an Atmega8, you can use the following diagram:
atmega8_nokia5110

The code, written as a C++ class, allows you to output text or draw pixels, position anywhere on the screen, or even draw images. The initialization function is highly flexible, allowing you to specify the pins allocated for the LCD, on the fly:

  1.  
  2. // define the 5 LCD Data pins: SCE, RST, DC, DATA, CLK
  3. lcd.lcd_init(&PORTB, PB0, &PORTB, PB1, &PORTB, PB2, &PORTB, PB3, &PORTB, PB4);
  4.  
  5. while (1) {
  6. // image demo
  7. lcd.printPictureOnLCD(introScreen);
  8. _delay_ms(2000);
  9. lcd.lcd_clear();
  10.  
  11. // goto and char demo
  12. for (int i=0;i<14;i++)
  13. for (int j=0;j<6;j++) {
  14. lcd.lcd_goto_xy(i,j);
  15. lcd.lcd_chr('0' + (i + j) % 10);
  16. _delay_ms(10);
  17. }
  18. _delay_ms(2000);
  19. lcd.lcd_clear();
  20.  
  21. // formatted string demo
  22. for (int i=10;i>0;i--) {
  23. lcd.lcd_goto_xy(0,1);
  24. lcd.lcd_string_format(" 00.00.%02d \n pocketmagic \n .net ", i);
  25. _delay_ms(200);
  26. }
  27. _delay_ms(2000);
  28. lcd.lcd_clear();
  29.  
  30. // draw a chart
  31. for (int i=0;i<84;i++) {
  32. int f = (i * i) % 48;
  33. lcd.drawPixel(i,0, 1);
  34. lcd.drawPixel(i, f, 1);
  35. }
  36. _delay_ms(2000);
  37. lcd.lcd_clear();
  38. }
  39.  

Here is the result of the code above:

A few pictures:
nokia_5110_lcd_atmega_3 nokia_5110_lcd_atmega_4 nokia_5110_lcd_atmega_5

The image data with the two cats, available in introscreen.h, has been generated out of a monochrome, 84x48 pixels BMP, using the LCDAssistant software, by Radoslaw Kwiecien.
assistant

The code is available as open source, licensed under GPL v2:
lcd_5110

Related Post