Recent changes
Textbook
Homepage
SMARTWAV
Keypad
From the mbed microcontroller Cookbook.  

Nokia LCD

An interface for controlling a 130x130 Nokia mobile phone display.

Nokia LCD

There are a number of different hardware breakouts available for these panels. See:

The LCD panels themselves also vary, particularly whether they use an Epson or Philips driver. This library aims to support both types. Fiddle with the type parameter if yours doesn't seem to work.

Hello World!

» Import this program

00001 // Hello World! for Nokia LCD, sford
00002 // - LCD6610 is for newest Sparkfun breakout
00003 
00004 #include "mbed.h"
00005 #include "NokiaLCD.h"
00006 
00007 NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
00008 
00009 int main() {
00010     lcd.background(0x0000FF);
00011     lcd.cls();
00012     lcd.fill(2, 51, 128, 10, 0x00FF00);
00013     lcd.fill(50, 1, 10, 128, 0xFF0000);
00014     lcd.locate(0,3);
00015     lcd.printf("Hello World!");
00016     for (int i=0; i<130; i++) {
00017         lcd.pixel(i, 80 + sin((float)i / 5.0)*10, 0x000000);
00018     }
00019 }

/media/uploads/simon/mobilelcdschematic1.png /media/uploads/simon/mobilelcdphoto.jpg

On other displays, you may also have to wire e.g. VBATT (the screen backlight) to 3.3v

Library

» Import this library into a program

Public Types

enum LCDType { LCD6100 , LCD6610 }

LCD panel format.

More...

Public Member Functions

NokiaLCD (PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type=LCD6100)
Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces.
int putc (int c)
Write a character to the LCD.
int printf (const char *format,...)
Write a formated string to the LCD.
void locate (int column, int row)
Locate to a screen column and row.
void cls ()
Clear the screen and locate to 0,0.
void pixel (int x, int y, int colour)
Set a pixel on te screen.
void fill (int x, int y, int width, int height, int colour)
Fill an area of the screen.
void foreground (int c)
Set the foreground colour.
void background (int c)
Set the background colour.

Other Reference




calendar Page history
Last modified 11 Jul 2011, by   user HO WING KIT   tag 6100, 6610, mobileLCD, Nokia, NokiaLCD, SPI | 13 comments      

13 comments on Nokia LCD:

05 Dec 2010

I have the new Sparkfun Nokia LCD breakout board with the 6610 instead of the 6100. I noticed a few things when I tested out the Hello World code.

1) The two leftmost columns of pixels appeared whitish and were not affected by the lcd.background() command. I modified NokiaLCD.cpp line 118 from x1=x+2 to x1=x+0 and the whitish pixels went away.

2) The sine wave seems to create some problem for the lcd.fill() command. If I display a green rectangle before the sine wave is drawn then it displays OK. But if I display a green rectangle after the sine wave is drawn then it is displayed as a red & blue striped rectangle.

3) The display appears to be 130x132 instead of 130x130. The reason I think this is because I drew a box pattern using the following code and noticed there are two rows of pixels visible below the bottom green border.

Code

    lcd.fill(0, 0, 130, 1, 0x00FF00);
    lcd.fill(129, 0, 1, 130, 0x00FF00);
    lcd.fill(0, 0, 1, 130, 0x00FF00);
    lcd.fill(0, 129, 130, 1, 0x00FF00);

These two rows appear to be a slightly darker blue than the 0x0000FF background. I tried changing the NOKIALCD_HEIGHT parameter but I was still not able to access those rows.

25 Dec 2010

lcd.pixel is not working correct with board 6610. Adding some code solved the problem

Code

void NokiaLCD::pixel(int x, int y, int colour) {
    _cs = 0;
    _window(x, y, 1, 1);
     switch (_type) {
        case LCD6100:
        case PCF8833:
           
                _putp(colour);
            
            break;
        case LCD6610:
           
                int r4 = (colour >> (16 + 4)) & 0xF;
                int g4 = (colour >> (8 + 4)) & 0xF;
                int b4 = (colour >> (0 + 4)) & 0xF;
                int d1 = (r4 << 4) | g4;
                int d2 = (b4 << 4) | r4;
                int d3 = (g4 << 4) | b4;
                data(d1); 
                data(d2);   
                data(d3);
            
            break;
            }
    _cs = 1;
}
17 Feb 2011

I can confirm that my new Sparkfun boards that just came in today appear to have the 6610 (6100 type killed it when I tried) and they needed both patches to the library code from the two previous comment posts. They fixed most of the strange issues....

But the two bottom rows still do not change - so it also looks to me like 132 vs 130.

Here is a video

I added some code to print characters and draw random rectangles after the Hello Word screen.

Couple of quick notes on the new Sparkfun modules:

