Jump to content
Sign in to follow this  
nyordanov

Testing a Nokia pcd8544-based LCD

Recommended Posts

Hi, I've got an old Nokia phone that I don't need any more and I've salvaged its LCD. The problem is that I haven't been able to find any reasonable way to deal with the LCD's pins, so I've decided to take the original header off and use the metal parts of a female break-away header as connectors. The glass is as wide as a male connector, so they fit well, but I fear that some pins may not contact the lcd that well. I've checked the connections to the LCD and they are ok, but I don't know whether I can check if my home-made connector contacts the strips over the glass. The LCD itself was working connected to the phone.

 

For a while the LCD would flash its top half after reset, but now I've lost that too. My circuit uses 10uF capacitor on Vout.

 

Here's the code I'm using, it's been taken from another project posted here:

 

#include 
#include 

#define SEND_CMD                   0
#define SEND_CHR                   1

#define LCD_X_RES                  84
#define LCD_Y_RES                  48

#define COUNTDOWN				   1

#define SCEPORT P1OUT
#define SDINPORT P1OUT
#define DCPORT P1OUT
#define SCKPORT P1OUT
#define RESPORT P1OUT

// 0
#define RES  BIT1

// 3
#define SCE  BIT2

// 4
#define DC   BIT3

// 5
#define SDIN BIT4

// 6
#define SCK  BIT5

short second, minute, hour, day, subsec = 0;

unsigned char displayString[14] = {
0x00,0x00,0x0a,0x00,0x00,0x0a,0x00,0x00,0x0a,0x00,0x00,0x0a,0x00,0x00
};

const unsigned char ofYouth[][41]={
{
 0xFC,0xFF,0xFF,0x07,0x03,0x03,0x06,0x1E,0xFC,0xF0,0x80,
 0x00,0x00,0x60,0x30,0x30,0x30,0x30,0xE0,0xE0,0x80,0x00,
 0x70,0xF0,0xF0,0x00,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,
 0xC0,0xE0,0x20,0x30,0x30,0x70,0x60
},
{
 0x7F,0xFF,0xFF,0xE0,0xC0,0xC0,0xE0,0x70,0x7F,0x3F,0x0F,
 0x00,0x30,0x7C,0x6E,0xC6,0xC2,0xC2,0xE3,0xFF,0xFF,0x00,
 0xE0,0xE1,0x67,0x7F,0x3C,0x1C,0x0F,0x07,0x00,0x00,0x00,
 0x70,0x63,0xC3,0xC7,0xE6,0x7E,0x7C,0x18
}
};

const unsigned char nums[][2][10] ={
{// 0
  {0xE0,0xFC,0xFE,0x06,0x03,0x03,0x06,0xFE,0xFC,0xE0},
  {0x07,0x3F,0x7F,0x70,0xE0,0xE0,0x70,0x7F,0x3F,0x07}
},
{// 1
  {0x00,0x00,0x00,0x04,0x06,0xFE,0xFF,0xFF,0x00,0x00},
  {0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0x00,0x00}
},
{// 2
  {0x00,0x00,0x1C,0x0E,0x07,0x83,0x87,0xFE,0xFE,0x38},
  {0x00,0x60,0xFC,0xFE,0xEF,0xE7,0xE3,0xE1,0x60,0x30}
},
{// 3
  {0x00,0x00,0x0E,0x0E,0xC6,0xE6,0xF6,0xBE,0x1E,0x06},
  {0x00,0x60,0x70,0xF0,0xE0,0xE0,0xF1,0x7F,0x3F,0x0E}
},
{// 4
  {0x00,0xC0,0xE0,0x78,0x1C,0x0E,0x86,0xE2,0x10,0x00},
  {0x06,0x07,0x07,0x06,0x06,0xE6,0xFF,0xFF,0x0E,0x0E}
},
{// 5
  {0x00,0x70,0xF8,0xFE,0xCE,0xC6,0xC6,0x86,0x86,0x00},
  {0x00,0x30,0x71,0x71,0xE0,0xE0,0xF0,0x7F,0x3F,0x0E}
},
{// 6
  {0xC0,0xF8,0xFC,0x8E,0x86,0xC7,0xC3,0x87,0x82,0x00},
  {0x0F,0x3F,0x7F,0x71,0xE0,0xE0,0x61,0x7B,0x3F,0x0E}
},
{// 7
  {0x00,0x00,0x0E,0x0E,0x06,0x86,0xE6,0x7E,0x1E,0x0E},
  {0x00,0x00,0x00,0x38,0x7F,0xFF,0xE1,0x40,0x00,0x00}
},
{// 8
  {0x18,0x7E,0xE6,0xC3,0xC3,0xC3,0xE6,0xBE,0x18,0x00},
  {0x18,0x7E,0x7F,0xE1,0xE1,0xE1,0xF3,0x7F,0x7F,0x1C}
},
{// 9
  {0xFC,0xCE,0x06,0x03,0x03,0x07,0x86,0xFE,0xFC,0xE0},
  {0x41,0xE3,0xE3,0xE3,0x63,0x73,0x79,0x3F,0x1F,0x03}
}
};

