Page 1 of 1

New Project: Windowing Library - Problem 1

Posted: Wed Dec 10, 2003 1:44 pm
by effin_hard
This is in regards to the GLK24064-25 LCD.

I have written some routines to draw a series of rectangles / solid rectangles and this is what I have noticed:

The "Draw Solid Rectangle" (FE78) Routine is really slow. Any info you can give me on this?

Is this common across all your product line? Product of the PIC micro-controller (8mhz Right?)

Posted: Fri Dec 12, 2003 2:57 pm
by Miles
Hello...

Unfortunately this is a limitation between our firmware and the LCD. A bunch of different variables reduce the speed at which data can be processed on both ends. For the time being, this is the optimal speed...

Posted: Fri Dec 12, 2003 3:07 pm
by Miles
It could be faster to upload black block bitmaps and recall them where you need them. Have not tried this, but it does not need the math, so it might be quicker.

Major Issue with Flow Control....

Posted: Tue Dec 16, 2003 2:00 pm
by effin_hard
Im trying to get Flow Control To work on my LCD: GLK24064-25.
Up until today, I have had great success with it. I wrote a new algortihm to handle changing a delay(x); value based on the feedback from the Flow Control functionality: my algorithm works as follows:

Code: Select all

delay( delay );
SendMtxOrbCommand( cmd, data );
if (FlowControl())
{
   GetFCTRLRdbk( &rdbk );
   if (rdbk == highwater)
     hcount++;
    else
     lcount++;

if (hcount == x_level)
 increase_delay;
 hcount = 0;
 lcount = 0;

if (lcount == x_level)
 decrease_delay;
  lcount = 0;
  hcount = 0;
}
The problem isnt with the code, but for some reason, Im not getting any characters returned when I enable flow control. Theres nothing to read on the serial port. No characters are being returned to me to indicate FF or FE (empty / full). This is weird because everything was working yesterday? Do I need to reset something on the LCD? Have I done something inadvertantly?

Also, what would you reccomend I set the HighWater / LowWater mark too?
The LCD buffer is 96 bytes.

Posted: Wed Dec 17, 2003 8:07 am
by effin_hard
Hard for me to determine what the problem was, but in order to rectify it I had to perform the manual override procedure.

*shrug

More Flow Control Fun...

Posted: Wed Dec 17, 2003 8:54 am
by effin_hard
Its a little difficult for me to debug a proper implementation of this software flow control. Let me make sure I have this described correctly.

1.) The buffer on the LCD is 96 Bytes
2.) If I Enable Software Flow Control the Following will happen:
a.) If the buffer has only [FULL] Bytes remaining the LCD will return an 0xFE character.
b.) If the buffer has only [EMPTY] Bytes remaining the LCD will return an 0xFF character.
3.) Thus, if I wanted to maintain my buffer, I would want to set the following.

Code: Select all

BUFFER: 96 BYTES
0-----------------------------96
[=======E=============F========]
  (empty point)   (full point)
  (76 bytes left) (30 bytes left)

E = 96-20 (76)  (point at which FF character will be sent (76 Bytes Free)
F = 30 (point at which FE will be sent (30 bytes Free))
so the message I send to enable flow control would be:
FE 3A (1E) (4C)

Is there code anywhere I can look at for an implementation of flow control? What do you reccomend I do when the buffer is in the FULL Region?.

Posted: Wed Dec 17, 2003 3:00 pm
by Miles
OS: N/A
Programming Language: C
Compiler: n/a
Display: Any Display with flow controll

This example is for displays that use flow controll (software handshaking)

CODE:

//
// display class
//
// Contains methods for writing the display.
//

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <termios.h>
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/ioctl.h>

#include "global.h"


int fdDisplay;

BOOL displayOpen()
{

struct termios settings;

// open port
//
fdDisplay = open("/dev/ser1", O_RDWR);
assert(fdDisplay > 0);


// set baudrate, XON/XOFF
//
tcgetattr(fdDisplay, &settings);
settings.c_ospeed = B19200;
settings.c_ispeed = B19200;
settings.c_cc[VSTART] = FLOW_EMPTY;
settings.c_cc[VSTOP] = FLOW_FULL;
// settings.c_iflag |= IXOFF; // don't use this flag
settings.c_iflag |= IXON;
tcsetattr(fdDisplay, TCSANOW, &settings);

displayFlowOn();

return TRUE;

}


void displayFlowOn()
{

unsigned char cmd[16];

cmd[0] = 254;
cmd[1] = 58;
cmd[2] = 32; // at 32 bytes, send 'full'
cmd[3] = 16; // down to 16, send 'empty'
displayWrite(cmd, 4);

}


void displayWrite(unsigned char *buf, int len)
{

write(fdDisplay, buf, len);

}





OUTPUT:

None to display, and empty or full command back to host.

Thanks to Steve Wagner for this example

Posted: Thu Dec 18, 2003 11:47 am
by effin_hard
Yeah, thats what my intialisation code looks liek already, but as I said, somehow the LCD got into a state where I would be in FLow Control Mode, and no Flow Control Bytes (FE / FF) were being returned, getting me stuck on a blocked read. In order to rectify the situation I had to "Manually Ovveride" the LCD settings (using the jumper), my software worked fine after that.

My question would be specific too handling a "flow control" return code of "Near Full". What would you reccomend the application do? Delay for a certain time? That time would be dependant on what operations you were trying to perform. If I filled up the buffer with "SOLID RECT" commands that filled the screen, those are lengthy operations, and my delay would have to scale to handle that.

Im only running the LCD at 19200 right now, but even then I notice a slow down if I run full speed, even with a 50ms delay between calls, the LCD can slow down dramatically.

Im getting aroudn it, but, I was jsut wondering if someone has come across / solved the problem already with a hardened implementation of Flow Control.