LCDInfo.com

http://www.lcdinfo.com
It is currently Fri Nov 22, 2024 9:36

All times are UTC + 2 hours




Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Thu Jan 02, 2003 14:27 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
I was using LCDInfo version 0.3.1 and currently I am using 0.3.2. I already reinstalled the DLPortIO driver, but no change. Maybe it has to do with the BIOS and Windows settings, but I have tried a lot of combinations.

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 14:34 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Here's the new code I was talking about. I've only tested this with the Pollin wiring but I'm sure you'll tell me if it doesn't work with you powerlcd wiring. In fact I can send you my test program set for your wiring.

Also the timings aren't following the specs but using these I was able to show full screen animations on a 240x128 T6963C display at 18 fps with busy flag checking disabled and 11 fps with busy flag checking enabled. To get timing more like the specs say you can try including some of the commented out lines.

Code:
#define BASE 0x378      // lpt port address
#define DATA BASE
#define CONTROL BASE + 2

#define PIN1HI  0; // 0000 inverted
#define PIN1LO  1; // 0001 inverted

#define PIN14HI 0; // 0000 inverted
#define PIN14LO 2; // 0010 inverted

#define PIN16HI 4; // 0100
#define PIN16LO 0; // 0000

#define PIN17HI 0; // 0000 inverted
#define PIN17LO 8; // 1000 inverted

// here you define the wiring you are using
// pollin
int wr=1;
int rd=17;
int cd=16;
int ce=14;

/*
// powerlcd
int wr=16;
int rd=14;
int cd=17;
int ce=1;
*/

int WRHI;
int WRLO;
int RDHI;
int RDLO;
int CEHI;
int CELO;
int CDHI;
int CDLO;

void SetPins(void)
{
  switch (wr)
  {
    case 1:  WRHI = PIN1HI; break;
    case 14: WRHI = PIN14HI; break;
    case 16: WRHI = PIN16HI; break;
    case 17: WRHI = PIN17HI; break;
  }

  switch (wr)
  {
    case 1:  WRLO = PIN1LO; break;
    case 14: WRLO = PIN14LO; break;
    case 16: WRLO = PIN16LO; break;
    case 17: WRLO = PIN17LO; break;
  }

  switch (rd)
  {
    case 1:  RDHI = PIN1HI; break;
    case 14: RDHI = PIN14HI; break;
    case 16: RDHI = PIN16HI; break;
    case 17: RDHI = PIN17HI; break;
  }

  switch (rd)
  {
    case 1:  RDLO = PIN1LO; break;
    case 14: RDLO = PIN14LO; break;
    case 16: RDLO = PIN16LO; break;
    case 17: RDLO = PIN17LO; break;
  }

  switch (ce)
  {
    case 1:  CEHI = PIN1HI; break;
    case 14: CEHI = PIN14HI; break;
    case 16: CEHI = PIN16HI; break;
    case 17: CEHI = PIN17HI; break;
  }

  switch (ce)
  {
    case 1:  CELO = PIN1LO; break;
    case 14: CELO = PIN14LO; break;
    case 16: CELO = PIN16LO; break;
    case 17: CELO = PIN17LO; break;
  }

  switch (cd)
  {
    case 1:  CDHI = PIN1HI; break;
    case 14: CDHI = PIN14HI; break;
    case 16: CDHI = PIN16HI; break;
    case 17: CDHI = PIN17HI; break;
  }

  switch (cd)
  {
    case 1:  CDLO = PIN1LO; break;
    case 14: CDLO = PIN14LO; break;
    case 16: CDLO = PIN16LO; break;
    case 17: CDLO = PIN17LO; break;
  }
}

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;

       do{

             DlPortWritePortUshort(CONTROL, 0x20 | CDHI | WRHI | RDLO | CELO);
             Tmp = DlPortReadPortUshort(DATA);
             //DlPortWritePortUshort(BASE + 2, 0x20 + CEHI);
       }while ((Tmp & 3) != 3 );
       //DlPortWritePortUshort(BASE + 2, 0);
   
}

void WriteData(USHORT Data)
{

    WaitDisplayReady();
   
    DlPortWritePortUshort(DATA, Data);
    // DlPortWritePortUshort(CONTROL, CDLO);
    // DlPortWritePortUshort(CONTROL, CDLO | WRLO | RDHI );
    DlPortWritePortUshort(CONTROL, CDLO | WRLO | RDHI | CELO);
    DlPortWritePortUshort(CONTROL, CDLO | WRLO | RDHI | CEHI);
    // DlPortWritePortUshort(CONTROL, CDLO);
   
}

