??? 06/23/05 15:01 Read: times |
#95728 - Nokia 3310 LCD & 89s52 |
Hi Everyone,
Recently I bought a Nokia 3310 LCD to interface with my 89s52 mcu running at 12MHz. I searched the web for the pinning and I found pin details. The LCD uses Philip's PCD8544 controller. With the help of its datasheet, I wrote the lcd driver. But the display is not working. It is not at all showing anything. I noticed some nuances in the datasheet: 1. The Reset pin should be properly asserted after power-up else the chip will not respond. I noticed the same and I have done it properly. 2. It is said that in the combined module, Vout pin is available which should be bypassed to ground. But in the datasheet of PCD8544, nothing has been cited about Vout pin. I have bypassed the Vout pin using a 1uF capacitor. I found one thing: all the projects which I saw did not use any 8051 variant. They were using other controllers(AVR, PIC) or directly from PC's parallel port. Is there anything specific with that? I went through the datasheet and I found that 89s52 is perfectly suited for this application. Has anyone here used the Nokia 3310 display with MCS51? Is there anything should be adhered which is not told in the datasheet? For your reference, I have put the program written in Keil C. Thanks and Regards, Vignesh. PS: Nokia 3310 is very cheap and widely available in my place. Even better is its cost: Rs.140 against Rs.220 for an 2x16 character LCD module. Code: #include <REGX51.H> #define CMD 0 #define DATA 1 void init3310(void); void delay(unsigned int); void delay1ms(void); void sndcmd(unsigned char); void glcdata(unsigned char); void main(void); void timer0(void) interrupt 1 { tmr0bit=1; } void delay1ms(void) { TR0=0; TMOD |= 0x01; TF0 = 0; TL0=0x17; TH0=0xFC; TR0=1; while(tmr0bit==0); tmr0bit=0; } void delay(unsigned int timems) { unsigned int i; for(i=0;i<timems;i++) delay1ms(); } /* 1 --- Yellow ( vCC) 2 --- Green (P0.7)SCK 3 --- Black (P0.6)SDIN 4 --- Red (P0.5)D/C 5 --- Blue (P0.3)SCE 6 --- Yellow(GND)GND 7 --- Green(NC)VOUT 8 --- Black(P0.4)RES */ sbit SCLK=0x87; sbit SDIN=0x86; sbit DC=0x85; sbit SCE=0x83; sbit RST=0x84; void init3310(void) { P0=0xff; SCE=1; RST=1; RST=0; RST=1; SCE=0; RST=1; RST=0; RST=1; sndcmd(0x21);//PD=0,V=0,H=1 sndcmd(0x10);//bias system, BS2=BS1=BS0=0 sndcmd(0x90);//Vop value as per datasheet sndcmd(0x04);//temp coeff=0 //extended addressing complete sndcmd(0x20);//switching to ordinary mode H=1 sndcmd(0x0C);//D=1,E=0-normal mode sndcmd(0x40);//Y addr=0 sndcmd(0x80);//X addr=0 SCE=1;//chip is deselected } void sndcmd(unsigned char command) { unsigned char cntr,value; SCLK=1; RST=1;//chip is not at reset SCE=0;//chip is enabled DC=0;//command is to be sent SCLK=1;//sclk is started with negative edge SCLK=0; for(cntr=0;cntr<=7;cntr++) { value=(0x80 & command); if (value==0x80) SDIN=1; else SDIN=0; SCLK=1;//at this positive edge, the SDIN is sampled SCLK=0;//again SCLK=0 for next cycle command<<=1; } SCE=1;//chip is deselected } void glcdata(unsigned char databyte) { unsigned char cntr,value; SCLK=1; RST=1;//chip is not at reset SCE=0;//chip is enabled DC=1;//data is to be sent SCLK=1;//sclk is started with negative edge SCLK=0; for(cntr=0;cntr<=0;cntr++) { value=(0x80 & databyte); if (value==0x80) SDIN=1; else SDIN=0; SCLK=1;//at this positive edge, the SDIN is sampled SCLK=0;//again SCLK=0 for next cycle databyte<<=1; } SCE=1;//chip is deselected } void main(void) { IE=0x82; delay(10); setcursor(2,1); init3310(); glcdata(0x0f);//writes something on the screen glcdata(0x00); glcdata(0xff); SCLK=1; while(1); } |
Topic | Author | Date |
Nokia 3310 LCD & 89s52 | 01/01/70 00:00 | |
Not tried it | 01/01/70 00:00 | |
Contrast | 01/01/70 00:00 | |
other controllers | 01/01/70 00:00 | |
use pressure | 01/01/70 00:00 | |
Re: connector | 01/01/70 00:00 | |
scope! | 01/01/70 00:00 | |
dedicated SPI port | 01/01/70 00:00 | |
SPI with not response | 01/01/70 00:00 | |
Check the pins | 01/01/70 00:00 | |
Re: port structures | 01/01/70 00:00 | |
more scope now!! | 01/01/70 00:00 | |
89S52 at 3.3V? | 01/01/70 00:00 | |
What a memory | 01/01/70 00:00 | |
AT89LS52 | 01/01/70 00:00 | |
3310 LCD and C code | 01/01/70 00:00 | |
Interesting | 01/01/70 00:00 | |
oops!!![]() | 01/01/70 00:00 |