Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

NOKIA 1100B LCD PIN CONFIGURATION

Status
Not open for further replies.
*(volatile unsigned char *)lcd_data =0x00;

Search the edaboard for NOKIA 3310 you will get what you want.
 

lcd pins configuration

Hello,

I am trying to interface graphical display of 1100(controller PCF8814) with AT Mega 16.I have pasted the program below.The LCD does not work.Please tell me if something is wrong.

#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include<string.h>

#define BIT(x) (1 << (x))

#define CHECKBIT(x,b) x&b
#define SETBIT(x,b) x|=b;
#define CLEARBIT(x,b) x&=~b;
#define TOGGLEBIT(x,b) x^=b;

#define SCE 0x08
#define DC 0x04

volatile char pixel_lookup[8]={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};

static const unsigned char font_lookup[96][5]=
{
{0x00, 0x00, 0x00, 0x00, 0x00},// (space)
{0x00, 0x00, 0x5F, 0x00, 0x00},// !
{0x00, 0x07, 0x00, 0x07, 0x00},// "
{0x14, 0x7F, 0x14, 0x7F, 0x14},// #
{0x24, 0x2A, 0x7F, 0x2A, 0x12},// $
{0x23, 0x13, 0x08, 0x64, 0x62},// %
{0x36, 0x49, 0x55, 0x22, 0x50},// &
{0x00, 0x05, 0x03, 0x00, 0x00},// '
{0x00, 0x1C, 0x22, 0x41, 0x00},// (
{0x00, 0x41, 0x22, 0x1C, 0x00},// )
{0x08, 0x2A, 0x1C, 0x2A, 0x08},// *
{0x08, 0x08, 0x3E, 0x08, 0x08},// +
{0x00, 0x50, 0x30, 0x00, 0x00},// ,
{0x08, 0x08, 0x08, 0x08, 0x08},// -
{0x00, 0x30, 0x30, 0x00, 0x00},// .
{0x20, 0x10, 0x08, 0x04, 0x02},// /
{0x3E, 0x51, 0x49, 0x45, 0x3E},// 0
{0x00, 0x42, 0x7F, 0x40, 0x00},// 1
{0x42, 0x61, 0x51, 0x49, 0x46},// 2
{0x21, 0x41, 0x45, 0x4B, 0x31},// 3
{0x18, 0x14, 0x12, 0x7F, 0x10},// 4
{0x27, 0x45, 0x45, 0x45, 0x39},// 5
{0x3C, 0x4A, 0x49, 0x49, 0x30},// 6
{0x01, 0x71, 0x09, 0x05, 0x03},// 7
{0x36, 0x49, 0x49, 0x49, 0x36},// 8
{0x06, 0x49, 0x49, 0x29, 0x1E},// 9
{0x00, 0x36, 0x36, 0x00, 0x00},// :
{0x00, 0x56, 0x36, 0x00, 0x00},// ;
{0x00, 0x08, 0x14, 0x22, 0x41},// <
{0x14, 0x14, 0x14, 0x14, 0x14},// =
{0x41, 0x22, 0x14, 0x08, 0x00},// >
{0x02, 0x01, 0x51, 0x09, 0x06},// ?
{0x32, 0x49, 0x79, 0x41, 0x3E},// @
{0x7E, 0x11, 0x11, 0x11, 0x7E},// A
{0x7F, 0x49, 0x49, 0x49, 0x36},// B
{0x3E, 0x41, 0x41, 0x41, 0x22},// C
{0x7F, 0x41, 0x41, 0x22, 0x1C},// D
{0x7F, 0x49, 0x49, 0x49, 0x41},// E
{0x7F, 0x09, 0x09, 0x01, 0x01},// F
{0x3E, 0x41, 0x41, 0x51, 0x32},// G
{0x7F, 0x08, 0x08, 0x08, 0x7F},// H
{0x00, 0x41, 0x7F, 0x41, 0x00},// I
{0x20, 0x40, 0x41, 0x3F, 0x01},// J
{0x7F, 0x08, 0x14, 0x22, 0x41},// K
{0x7F, 0x40, 0x40, 0x40, 0x40},// L
{0x7F, 0x02, 0x04, 0x02, 0x7F},// M
{0x7F, 0x04, 0x08, 0x10, 0x7F},// N
{0x3E, 0x41, 0x41, 0x41, 0x3E},// O
{0x7F, 0x09, 0x09, 0x09, 0x06},// P
{0x3E, 0x41, 0x51, 0x21, 0x5E},// Q
{0x7F, 0x09, 0x19, 0x29, 0x46},// R
{0x46, 0x49, 0x49, 0x49, 0x31},// S
{0x01, 0x01, 0x7F, 0x01, 0x01},// T
{0x3F, 0x40, 0x40, 0x40, 0x3F},// U
{0x1F, 0x20, 0x40, 0x20, 0x1F},// V
{0x7F, 0x20, 0x18, 0x20, 0x7F},// W
{0x63, 0x14, 0x08, 0x14, 0x63},// X
{0x03, 0x04, 0x78, 0x04, 0x03},// Y
{0x61, 0x51, 0x49, 0x45, 0x43},// Z
{0x00, 0x00, 0x7F, 0x41, 0x41},// [
{0x02, 0x04, 0x08, 0x10, 0x20},// "\"
{0x41, 0x41, 0x7F, 0x00, 0x00},// ]
{0x04, 0x02, 0x01, 0x02, 0x04},// ^
{0x40, 0x40, 0x40, 0x40, 0x40},// _
{0x00, 0x01, 0x02, 0x04, 0x00},// `
{0x20, 0x54, 0x54, 0x54, 0x78},// a
{0x7F, 0x48, 0x44, 0x44, 0x38},// b
{0x38, 0x44, 0x44, 0x44, 0x20},// c
{0x38, 0x44, 0x44, 0x48, 0x7F},// d
{0x38, 0x54, 0x54, 0x54, 0x18},// e
{0x08, 0x7E, 0x09, 0x01, 0x02},// f
{0x08, 0x14, 0x54, 0x54, 0x3C},// g
{0x7F, 0x08, 0x04, 0x04, 0x78},// h
{0x00, 0x44, 0x7D, 0x40, 0x00},// i
{0x20, 0x40, 0x44, 0x3D, 0x00},// j
{0x00, 0x7F, 0x10, 0x28, 0x44},// k
{0x00, 0x41, 0x7F, 0x40, 0x00},// l
{0x7C, 0x04, 0x18, 0x04, 0x78},// m
{0x7C, 0x08, 0x04, 0x04, 0x78},// n
{0x38, 0x44, 0x44, 0x44, 0x38},// o
{0x7C, 0x14, 0x14, 0x14, 0x08},// p
{0x08, 0x14, 0x14, 0x18, 0x7C},// q
{0x7C, 0x08, 0x04, 0x04, 0x08},// r
{0x48, 0x54, 0x54, 0x54, 0x20},// s
{0x04, 0x3F, 0x44, 0x40, 0x20},// t
{0x3C, 0x40, 0x40, 0x20, 0x7C},// u
{0x1C, 0x20, 0x40, 0x20, 0x1C},// v
{0x3C, 0x40, 0x30, 0x40, 0x3C},// w
{0x44, 0x28, 0x10, 0x28, 0x44},// x
{0x0C, 0x50, 0x50, 0x50, 0x3C},// y
{0x44, 0x64, 0x54, 0x4C, 0x44},// z
{0x00, 0x08, 0x36, 0x41, 0x00},// {
{0x00, 0x00, 0x7F, 0x00, 0x00},// |
{0x00, 0x41, 0x36, 0x08, 0x00},// }
{0x08, 0x08, 0x2A, 0x1C, 0x08},// ->
{0x08, 0x1C, 0x2A, 0x08, 0x08} // <-
};