void updateTime( void)
{
second = (second -1);
if ( second == -1 ) { // new minute
	second = 59;
	minute = (minute - 1);
		if ( minute == -1) { // new hour
			minute = 59;
			hour = (hour -1);
			if ( hour == -1) { // new day
				hour = 23;
				day = (day -1);
				displayString[0] = day / 10;
				displayString[1] = day % 10;
			}
			displayString[3] = hour   / 10;
			displayString[4] = hour   % 10;
		}
	displayString[6] = minute / 10;
	displayString[7] = minute % 10; 
}
displayString[9] = second / 10;
displayString[10] = second % 10;
}

void LCDSend(unsigned char data, unsigned char cd) {

volatile unsigned char bits;
unsigned short cnt=8;
// assume clk is hi
// Enable display controller (active low).
SCEPORT &= ~SCE;  //RESET SCE

// command or data
if(cd == SEND_CHR) {
	DCPORT |= DC;  //set to send data
}
else {  // reset to send command
	DCPORT &= ~DC;
}

///// SEND SPI /////
bits=0x80; // bits is mask to select bit to send. select bit msb first

//send data
while (0	{
	// put bit on line
	// cycle clock
	SCKPORT &= ~SCK;
	if ((data & bits)>0) {
		SDINPORT |= SDIN;
	} else {
		SDINPORT &= ~SDIN;
	}

	//Delay(1);
	SCKPORT |= SCK;
	//Delay(2);
	// SHIFT BIT MASK 1 right
	bits >>= 1;
}

// Disable display controller.
SCEPORT |= SCE;
}

void LCDClear(void) {
 int i,j;

 LCDSend(0x80, SEND_CMD );
 LCDSend(0x40, SEND_CMD );

 for (i=0;i<6;i++)  // number of rows
   for (j=0;j      LCDSend(0x00, SEND_CHR);
}

void LCDString(unsigned char *character, unsigned int start, unsigned int layer, unsigned int stop) {
int i;
for(i=start;i<(stop+1);i++) {
	int j;
	for (j = 0; j < 10; j++) {
		LCDSend(nums[character[i]][layer][j], SEND_CHR);
	}
}
}

void LCDInit(void) { 
// assume ports set up and initialized to output

// Reset LCD
SCEPORT &= ~SCE;          // RESET SCE to enable 
// toggle RES
// 	RESPORT |= RES;           // Set RES
char l;
for(l=0;l<10;l++)
	l=l;
RESPORT &= ~RES;          // reset RES

for(l=0;l<100;l++) {
	l=l;
}
RESPORT |= RES;           // Set RES

// Cycle Clock
SCKPORT &= ~SCK;
SCKPORT |= SCK;

// Disable display controller.
SCEPORT |= SCE;           // bring high to disable 

for(l=0;l<100;l++)
	l=l;

// Send sequence of command
LCDSend( 0x21, SEND_CMD );  // LCD Extended Commands.
LCDSend( 0xBf, SEND_CMD );  // Set LCD Vop (Contrast).
LCDSend( 0x06, SEND_CMD );  // Set Temp coefficent to 2.
LCDSend( 0x13, SEND_CMD );  // LCD bias mode 1:100.
LCDSend( 0x20, SEND_CMD );  // LCD Standard Commands, Horizontal addressing mode.
LCDSend( 0x08, SEND_CMD );  // LCD blank
LCDSend( 0x0C, SEND_CMD );  // LCD in inverse mode.

LCDClear();
}

int main(void) {
// Stop watchdog
WDTCTL = WDTPW + WDTHOLD;

P1DIR = 0xFF;

BCSCTL1 = CALBC1_1MHZ;                   // Set range
DCOCTL = CALDCO_1MHZ;                    // Set DCO step + modulation

BCSCTL2 = 0xF8;
BCSCTL3 = LFXT1S_0 + XCAP_3;

subsec=0x00;
second = 0x05;
minute = 0x00;
hour = 0x16;
day = 0x03;
TACCTL0 = CCIE;
TACCR0 = 0;
TACCR0 = 0x3FF;
TACTL = 0x0211;

P1OUT |= BIT0 + BIT6;

P1OUT ^= BIT0;
LCDInit();
P1OUT ^= BIT6;

// Silly return to make gcc happy
return 0;
}

interrupt(TIMERA1_VECTOR) ta1_isr(void) {
subsec = (subsec + 1) % 32;
P1OUT ^= BIT0;
if (subsec == 0) { // New second
	updateTime();
}
}

 

Can someone help me troubleshoot this, please?

Share this post


Link to post
Share on other sites

First, you should take some photos of that connection and post them up.

 

We have to make sure that isn't a problem.

Share this post


Link to post
Share on other sites

@nyordanov,

Are those fork connectors on your lcd glass contacts like those in the example site? I also have this same lcd out of a nokia 3310. The fork idea is interesting but I suspect that it will scratch the conductive material off the glass if the forks move around too much. The way I made this work was I kept the nokia pcb that I salvaged the lcd from. The pcb was attached to the lcd via a metal frame that snapped into groves cut into the pcb which sandwiched a conductive strip between the glass contacts and copper traces on the pcb. I soldered thin wires to the copper pads below the contact point of the conductive strip making sure that the wires did not interfere with the conductive strip and the metal frame. The pcb also contains a keypad (it was a phone after all) so if your project requires user input then this could kill two birds with one stone or if not then you could score the pcb with an utility knife or similar on top and bottom of the lcd's metal frame/pcb holder.

 

I will have to dig the lcd out of a box in the shop to take pics so you can get a visual of my jabbering above if you like but I think you get the general idea.

Share this post


Link to post
Share on other sites

The forks are the same.

 

Another interesting effect. If I unplug the lcd from the circuit, wait a second, plug it back and reset the launchpad, it flashes for a brief moment with a kind of a gradient (darkest on top). It does this every time.

Share this post


Link to post
Share on other sites

PCD8544 chip on glass could be dead. Have you tried a smaller test code or bit-banging the spi port with junk data? The one I have shows junk data at start up if I do not clear the registers at start up similar to how you described so I am unsure if it is dead.

 

Let me ask how you have the lcd connected to the msp430? Are you running at 3v6 ,3v3 or what? The lcd needs 3v3, over voltage may effect it or kill it. the msp430 can go up to 3.6 which may cause the chip on glass to not work (over volt protection mode?)

try adding a 10uF cap between vcc and ground on the pcd8544

I will find my 3310 and take pics for you and try to get my example code published also.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...