Nokia 6100 LCD and pic 2520

Have you got the greatest 48 bit multiplier ever conceived? Prove it - post your code here.

Moderator: phalanx

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Nokia 6100 LCD and pic 2520

Post by Pyrofer » Fri Aug 04, 2006 6:59 am

I stole somebody elses 'good' C code for this lcd, compiled it onto my pic and powered it all up however I just get a blank screen, no different to powering up without the PIC connected.
My code is almost identicle to the working code show in other 6100 topics, I think they all got cut'n'pasted from the same place. I dont see why it isnt working.

Oh, as its software SPI I changed it to use the port B pins as id already used all the port A and C ones for other things, would this be a problem?

Before I get a replacement LCD and test the actual screen itself, can anyone give hints on problems they had with getting this working that I could look into?
www.pyrofersprojects.com

orphean
Posts: 8
Joined: Fri Jul 14, 2006 6:49 pm

Post by orphean » Fri Aug 04, 2006 8:05 pm

In my experience often times the screen won't work unless you initililize it repeatedly.

From the code I'm working on I use:

Code: Select all

void lcd_init_full(char color)
{
	int i;
   
	for(i = 0; i < 50; i++)
	{
		output_high(LCD_RESET); 
		output_low(LCD_RESET); 
		output_high(LCD_RESET);
	}
   
	for(i = 0; i < 10; i++)
		lcd_init(0);
	
	#ifdef LCD_USE_FILL
		fill(0,0,132,132, color);
	#endif
	
	lcd_write(0, DISON);
	delay_ms(300);
	lcd_write(0,LCD_NOP);
}
The repititions aren't tuned at all so its quite possible it requires far less than 50 reset toggles and 10 full inits ;) I don't turn the display on during the init process but after it, and after I fill the ram with some color so the random pixel trash isn't visible.

If that doesn't work I'd verify your pins from the MCU to the display are correct.

Orpheann

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Sat Aug 05, 2006 10:24 am

Thanks, ive already stolen that bit of code from you :P

Looking through forums it may be the fact i have a 5v pic with level convertion to 3.3v using resistors.

Im building a new board using entirely 3.3v so ill test it on that soon.
Ive also fixed the LCD and sparkfun carrier board directly to my board with header pins instead of a cable, just to eliminate interference on the cable as an issue.

When ive finished the new board and tested it does what I expect ill see if I can get the LCD into life.

Look at www.pyrofersprojects.com/3dcube.php to see what Ive done with an old LCD (not as good as this one). When the new LCD works ill get better faster graphics.
www.pyrofersprojects.com

Kuroi Kenjin
Support Volunteer
Posts: 523
Joined: Mon Jan 30, 2006 4:19 pm
Location: Cleveland area (Ohio)
Contact:

Post by Kuroi Kenjin » Sat Aug 05, 2006 12:22 pm

That's really freaking cool!
[url=http://kuroikenjin.boldlygoingnowhere.org/]my website[/url] (Last Updated 5/25/2008 - Bug: noticed that images may not load on first hits)

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Mon Aug 07, 2006 1:33 pm

It seems it was either the long cable I had, or the 5v-3.3v convertion as now with the new board running 3.3v and the lcd directly on the board with no cable, it works perfectly.
Im optimising the startup routine now to remove the repitition but still get a good clean start.

Transfering my graphics routines to the new LCD.

A quick note, does anybody POWER DOWN this lcd?

I had another phone screen and was told you have to do the power down sequence or the screen will die. Users confirmed this and it seems that on at least that LCD failure to shutdown properly will eventualy kill the LCD.

Ill be adding shutdown code to my routine at least, just in case.
www.pyrofersprojects.com

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Tue Aug 08, 2006 2:22 pm

According to the Datasheet, removing Power without shutting down the LCD will cause damage.

I put in this routine to shutdown the screen,

write_lcd(0,DISOFF);
write_lcd(0,PWRCTR);
write_lcd(1,00);
write_lcd(0,NOP);
write_lcd(0,OSCOFF);
write_lcd(0,SLPIN);

Also, There is enough ram to do some sort of double buffer..
Set scroll to top of ram, draw image on bottom of ram, then change scroll to bottom.
Clear and redraw top, and move scroll back to top.

This would allow flicker free drawing of complex shapes. Has anybody worked out the scroll set commands yet?

Finally, is there a fast way to clear a large amount of ram? I wanted a simple clearscreen, but all I could find was filling the ram with one colour pixel by pixel routines.
Even on a 20mghz PIC this takes too long, and is a visible redraw of the screen. It may be acceptable with the double buffering but not at all without it.
www.pyrofersprojects.com

orphean
Posts: 8
Joined: Fri Jul 14, 2006 6:49 pm

Post by orphean » Sun Aug 13, 2006 2:32 am

Thanks for the info on the shutdown information.

I've looked at the scroll information in the data sheet but as of yet have not been able to really play with it.

I searched and searched through the datasheet for a memcopy routine built into the hardware but I didn't find anything.

The only way I've been able to get reasonably fast animation is using a solid background and writing over the previous position of my 'sprite' with that solid color.

Keep us in the loop on your projects! :)

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Mon Aug 14, 2006 1:32 am

