LCDInfo.com

http://www.lcdinfo.com
It is currently Fri Nov 22, 2024 11:10

All times are UTC + 2 hours




Post new topic Reply to topic  [ 163 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
PostPosted: Thu Feb 06, 2003 0:42 
Hi all!

First of all, sorry for my poor english.

I have read all the posts that you have posted in this forum and I tried to program a very simple application that initializes the LCD, and write pixels using the functions that you have posted.

I found some problems in the sbrSetPixel, my LCD doesn't display all the pixels, specially the last X coordinates.

I will agree any help that you can give me.

Thanks everyone.

PD: PowerLCD works fine with my LCD, i will know how this program draw pixels.


Top
  
 
 Post subject: Sorry
PostPosted: Thu Feb 06, 2003 12:03 
Sorry, in the post I don't say which is my LCD.

LCD 240x128, controlled by Toshiba T6963C.

The pins are this:
D0-D7: Pin 2 - Pin 9
CE: Pin 1
C/D: Pin 17
RD: Pin 14
WR: Pin 16

All this pins are the parallel port.

Thanks.


Top
  
 
 Post subject:
PostPosted: Thu Feb 06, 2003 14:53 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Could you also tell the settings you are using in the initialization. Are you programming in C ?


Top
 Profile  
 
 Post subject: Initialization
PostPosted: Thu Feb 06, 2003 17:03 
I'm programming in Visual Basic .NET but I understand C code, in the initialization, i use

G_BASE = &H300
T_BASE =&H0
BYTES_X_ROW = 40

Are u asking this ¿?

Thanks


Top
  
 
 Post subject: Bufff.
PostPosted: Fri Feb 07, 2003 0:32 
I passed hours trying to implement the functions that you hace posted in the post of Visual Basic.

But there are no way to make this functionality.

I will agree anyone who can help me posting the basic code (Init, PutPixel, ClearText, ... ) in C or in VB for my LCD. I tryed all the functions that Henri have posted, but i have a lot of problems, i think in timing, i don't know sure

A lot of thanks.


Top
  
 
 Post subject:
PostPosted: Fri Feb 07, 2003 4:59 
Offline

Joined: Wed Jan 29, 2003 4:32
Posts: 12
Are u german?

It would be more easy for me to explain how to control the T6963.

Do you have the datasheet of the T6963?
You will find all information in there.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 07, 2003 11:11 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Ok, I can post some T6963C test program code later.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Fri Feb 07, 2003 12:36 
Thanks all, i'm not German.

I'm Catalan.

I have the T6963C datasheet, but i don't know why i have all this problems.

Thanks for helping me :cry: :cry: :cry: :cry:


Top
  
 
 Post subject:
PostPosted: Fri Feb 07, 2003 18:45 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
This code worked fine for me with 240x128 display using the powerlcd wiring:

Code:
#define G_BASE 0x0300   // grafiikkamuistin base address
#define T_BASE 0x0000   // tekstimuistin base address
#define BYTES_PER_ROW 40 // merkkiä rivillä

#define BASE 0x378      // lpt portin osoite

void WaitDisplayReady(void)
// reads the display status byte and checks
// that the display is ready before writing

// doesn't have any check in case the status byte
// can't be read so this situation may cause a lockup

{
 
  int Tmp;

       Tmp = DlPortReadPortUshort(BASE + 0x402);
       Tmp = Tmp & 0x1F;
       Tmp = Tmp | 0x20;
       DlPortWritePortUshort(BASE + 0x402, Tmp);

       do{
             DlPortWritePortUshort(BASE + 2, 0x20 + 4 + 2);     //In, CD=1, CS=0, Wr=1
             DlPortWritePortUshort(BASE + 2, 0x20 + 4 + 2 + 8); //In, CD=1, CS=0, Wr=1, Rd=0
             Tmp = DlPortReadPortUshort(BASE);
             DlPortWritePortUshort(BASE + 2, 0x20 + 4 + 2);     //In, CD=1, CS=0, Wr=1

       }while ((Tmp & 3) != 3 );
       DlPortWritePortUshort(BASE + 2, 0);
   
}

void WriteData(USHORT Data)
{

    /* pollin
   WaitDisplayReady();
    DlPortWritePortUshort(BASE + 2, 0);   // 0111 C/D low
    DlPortWritePortUshort(BASE + 2, 2);   // 0011 WR low
    DlPortWritePortUshort(BASE, Data);
    DlPortWritePortUshort(BASE + 2, 3);   // 0010 CE low
    DlPortWritePortUshort(BASE + 2, 2);   // 0011 CE high
    DlPortWritePortUshort(BASE + 2, 0);   // 0111 WR high
   */

   /* powerlcd */
   DlPortWritePortUshort(BASE + 2, 0x0c);   // 0111 C/D low
   DlPortWritePortUshort(BASE + 2, 0x08);   // 0011 WR low
   DlPortWritePortUshort(BASE, Data);
   DlPortWritePortUshort(BASE + 2, 0x09);   // 0010 CE low
   DlPortWritePortUshort(BASE + 2, 0x08);   // 0011 CE high
   DlPortWritePortUshort(BASE + 2, 0x0c);   // 0111 WR high
   
}

void WriteCtrl(USHORT Command)
{

   /*
   WaitDisplayReady();
    DlPortWritePortUshort(BASE, Command);
    DlPortWritePortUshort(BASE + 2, 4);      // 1111 C/D high
    DlPortWritePortUshort(BASE + 2, 4+2);      // 1011 WR low
    DlPortWritePortUshort(BASE + 2, 4+3);      // 1010 CE low
    DlPortWritePortUshort(BASE + 2, 4+2);      // 1011 CE high
    DlPortWritePortUshort(BASE + 2, 0);      // 0111 C/D low
   */

   /* powerlcd */
   DlPortWritePortUshort(BASE + 2, 0x04);      // 1111 C/D high
   DlPortWritePortUshort(BASE + 2, 0x00);      // 1011 WR low
   DlPortWritePortUshort(BASE, Command);
   DlPortWritePortUshort(BASE + 2, 0x01);      // 1010 CE low
   DlPortWritePortUshort(BASE + 2, 0x00);      // 1011 CE high
   DlPortWritePortUshort(BASE + 2, 0x0c);      // 0111 C/D low
}

void InitLCD(void)
{
  // Display init
  WriteData(T_BASE & 0xFF);   // Data1: LowAddress
  WriteData(T_BASE >> 8);     // Data2: HighAddress
  WriteCtrl(0x40);            // Command: 0x40 -> 01000000

  WriteData(BYTES_PER_ROW);  // Data1: Colums
  WriteData(0);              // Data2: 0
  WriteCtrl(0x41);           // Command: 0x41 -> 01000001

  WriteData(G_BASE & 0xFF);  // Data1: LowAddress
  WriteData(G_BASE >> 8);    // Data2: HighAddress
  WriteCtrl(0x42);           // Command: 0x42 -> 01000010

  WriteData(BYTES_PER_ROW);  // Data1: Colums
  WriteData(0);              // Data2: 0
  WriteCtrl(0x43);           // Command: 0x43 -> 01000011

  // Internal CGROM Mode, OR Mode
  WriteCtrl(0x80); // OR Mode    // 80->10000000

  WriteCtrl(0xa7); // cursor is 8 lines high
  WriteData(0x00);
  WriteData(0x00);
  WriteCtrl(0x21); // put cursor at (x,y)

  // DisplayMode
  WriteCtrl(0x9D);
}

void SetLCDXY(int x, int y)
{
int addr;
  addr = T_BASE + (y * BYTES_PER_ROW) + x;
  WriteData(addr & 0xFF);
  WriteData(addr >> 8);
  WriteCtrl(0x24);
}

void SetLCDCursor(int x, int y)
{
  WriteData(x);
  WriteData(y);
  WriteCtrl(0x21);
}

void ClearLCDText(void)
{
  int i;

  WriteData(T_BASE & 0xFF);
  WriteData(T_BASE >> 8);
  WriteCtrl(0x24);      // address pointer to T_BASE

  for (i=0;i<640;i++) {
        WriteData(0); WriteCtrl(0xc0); // write data and inc ptr
  }
}

void ClearLCDGraph(void)
{
  int i;

  WriteData(G_BASE & 0xFF);
  WriteData(G_BASE >> 8);
  WriteCtrl(0x24); // address pointer to G_BASE

  for (i=0;i<5120;i++){
        WriteData(0); WriteCtrl(0xc0); // write data and inc ptr
  }
}

void PrintLCDText(char *string)
{
  unsigned int i;
  char c;

  for (i=0;i<strlen(string);i++){
        c = string[i] - 0x20; // conversion from ASCII to LCD characters
        if (c<0) c=0;
        WriteData(c);
        WriteCtrl(0xc0);
  }
}

void SetLCDPixel(int x, int y)
{
  int addr;

  addr = G_BASE + (y*BYTES_PER_ROW) + (x/6);
  WriteData(addr & 0xFF);
  WriteData(addr >> 8);
  WriteCtrl(0x24);
  WriteCtrl(0xf8 | (5-(x % 6)));
}

void ClearLCDPixel(int x, int y)
{
  int addr;

  addr = G_BASE + (y*BYTES_PER_ROW) + (x/6);
  WriteData(addr & 0xFF);
  WriteData(addr >> 8);
  WriteCtrl(0x24);
  WriteCtrl(0xf0 | (5-(x % 6)));
}


void main(void)
{
  InitLCD();
  ClearLCDText();
  ClearLCDGraph();
  SetLCDXY(2,7);
  PrintLCDText("Text juttu lisaa");

  for(int i=0;i<240;i++)
     for(int j=10;j<50;j++)
         SetLCDPixel(i,j);
 
  for(int k=110;k<150;k++)
     for(int l=20;l<30;l++)
        ClearLCDPixel(k,l);

  for(int m=10;m<20;m++)
     for(int n=20;n<30;n++)
        ClearLCDPixel(m,n);

}


Top
 Profile  
 
 Post subject: Thanks for the code
PostPosted: Fri Feb 07, 2003 22:29 
Offline

Joined: Fri Feb 07, 2003 16:37
Posts: 60
Location: SaNT QUiRZe, ||*|| CaTaLoNiA ||*||
A lot of thanks Henri,

I 'm going to try it now

I will comment the results.

Thanks again :D

_________________
Nuestra única limitación es la imaginación


Top
 Profile  
 
 Post subject: Well
PostPosted: Fri Feb 07, 2003 23:07 
Offline

Joined: Fri Feb 07, 2003 16:37
Posts: 60
Location: SaNT QUiRZe, ||*|| CaTaLoNiA ||*||
Thanks to your code I have discovered my problems.
It seems that the iterative cycles (for statements) didn't work properly, but i have solutioned yet.

PD: If you would I can paste the code that I translate for VB .NET.

A lot of thanks, :oops: :oops: :oops:

_________________
Nuestra única limitación es la imaginación


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 09, 2003 11:26 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
I'd like to see you posting your VB .NET code here if possible. :)


Top
 Profile  
 
 Post subject: Ok !!
PostPosted: Mon Feb 10, 2003 22:23 
Offline

Joined: Fri Feb 07, 2003 16:37
Posts: 60
Location: SaNT QUiRZe, ||*|| CaTaLoNiA ||*||
Ok! I will put the code on Wednesday, cause i'm in exams.

Bye !

_________________
Nuestra única limitación es la imaginación


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 11, 2003 18:31 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
No need to hurry :)


Top
 Profile  
 
 Post subject: Today night
PostPosted: Wed Feb 19, 2003 20:35 
Offline

Joined: Fri Feb 07, 2003 16:37
Posts: 60
Location: SaNT QUiRZe, ||*|| CaTaLoNiA ||*||
Today night i will post the code translation into VB.NET

I don't understand your language, so i don't know what you say ... sorry
(ADMIN EDIT: Marc means these posts)

Thanks, and wait until night, please.

Sorry for the late...

Bye !

_________________
Nuestra única limitación es la imaginación


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 163 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group