??? 08/08/06 07:55 Modified: 08/08/06 09:17 Read: times |
#121827 - To Micheal and dear alll regarding sed 1335 |
Dear Micheal and Dear all,
I am making a control board utilising AT89C51RD2 to interface a 320x240 LCD driven by SED1335 lcd controller. I am in a phase of writing the initial driver for SED1335 in which i am facing a problem : I have tried all means, refered all of your documents and links provided by my fellow members and EPSON guys to initialise SED1335. I even got the LCD checked from the dealer for its proper working, the 320x240 lcd with the sed1335 module works fine with the dealer. But it doesnt get initialised at my place when try to run the sample code for 8051 provided by the dealer. Can you check up with the code what might be goin wrong. //****************** DISPLAYING TEXT AND GRAPHIC ON GRAPHIC LCD (S1D13305)************************************ #include<stdio.h> #include<reg51.h> #include <intrins.h> sbit dir = P1^0; // latch direction pin sbit addr = P1^1; // A0 sbit read = P3^7; // RD (ACTIVE LOW) sbit write= P3^6; // WR (ACTIVE LOW) sbit chip = P1^6; // CS (ACTIVE LOW) sbit reset= P2^3; // RESET (ACTIVE LOW) void send(unsigned char ); void delay(int); void planet(char ,char ,char ,char,char ,char ,char ,char ,char ,char); void symbol_gen(char ,char ,char ,char ,char ,char ,char ,char ,char,char ,char ,char ,char ,char ,char ,char ); void clrscr(void); void putimage (unsigned char code *); void ChipSend (unsigned char,unsigned int); int i; unsigned char code sun[] = { 0xE2 ,0x26 main() { //********************************* RESET ************************************************** dir=1; read = 1; write = 1; chip = 1; reset = 0; delay(1000); reset = 1; P2 &= 0xF8; //************* Initialization SYSTEM SET *************************************************** addr = 1; // FOR ENABLING ADDRESS send(0x40); addr = 0; // FOR ENABLING DATA send(0x36); //p1 EXTERNAL CG ROM,M2=16PIXELS send(0x87); //p2 FX 8 PIXEL send(0x0F); //p3 FY 16 PIXEL send(0x27); //p4 Characters per row [c/r] = 320/8 = 40 send(0x2F); //p5 total add range per line [TS/R]=40+8=48, TS/R = 47 send(0x0EF); //P6 display lines (L/F)** send(0x28); //P7 AP 40 adresses horizontal send(0x00); //P8 APL // ************************** SCROLL ************************************************************* addr = 1; send(0x44); //C addr = 0; send(0x00); //P1 FIRST SCREEN BLK ADDR LOW send(0x00); //P2 HIGH BYTE send(0x0F0); //P3 send(0xB0); //P4 send(0x04); //P5 send(0x0F0); //P6 //HDOT SCR addr = 1; send(0x5A); //C addr = 0; send(0x00); // set horizontal pixel shift to zero //OVLAY addr = 1; send(0x5B); //C addr = 0; send(0x01); // TWO LAAYER , INVERSE VIDEO COMPOSITION , FIRST SCREEN LAYER TEXT //DISPLAY OFF addr = 1; send(0x58); //c addr = 0; send(0x16); //P1 //CLEAR DATA IN FIRST LAYER addr = 1; send(0x46); //c CSRW addr = 0; send(0x00); //P1 DISPLAY MEMEORY ADDRESS OF FIRST LAYER send(0x00); //P2 addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT addr = 0; addr = 1; send(0x42); //c MWRITE addr = 0; for(i=0;i<1200;i++) //clear data, 1200 ARE NO OF BYTES IN FIRST LAYER send(0x20); // ' ' SPACE //CLEAR DATA IN SECOND LAYER addr = 1; send(0x46); //c CSRW addr = 0; send(0xB0); //P1(LOW) DISPLAY ADDRESS OF SECOND BLOCK LAYER send(0x04); //P2(HIGH) addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT addr = 0; addr = 1; send(0x42); //c MWRITE addr = 0; for(i=0;i<9600;i++) //clear data 9600 NO OF BYTES IN SECOND LAYER send(0x00); // CLEARING SECOND LAYER //CSRFORM addr = 1; send(0x5D); //C addr = 0; send(0x07); //P1 CRX==8 00000111 PIXELS send(0x0F); //P2 CRY==16 00001111 PIXELS , CM=BLOCK CURSOR //DISPLAY ON addr = 1; send(0x59); //c // ***************** DISPLAYING GRAPPHICS IN SECOND SCREEN LAYER *************************************** while (1) { putimage (logo); delay (65000); delay (65000); delay (65000); clrscr (); delay (5000); putimage (sun); delay (65000); delay (65000); delay (65000); clrscr (); delay (5000); } } //********************** SEND TO DATA BUS *********************************************************************/ void send(char value) { chip = 0; P0=value; write = 0; read=1; // Changed by Shanthi write = 1; _nop_(); write = 0; chip = 1; } /*void send(char value) { P0=value; chip = 1; //P2=P2&0xf8; write = 0; //read=1; // Changed by Shanthi _nop_(); write = 1; chip = 0; }*/ //******************* delay *********************************************************************************** void delay(int time) { //for(i=0;i<time;i++); while(time--) _nop_(); } // ********************************** TEXT DISPLAY ******************************************* /* void planet(char a1,char a2,char p1,char p2,char p3,char p4,char p5,char p6,char p7,char p8) { addr = 1; send(0x46); //c addr = 0; send(a2); //P1 FIRST LINE 32ND POSITION send(a1); //P2 //CSRDIR addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT addr = 0; //MWRITE addr = 1; send(0x42); //c addr = 0; send(p1); send(p2); send(p3); send(p4); send(p5); send(p6); send(p7); send(p8); } // *************************** GENERATING USER DEFINED CHARACTER AND STORING IN EXT CGRAM ****************** void symbol_gen(char p1,char p2,char p3,char p4,char p5,char p6,char p7,char p8,char p9,char p10,char p11,char p12,char p13,char p14,char p15,char p16) { //MWRITE USERDEFINED CODE addr = 1; send(0x42); //c addr = 0; send(p1); // HEX VALUES OF USERDEFINE CHARACTER send(p2); send(p3); send(p4); send(p5); send(p6); send(p7); send(p8); send(p9); send(p10); send(p11); send(p12); send(p13); send(p14); send(p15); send(p16); } */ void clrscr(void) { addr = 1; send(0x46); //c CSRW addr = 0; send(0x00); //P1 DISPLAY MEMEORY ADDRESS OF FIRST LAYER send(0x00); //P2 addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT addr = 0; addr = 1; send(0x42); //c MWRITE addr = 0; /* for(i=0;i<1200;i++) //clear data, 1200 ARE NO OF BYTES IN FIRST LAYER send(0x20); // ' ' SPACE*/ ChipSend (0x20,1200); //CLEAR DATA IN SECOND LAYER addr = 1; send(0x46); //c CSRW addr = 0; send(0xB0); //P1(LOW) DISPLAY ADDRESS OF SECOND BLOCK LAYER send(0x04); //P2(HIGH) addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT addr = 0; addr = 1; send(0x42); //c MWRITE addr = 0; /* chip = 1; // Chip Select for(i=1200;i<10800;i++) //clear data 9600 NO OF BYTES IN SECOND LAYER { P0=0x00; write = 0; // _nop_ (); write = 1; } chip = 0; // Chip Deselect*/ ChipSend (0x00,9600); } void putimage (unsigned char code *img) { unsigned char ii,jj; unsigned char code *tt=img+2; unsigned int address=0x04B0; addr = 1; send(0x4C); //c SET CURSOTR SHIFT DIRECTION TO RIGHT for(ii=0;ii<img[0];ii++) //clear data 9600 NO OF BYTES IN SECOND LAYER { addr = 1; send(0x46); //c CSRW addr = 0; send(address); //P1(LOW) DISPLAY ADDRESS OF SECOND BLOCK LAYER send((unsigned char)(address>>8)); //P2(HIGH) address += 40; addr = 1; send(0x42); //c MWRITE addr = 0; chip = 1; // Chip Select for (jj=0;jj<img[1];jj++) { //send(*tt++); // CLEARING SECOND LAYER P0=*tt++; write = 0; //_nop_ (); write = 1; } } chip = 0; } void ChipSend (unsigned char ch,unsigned int cnt) { chip =1; // Chip select P0=ch; while (cnt--) { write = 0; // cnt--; write = 1; } chip = 0; // Chip Deselect } |
Topic | Author | Date |
To Micheal and dear alll regarding sed 1335 | 01/01/70 00:00 | |
Have you checked the timing? | 01/01/70 00:00 | |
My Modifications | 01/01/70 00:00 | |
Your code doesn't show the modifications | 01/01/70 00:00 | |
the hardware has been verified | 01/01/70 00:00 | |
timings and delaying as well | 01/01/70 00:00 | |
try this | 01/01/70 00:00 | |
Tried ... Delays Doesnt Help ....![]() | 01/01/70 00:00 |