There is not enough ram to do full double buffered screens :(

You can get 4 pixel block scrolling, but thats it. Not so usefull unless you are writing a scrolling shoot-em up type thing, and even then its blocky scrolling.

In regards to the solid background I had an idea.

Mine is a scaled bg, with light at the top and dark at the bottom. The Y value is used to get the brightness of the background colour. When you overwrite an area to 'erase' it, you just use the same fill command that blanked the whole screen, but give it a smaller area to draw.

I modified a write pixel command to allow erasure of individual pixels with the correct background colour. It looks well cool.

Ill get some pictures up soon.

I also thought of using a fifo buffer to redraw. The actual screen can update damn fast, so you could in theory load the drawing commands into a fifo, and then have that dump them into the SPI bus at a much higher rate.
You could even have a hardware Clearscreen generator with a fixed set of commands, as its only like 4 commands then 18000 repeats of one command, this could easily be done by having the pic send the first commands then triggering an external high speed circuit that generates the SPI data for 'blank pixel' really fast 18000 times.
www.pyrofersprojects.com

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Tue Aug 15, 2006 2:00 am

Ive optimised the pixel write command quite a bit.
I hope nobody is still using the code that I see posted everywhere full of IF statements, you can remove them totally.
Replace

Code: Select all

IF ( data & 128 ) 
output_high(LCDDATA);
   else
output_low(LCDDATA);
with this,

Code: Select all

output_bit(LCDDATA&128);     // this works!
Its much nicer code, quicker and shorter. You could probably make a struct with bits defined and store the data in that, so you could do,

Code: Select all

output_bit(LCDDATA.8);
for bit 8. I havent done this yet, but it should work a tiny bit quicker than having the & as shown in my working example.

Also, at the start where its

Code: Select all

 if (!LCDmode) 
      output_low(LCD_DATA); //when entering commands: SI=LOW at rising edge of 1st SCL 
   else 
      output_high(LCD_DATA); //send data
You can remove that by putting this instead

Code: Select all

output_bit(LCD_DATA,LCDmode);
The final code looks like this,

Code: Select all

void lcd_write(char LCDmode, unsigned int data)//mode ==0 send a command, mode==1 sends data 
{  
   output_bit(LCD_DATA,LCDmode); //when entering commands: SI=LOW at rising edge of 1st SCL 
   output_low(LCD_CLOCK); 
   output_high(LCD_CLOCK); 
   
   //send data, 8th bit first 
   output_bit(LCD_DATA&128); 
   output_low(LCD_CLOCK); 
   output_high(LCD_CLOCK); 
These optimisations dont look like much, but when you do a clearscreen of 18000 pixels, each one with 9 if statements in them, it slows down quite a bit.
www.pyrofersprojects.com

Pyrofer
Posts: 115
Joined: Fri Aug 04, 2006 6:00 am
Location: London, UK
Contact:

Post by Pyrofer » Sun Aug 20, 2006 10:02 am

Thought people would like to see what ive done with this screen.

www.pyrofersprojects.com/3dcube.php

Full solid object 3D.

Ive pretty much reached the limits of this display with the SPI bus on a PIC.
I need to get the drawing data into the LCD quicker than the PIC can output it, so the draw speed will never get better.

I am hoping to swap to the OLED display that has parallel input as well as a working clearscreen command :)
www.pyrofersprojects.com

Jello
Posts: 3
Joined: Thu Apr 05, 2007 4:40 pm

Font code

Post by Jello » Thu Apr 05, 2007 4:47 pm

Hi everyone,
Boy! no one posted in here a loooong time!
Anyone got any good font code for the nokia 6100 lcd (philips controller)?
thx

blibot
Posts: 11
Joined: Mon Aug 06, 2007 3:17 am

Post by blibot » Thu Aug 09, 2007 9:09 am

HI,

Any font code for NOKIA LCD EPSON?.

Thank you

reklipz
Support Volunteer
Posts: 728
Joined: Sat Jun 24, 2006 7:52 pm

Post by reklipz » Tue Mar 04, 2008 9:57 pm

Pyrofer, I'm trying to get this LCD to work with a 2550.

I've tried using the hardware SPI with the first bit bit banged, and this did not work for me, although others have had success with it.

I then tried to use software SPI, and my routines are as follows:

Code: Select all

void LCD_SendData( unsigned char data )
{
   int i;
   LATAbits.LATA2 = LCD_SPI_CLK = 0;
   LATAbits.LATA0 = LCD_SPI_SDO = 1;
   LATAbits.LATA1 = LCD_CS = 0;
   Delay10TCYx( 50 );
   LATAbits.LATA2 = LCD_SPI_CLK = 1;
   for( i = 7; i >= 0; i-- )
   {
      Delay10TCYx( 50 );
      LATAbits.LATA2 = LCD_SPI_CLK = 0;
      LATAbits.LATA0 = LCD_SPI_SDO = data >> i;
      Delay10TCYx( 50 );
      LATAbits.LATA2 = LCD_SPI_CLK = 1;
   }      
   LATAbits.LATA1 = LCD_CS = 1;
}

void LCD_SendCommand( unsigned char command )
{
   int i;
   LATAbits.LATA2 = LCD_SPI_CLK = 0;
   LATAbits.LATA0 = LCD_SPI_SDO = 0;
   LATAbits.LATA1 = LCD_CS = 0;
   Delay10TCYx( 50 );
   LATAbits.LATA2 = LCD_SPI_CLK = 1;
   for( i = 7; i >= 0; i-- )
   {
      Delay10TCYx( 50 );
      LATAbits.LATA2 = LCD_SPI_CLK = 0;
      LATAbits.LATA0 = LCD_SPI_SDO = command >> i;
      Delay10TCYx( 50 );
      LATAbits.LATA2 = LCD_SPI_CLK = 1;
   }      
   LATAbits.LATA1 = LCD_CS = 1;
}
The LATAbit setting business is for testing purposes, as are the delays. This should not be an issue, and if anything should make the interface more reliable (as it's slower).

Since I can't get the LCD to work, I'm running the PIC at 500KHz TCY (2MHz FOSC).

I've got the proper voltages, and can confirm that the signals are reaching the board properly (they are traversing a 1 foot ribbon cable).

The only response I see from the LCD is it turning a navy bluish when I apply the backlight (it's always on, before communication begins). Setting the reset line low and high causes no visual response from the LCD, nor does sending it what I believe to be the proper start sequence (or shutdown for that matter).

Do you still have your working code that I can try?

Thanks much!

-Nate

---- edit ----
Here's the sequence I send it at startup (delays are much longer that 100ms, but PIC will be clocked higher in the end):

Code: Select all

   LCD_RESET = 0;
   Delay1KTCYx( 120 ); // 100ms
   LCD_RESET = 1;
   Delay1KTCYx( 120 ); // 100ms

   LCD_SendCommand( DISCTL );
   LCD_SendData( 0x00 );
   LCD_SendData( 0x20 );
   LCD_SendData( 0x00 );
   
   LCD_SendCommand( COMSCN );
   LCD_SendData( 0x01 );
   LCD_SendCommand( OSCON );
   LCD_SendCommand( SLPOUT );
   LCD_SendCommand( VOLCTR );
   LCD_SendData( 28 );
   LCD_SendData( 0x03 );
   LCD_SendCommand( PWRCTR );
   LCD_SendData( 0x0F );
   LCD_SendCommand( DISINV );
   LCD_SendCommand( PTLOUT );
   LCD_SendCommand( DATCTL );
   LCD_SendData( 0x00 );
   LCD_SendData( 0x00 );
   LCD_SendData( 0x02 );
   LCD_SendCommand( NOP );
   Delay10KTCYx( 120 );
   LCD_SendData( DISON ); <<--------- :)!!!!!!!!!!!
    
   LCD_SendCommand( PASET );
   LCD_SendData( 50 );
   LCD_SendData( 100 );
   LCD_SendCommand( CASET );
   LCD_SendData( 50 );
   LCD_SendData( 100 );
   
   LCD_SendCommand( RAMWR );

   // loop on total number of pixels / 2
   for (i = 0; i < 1300; i++)
   {
      // use the color value to output three data bytes covering two pixels
      // write random crap for now...
      LCD_SendData(0xFF);
      LCD_SendData(0x80);
      LCD_SendData(0x80);
   }
edit again!!

After reviewing my post, I noticed this line: LCD_SendData( DISON );

Changed it to LCD_SendCommand( DISON ); and VIOLA! It works!

I'm so happy!

Dmitri
Posts: 31
Joined: Thu Oct 29, 2009 1:39 am

Re: Nokia 6100 LCD and pic 2520

Post by Dmitri » Sat Sep 11, 2010 12:13 pm

YT video's gone
Attachments
demo.jpg

michaelgmaloy
Posts: 4
Joined: Fri May 06, 2011 8:17 am

Re: Nokia 6100 LCD and pic 2520

Post by michaelgmaloy » Fri May 06, 2011 8:19 am

Dmitri wrote:YT video's gone
what do you mean?
Last edited by michaelgmaloy on Sun May 15, 2011 11:26 am, edited 1 time in total.

Post Reply