void lcd_cmd(unsigned char cmd);
void lcd_data(unsigned char cmd);

void lcd_goto_xy(char x,char y)
{
y=y|0x40;
lcd_cmd(y);
x=(x*6)|0x80;
lcd_cmd(x);
}

void lcd_char(unsigned char character)
{
unsigned char j=0;
for(j=0;j<5;j++)
lcd_data((font_lookup[character-32][j] << 1));

}



void lcd_string(unsigned char font,unsigned char *string)
{
if(font==1)
{
unsigned char j;
lcd_cmd(0xae);
while(*string!='\0')
{
for(j=0;j<5;j++)
lcd_data((font_lookup[*string-32][j] << 1));
lcd_data(0x00);
string++;
}
}

lcd_cmd(0xaf);

}

void lcd_num_char(unsigned char num)
{
unsigned char H=0,T=0,O=0,j=0;
H=num/100;
T=(num - (H*100))/10;
O=(num - (H*100) - (T*10));

for(j=0;j<5;j++)
lcd_data(font_lookup[H+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[T+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[O+16][j]);

}

void lcd_num_int(unsigned int num)
{
unsigned char TT=0, TH=0, H=0, T=0, O=0, j=0;

TT=num/10000;
TH=(num-(TT*10000))/1000;
H=(num-(TT*10000)-(TH*1000))/100;
T=(num - (TT*10000)-(TH*1000)-(H*100))/10;
O=(num - (TT*10000)-(TH*1000) -(H*100) - (T*10));
for(j=0;j<5;j++)
lcd_data(font_lookup[TT+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[TH+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[H+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[T+16][j]);
for(j=0;j<5;j++)
lcd_data(font_lookup[O+16][j]);
}
char x_line=0, y_line=0;





void Gotoxy(char x,char y){
lcd_cmd(0xB0|(y&0x0F)); // Y axis initialisation: 0100 yyyy
lcd_cmd(0x00|(x&0x0F)); // X axis initialisation: 0000 xxxx ( x3 x2 x1 x0)
lcd_cmd(0x10|((x>>4)&0x07)); // X axis initialisation: 0010 0xxx ( x6 x5 x4)
lcd_data(pixel_lookup[y]);
}

void lcd_pixel(char x, char y) // 40,36
{
unsigned char x_block=0, y_block=0;
//x_block=x/16;
y_block=y/8;
y=y%8;

y_block=y_block|0x40;
lcd_cmd(y_block);
x=x|0x80;
lcd_cmd(x);
lcd_data(pixel_lookup[y]);
}

void lcd_clear(void){
unsigned int i;
lcd_cmd(0x40); // Y = 0
lcd_cmd(0xb0);
lcd_cmd(0x10); // X = 0
lcd_cmd(0x0);
lcd_cmd(0xae); // disable display;
for(i=0;i<864;i++)
lcd_data(0x00);
lcd_cmd(0xaf); // enable display;
}
void lcd_init(void)
{

CLEARBIT(PORTA, SCE)
CLEARBIT(PORTA, DC)
_delay_ms(5); // 5mS so says the stop watch(less than 5ms will not work)
SETBIT(PORTA, DC)
lcd_cmd(0x20); // write VOP register
lcd_cmd(0x90);
lcd_cmd(0xA4); // all on/normal display
lcd_cmd(0xAf);//display on
lcd_cmd(0x2F); // Power control set(charge pump on/off)
lcd_cmd(0x40); // set start row address = 0
lcd_cmd(0xb0); // set Y-address = 0
lcd_cmd(0x10); // set X-address, upper 3 bits
lcd_cmd(0x00); // set X-address, lower 4 bits
lcd_cmd(0xC8); // mirror Y axis (about X axis)
lcd_cmd(0xad);//a1 // Invert screen in horizontal axis
lcd_cmd(0xac); // set initial row (R0) of the display
lcd_cmd(0x07);
//lcd_cmd(0xF9); //
lcd_cmd(0xaf); // display ON/OFF
lcd_cmd(0xa9);
//lcd_cmd(0xE8);
lcd_clear(); // clear LCD
lcd_cmd(0xa7); // invert display
_delay_ms(500); // 1/2 Sec delay
lcd_cmd(0xa6); // normal display (non inverted)
_delay_ms(1000); // 1 Sec delay //lcd_cmd(0x21);
//lcd_cmd(0xc8);
//lcd_cmd(0x06);
// lcd_cmd(0x13);
//lcd_cmd(0x20);
// lcd_cmd(0x0c);
}


void lcd_cmd(unsigned char cmd)
{
CLEARBIT(PORTA, DC)
CLEARBIT(PORTA, SCE)
//SPDR=0xFE;
//while(!(CHECKBIT(SPSR,BIT(7)))) {}

SPDR=cmd;
while(!(CHECKBIT(SPSR,BIT(7)))) {}

SETBIT(PORTA, SCE)

}
void lcd_cmd1(unsigned char cmd)
{
CLEARBIT(PORTA, DC)
CLEARBIT(PORTA, SCE)
SPDR=0xFF;
while(!(CHECKBIT(SPSR,BIT(7)))) {}

SPDR=cmd;
while(!(CHECKBIT(SPSR,BIT(7)))) {}

SETBIT(PORTA, SCE)

}



void lcd_data(unsigned char dat)
{
SETBIT(PORTA, DC)
CLEARBIT(PORTA, SCE)

SPDR=dat;
while(!(CHECKBIT(SPSR,BIT(7)))) {}

SETBIT(PORTA, SCE)
}


void spi_write(unsigned char senddata)
{

SPDR=senddata;
while(!(CHECKBIT(SPSR,BIT(7)))) {}

}

void lcd_circle(unsigned char cx, unsigned char cy ,unsigned char radius)
{
int x, y,xchange, ychange, radiusError;
x = radius;
y = 0;
xchange = 1 - 2 * radius;
ychange = 1;
radiusError = 0;
while(x >= y)
{
lcd_pixel(cx+x, cy+y);
lcd_pixel(cx-x, cy+y);
lcd_pixel(cx-x, cy-y);
lcd_pixel(cx-x, cy+y);
//lcd_pixel(cx-x, cy-y);
//lcd_pixel(cx+x, cy-y);
lcd_pixel(cx+y, cy+x);
lcd_pixel(cx-y, cy+x);
lcd_pixel(cx-y, cy-x);
lcd_pixel(cx+y, cy-x);
y++;
radiusError += ychange;
ychange += 2;
if ( 2*radiusError + xchange > 0 )
{
x--;
radiusError += xchange;
xchange += 2;
}
}
}

int main(void)
{
unsigned int i=0;
DDRB=0xff;
DDRA=0xff;
PORTA=0xff;
SETBIT(SPSR,0)
SPCR=BIT(6)+BIT(4)+BIT(3)+BIT(2)+BIT(0);

lcd_init();



Gotoxy(10,20);
lcd_string(1,"vikky");

while(1){}
return 0;
}



The hardware connections are as below

XRES----------->PA2
SCE------------->PA3
SDIN------------->PB5
SCK-------------->PB7
VDD and VDD1 are given 3.1V supply
VSS is ground.

Please help me to find out the problem.

With Thanks and Regards

Vikky
 

nokia 10 pin display

Hi,

First its very important that you make sure that your LCD is still working, because some reason I blown mine.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top