void WriteCtrl(USHORT Command)
{

    WaitDisplayReady();

    DlPortWritePortUshort(DATA, Command);
    // DlPortWritePortUshort(CONTROL, CDHI);
    // DlPortWritePortUshort(CONTROL, CDHI | WRLO | RDHI );
    DlPortWritePortUshort(CONTROL, CDHI | WRLO | RDHI | CELO);
    DlPortWritePortUshort(CONTROL, CDHI | WRLO | RDHI | CEHI);
    // DlPortWritePortUshort(CONTROL, CDLO);      
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 14:45 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
floppes wrote:
I was using LCDInfo version 0.3.1 and currently I am using 0.3.2.

It may very well be some code change as there were quite many of them between these versions. We'll have to see what happens when I have this new code included in LCDInfo.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 16:38 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
I have now used your new WaitDisplayReady, WriteData and WriteCtrl function. They work much better, although there are still very small errors.

Here are some new pics:
It should look like this:
Image

but this is displayed:
Image

I used different delays but the result was always the same.
With this graphic it doesn't matter if I run the loop form 0 to 4 or from 1 to 5.

Those new functions work, which means that the wiring

// powerlcd
int wr=16;
int rd=14;
int cd=17;
int ce=1;

must work. I uncommented the lines in the functions which you commented. If I don't, the WaitDisplayReady function hangs in an endless loop.

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 17:12 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Argh, just lost one hour worth of changes (new wiring setup + other things) to the LCDInfo configuration program. :evil:

I can't say at the moment what's wrong for you but I'll think about it.

Would you mind posting your VB versions of the new functions ? Would be nice to see how they look like and someone else might find them useful also.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 17:56 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
Sorry, I coulnd't answer so fast. I had to eat ;)

Maybe the program you sent me doesn't work because the lines I uncommented are commendted there.

Here is my code:

Code:
Public Sub WriteCommand(intCommand As Integer)

Call WaitDisplayReady

Call DlPortWritePortUshort(intBase, intCommand)
Call DlPortWritePortUshort(intBase + 2, 0) 'CDHI
Call DlPortWritePortUshort(intBase + 2, 0) 'CDHI | WRLO | RDHI
Call DlPortWritePortUshort(intBase + 2, 1) 'CDHI | WRLO | RDHI | CELO
Call DlPortWritePortUshort(intBase + 2, 0) 'CDHI | WRLO | RDHI | CEHI
Call DlPortWritePortUshort(intBase + 2, 8) 'CDLO

End Sub


Public Sub WriteData(intData As Integer)

Call WaitDisplayReady

Call DlPortWritePortUshort(intBase, intData)
Call DlPortWritePortUshort(intBase + 2, 8) 'CDLO
Call DlPortWritePortUshort(intBase + 2, 8) 'CDLO | WRLO | RDHI
Call DlPortWritePortUshort(intBase + 2, 9) 'CDLO | WRLO | RDHI | CELO
Call DlPortWritePortUshort(intBase + 2, 8) 'CDLO | WRLO | RDHI | CEHI
Call DlPortWritePortUshort(intBase + 2, 8) 'CDLO

End Sub


Dim lngTmp As Long

Do
    Call DlPortWritePortUshort(intBase + 2, 39)    '0x20 | CDHI | WRHI | RDLO | CELO
     intTmp = DlPortReadPortUshort(intBase)

    Call DlPortWritePortUshort(intBase + 2, 32) '0x20 + CEHI

Loop While (intTmp And 3) <> 3

Call DlPortWritePortUshort(intBase + 2, 0)

End Sub


I have already calculated the values to make the program a little faster. I know this is bad programming if I want to support different displays later, but first I'd like to get my one working :)

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 18:46 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
floppes wrote:
Sorry, I coulnd't answer so fast. I had to eat ;)

Hmm, I'm not sure what you meant with this. We're you referring to the changes lost comment or ... ? I lost the changes because I was stupid enough to click a wrong button. But now I remade the changes, it took only 30 minutes this time. ;)

Quote:
Maybe the program you sent me doesn't work because the lines I uncommented are commendted there.

Maybe, I'll test it some more with different wirings.

Quote:
I have already calculated the values to make the program a little faster. I know this is bad programming if I want to support different displays later, but first I'd like to get my one working :)

I guess it's easier that way :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 19:06 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
Henri wrote:
Hmm, I'm not sure what you meant with this.


I meant that I am sorry for you because you lost one hour with changing somethin in LCDInfo. And I thought that was because I first told you, that your program does not work, but then later the code worked with a few changes (uncommenting the lines).

Here is the status of my program (maybe I should say your program, most of the code comes from you ;) ):
- Initialization works fine
- Displaying text works fine
- Clearing text works fine
- Displaying individual pixels works, but the position is incorrect (I wrote a function that moves the pixels to the correct position, but every 12th line is blank)
- Displaying a bitmap in block-mode works very good, except for the few pixels that are set wrong as I showed earlier today
- Clearing graphic works fine