Connect Vbat (the backlight to 5V*) or you will never see a display image. DIO on PCB is Sdata

  • Update: Even though they say up to 6V for the backlight on the Sparkfun site, the reg IC seems to get a bit too hot to me and it looks like 3.3V works better on the ones we have. There are some posts about overheating in the Sparkfun forums. Apparently the inductor is underrated for the current levels it is seeing.
19 Feb 2011

please help ...

I have ordered on sparkfun a Nokia Breakout board 08600 with the following pins :

s1

s2

cs - to p8

sck - to p7

gio - to p5

reset - to p9

stat2

stat1

stat0

gnd - to mbed gnd

3.3v - to 3.3 V mbed

vbatt - to 5.0v mbed

don't print nothing ..

any suggestion ?

I have loaded an compiled the Nokia Epson sample, and tried the NokiaLcd_Helloword .. without success

20 Feb 2011

That seems to be what I did. We got four last week from Sparkfun and they all seem to work fine.

Code

NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type

Might be a bad connection somewhere. Is the display dark? Did you try the other type LCD6100 yet? Sounds like older boards had this other type. Mine has a red PCB.

20 Feb 2011

Hi,

Seems my LCD board has a defect .. because nothing happens when I connect +3.3v and GND (even the VBATT) ...

Screen stay dark.

26 Feb 2011

Working with a PCF8833. Adjusted the color to use 24bit color, and shift to 565 The follow code produces correct colors on the LCD I have, but differs from the Philips datasheet for the controller (R and B interchanged) for the 565 dithered mode.

Code

void NokiaLCD::_putp(int colour) {
// USE 24Bit RGB, and shift to 565
//    [R7R6R5R4R3R2R1R0][G7G6G5G4G3G2G1G0][B7B6B5B4B3B2B1B0]
    int rg = ((colour      ) & 0xF8)  //  [B7B6B5B4B3______]
           | ((colour >> 13) & 0x07); //  [__________G7G6G5] 
    int gb = ((colour >> 19 ) & 0x1F) //  [______R7R6R5R4R3]
           | ((colour >> 5 ) & 0xE0); //  [G4G3G2__________]
    data(rg);
    data(gb);
}

The above code results in bright colors,only 6 volts on the backlight. (My last post had errors)

26 Feb 2011

It works now .. that was the LCD screen (received broken :(

But I still have 2 questions :

1) the screen is reversed .. pixel 0,0 is located on bottom right ... How to reverse ? Via the command/data I think ..

2) the backlight is working weel, but a little bit too much, or this is a problem with the contrast ? Is difficult to read "Hello World" when I'm front of the screen.

any suggestion will be appreciated.

15 Sep 2011

user Jon Kerwin wrote:

3) The display appears to be 130x132 instead of 130x130. The reason I think this is because I drew a box pattern using the following code and noticed there are two rows of pixels visible below the bottom green border.

Code

    lcd.fill(0, 0, 130, 1, 0x00FF00);
    lcd.fill(129, 0, 1, 130, 0x00FF00);
    lcd.fill(0, 0, 1, 130, 0x00FF00);
    lcd.fill(0, 129, 130, 1, 0x00FF00);

These two rows appear to be a slightly darker blue than the 0x0000FF background. I tried changing the NOKIALCD_HEIGHT parameter but I was still not able to access those rows.

To correct the last two rows you need to change the line data(31); to data(32); in the reset function.

06 Oct 2011

If you have the recent Sparkfun Nokia LCD breakout boards, you still need the patches from the first two comments and the one in the previous comment.

13 Oct 2011

Students have a BMP and JPG converter running on mbed for the Nokia LCD

http://mbed.org/users/XkLi/notebook/digital-photo-frame/

/media/uploads/4180_1/_scaled_nokia_bmp.png

01 Dec 2011

user Didier Solheid wrote:

It works now .. that was the LCD screen (received broken :(

But I still have 2 questions :

1) the screen is reversed .. pixel 0,0 is located on bottom right ... How to reverse ? Via the command/data I think ..

2) the backlight is working weel, but a little bit too much, or this is a problem with the contrast ? Is difficult to read "Hello World" when I'm front of the screen.

any suggestion will be appreciated.

I had a similar problem. I noticed the ribbon cable that connects the LCD to the board was broken. I ended up replacing having to replace it. Fortunately, SparkFun sells the LCD separately.

Buyer beware: This device is pretty fragile.

6 days, 4 hours ago

http://www.sparkfun.com/products/11062 is the new Sparkfun version of the Nokia LCD breakout board that just came out today. It looks like they fixed the super hot burns your finger inductor issue and it has an improved power circuit for the backlight. Notice the larger inductor on the new breakout.

/media/uploads/4180_1/_scaled_nokialcd.jpg
New Sparkfun Nokia LCD Breakout Board.

Please login to post comments.