When I display a graphic which fills the whole display, in the lower part strange characters appear. They are overwritten by the graphic, but they are still visible at places where the graphic has a white pixel.
Could this be a problem with RAM addressing?

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 20:15 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
floppes wrote:
When I display a graphic which fills the whole display, in the lower part strange characters appear. They are overwritten by the graphic, but they are still visible at places where the graphic has a white pixel.
Could this be a problem with RAM addressing?

This could be because some RAM areas are overlapping or something like that.

You could try changing the G_BASE 0x0200 and T_BASE 0x000 addresses. For example G_BASE to 0x300.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 21:48 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
Yes, it works! Now my G_BASE starts at 0x300.

But I experienced some other strange things:
I had my PC switched off for about an hour and now LCDInfo works perfect. But my program still has the same errors. And the WaitDisplayReady function hangs in an endless loop with the new code.

How does LCDInfo initialize the display and how does it wait for the LCD?

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 23:00 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Because you are using the powerlcd wiring LCDInfo doesn't use any busy flag checking in the current versions. This will however change in the next one (unless there will be some unexpected problems).

The following code is from LCDInfo
Code:
// settings for 128x128 6x8 font
charactercount = 336;
bytecount = 2731;
G_BASE = 0x0300;
BYTES_PER_ROW = 21;
font_width=6;

void cT6963C::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 cT6963C::ClearLCDText(void)
{
  int i;

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

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

void cT6963C::ClearLCDGraph(void)
{
  int i;

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

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


btw. have you noticed that you can download the LCDInfo v0.3 source code from the download page ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 02, 2003 23:28 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
So it doesn't wait in any way... but sometimes it displays everything correct :)

You are right, I didn't see the source code for download. I'll install C++ Builder tomorrow and then try to fix my problems with the help of your code.

Cu tomorrow and thanks a lot for your great help! :) I'll be out now 8)

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 27, 2003 18:47 
Offline

Joined: Mon Dec 30, 2002 18:10
Posts: 27
Location: Darmstadt, Germany
I'm still alive ;) and played around with various other LCD software. But they all did not work well.

One of my friends has the same display that I have, and today he sent me his LCDInfo directory and now LCDInfo works perfectly with my display. No more shifted lines, no missing characters! :o

It is version 0.3.2 NT. The exe files are identical, I checked this with Windiff (it compares files bit by bit). The only difference I noticed was the CheckBusyFlag entry. In my config it was set to 0, and in my friend's config it is set to 1.

Does this mean busy-flag checking works in 0.3.2 with the T6963C?

Anyway, it is great to see LCDInfo work! :)
I only have some problems with the NT performance counters:
I added several counters and named them with pdh_ at the beginning. But when I run LCDInfo, it displays "PdhCollectQuery error" in the status bar. When I use them in my screens, 6 error messages pop-up, saying that a page fault has occured.
Do you know how to solve this? I am using Win XP and have administrative rights.

Greets,

Flo

_________________
The answer to all questions is 42


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 27, 2003 20:50 
Offline

Joined: Sun May 05, 2002 22:05
Posts: 2063
Location: Lappeenranta, Finland
Discussion about LCDInfo continues here: http://www.skippari.net/phpBB2/viewtopic.php?p=750#750 :wink:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 30, 2003 2:10 
Henri wrote:
If it hangs it is a sign that the code isn't right. You could try adding some delay in place of the statuscheck before I figure out how the status check works.

This is from Yarvieh (the maker of LCDStudio) and it can be used to create small delays. I'm not sure how easy it is to convert to visual basic but I'm sure it has some way to create delays.

Code:
void MicroDelay(long microseconds)
{
  LARGE_INTEGER liFreq;
  LARGE_INTEGER liCnt;
  LARGE_INTEGER liStart;
  LONGLONG ticksPerMilliSec = 0;

  if ( QueryPerformanceFrequency(&liFreq) )
  {
    ticksPerMilliSec = (liFreq.QuadPart)/1000000;
  }
  else
  {
  // MessageBox(NULL,"Error obtaining frequency\n",0,NULL);
  }

  if ( QueryPerformanceCounter(&liStart) )
  {
    do
    {
      QueryPerformanceCounter(&liCnt);
    }while ((liStart.QuadPart + (__int64)(ticksPerMilliSec * microseconds)) > liCnt.QuadPart);
  }
}


The font_widht is what you thought. It should be 6 if used with 6x8 font.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 13 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:  
Powered by phpBB® Forum Software © phpBB Group