Page 1 of 2

Posted: Mon Feb 18, 2002 10:46 pm
by whookey
I'm trying to negotiate bitmap transfers to my GLK12232-25 in linux. The system I installed the display in doesn't run Windows. I've modified the connectors, and it's really a tough to extract mounting job, so I hope I don't have to go back to a windows machine for mogd.exe. I couldn't seem to get the handshaking working, so I tested the "Read NN Number" commands, 254 [53,54,55]. When I issue "254 55", nothing comes back across the serial device, but a dollar sign ('$') appears on the display. Is this correct? I'm fairly sure the Rx line is still connected, but I'll recheck when I can get the box open again.

But the text display and graphics drawing commands work great!

Thanks!

Posted: Thu Feb 21, 2002 12:39 pm
by Henry
Double check your cabling... try using a hyperterminal style program to see if you can get keystrokes sent back to you, this will test back and forth comunication.

_________________
Henry J.
Technical Support
Matrix Orbital

<font size=-1>[ This Message was edited by: Henry on 2002-02-21 12:45 ]</font>

Posted: Thu Feb 21, 2002 10:25 pm
by Thlayli
I'm a bit confused about what you're doing, you're coding a new program, right? What language? Perl would rock if you're doing what I think you're doing =) You could just open FILE "dev<insert device here>"; and read directly from it for responses, how cool is that =)Ok, so I think programming languages are cool, so what.

Posted: Fri Feb 22, 2002 11:12 am
by whookey
Right now I'm just trying to upload bitmaps, and come up with some linux tools to do the bitmap conversion and file transer (like pngtopnm <file> | pnmtomobmp | mo_upload -N 2 ). I've found lots of perl/python libraries for text LCD manipulation, but now the world needs my forthcoming python graphic LCD library. :smile: Right now I've just got a simple perl script which makes it easy to send commands to the LCD, such as "lcd 88" to clear the display.

Posted: Fri Feb 22, 2002 11:27 am
by Henry
Do you want some C/C++ sample code for uploading?

Posted: Fri Feb 22, 2002 12:30 pm
by Thlayli
Heh, being that I absolutely love perl I could code that for you if you'd like, but I wouldn't be able to give a definate guarentee that it works since I was cheap and didn't get a graphic one *cry*

word of advice if you're buying one of these: just buy the expensive one or you'll regret it later =)

Posted: Fri Feb 22, 2002 12:39 pm
by Henry

Posted: Fri Feb 22, 2002 12:39 pm
by Henry
hehehehehehe

Posted: Sat Feb 23, 2002 11:26 pm
by whookey
Examples would be grrreat! As mentioned in the hardware forum, i'm happily talking with the little guy now, e.g. (254,55) returns the correct model type (0x24).
I've been having trouble with bitmap uploading. I'm following the protocol example for font uploads (I've gone through the initial steps of font uploading to reference #3, (254,36,3) and things seem happy, I get an echo from the module "0x03" as the documentation says). When I try the same for bitmaps (254,110,2), I don't get an echo, so can't continue with the uploading process.
Help?

Thanks!

Posted: Sun Feb 24, 2002 5:50 pm
by Henry
I'll post source tomorow morning..

Posted: Mon Feb 25, 2002 1:36 pm
by Henry

Code: Select all


void __fastcall TForm1::BitBtn4Click(TObject *Sender)
{
  TCanvas *pCanvas = Image1->Canvas;
  char BitCounter = 0;
  unsigned char dat, HSval;
  unsigned short int Size16;
  float Size;

  if (BRSmode)
  {
    ZComm1->WriteCommByte(0xfe); // Leave Buffer Return Status Mode
    ZComm1->WriteCommByte(';');
    BRSmode = false;
  }

  int Len;

  // Send the Command and preamble
  ZComm1->WriteCommByte(0xfe);  // Command prefix
  ZComm1->WriteCommByte('^');   // Upload Bitmap command
  dat = CSpinEdit1->Value;      // Retrieve the reference number from the user

  ZComm1->WriteCommByte(dat);   // Send Reference Number
  while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
  if (dat != HSval)
  {
    ShowMessage("Error in transmission - 1");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  if (CheckBox1->Checked)
    Size = Image1->Width * Image1->Height; // number of pixels in image
  else
    Size = Image1->Picture->Width * Image1->Picture->Height; // number of pixels in image

  if (fmod(Size,8)) // Does the data need to be padded?
  {
    Size /= 8;      // Calculate number of whole bytes
    Size++;         // add one for padding
  }
  else
    Size /= 8;      // Calculate number of whole bytes

  // Size at this point still includes fraction
  Size16 = Size; // cheesy conversion to 16 bit value
  Size16 += 4;  // This is to add the header info
  dat = Size16 & 0x00ff; // Low byte - too lazy for pointers
  ZComm1->WriteCommByte(dat);   // Send Low part of size

  while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
  if (dat != HSval)
  {
    ShowMessage("Error in transmission - 2");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  dat = Size16 / 256; // high byte - mmmm cheesy!
  ZComm1->WriteCommByte(dat);   // Send High part of size
  while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
  if (dat != HSval)
  {
    ShowMessage("Error in transmission - 3");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }

  while (!ZComm1->ReadComm(&HSval,1)); // Wait for status from LCD
  if (HSval != 0x01)
  {
    ShowMessage("Error in transmission - 4");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }

  ZComm1->WriteCommByte(0xff);   // Send First byte of spacer
  while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
  if (HSval != 0xff)
  {
    ShowMessage("Error in transmission - 5");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  ZComm1->WriteCommByte(0xff);   // Send second byte of spacer
  while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
  if (HSval != 0xff)
  {
    ShowMessage("Error in transmission - 6");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  ZComm1->WriteCommByte((unsigned char)Image1->Picture->Width);// Send X size of bitmap
  while (!ZComm1->ReadComm(&HSval,1));      // Wait for return from LCD
  if (HSval != (unsigned char)Image1->Picture->Width)
  {
    ShowMessage("Error in transmission - 7");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  ZComm1->WriteCommByte((unsigned char)Image1->Picture->Height);// Send Y size of bitmap
  while (!ZComm1->ReadComm(&HSval,1));      // Wait for return from LCD
  if (HSval != (unsigned char)Image1->Picture->Height)
  {
    ShowMessage("Error in transmission - 8");
    ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
    return;
  }
  ZComm1->WriteCommByte(0x01);  // Confirm Echo

  for (int x = 0; x < Image1->Picture->Width; x++)
  {
    for (int y = 0; y < Image1->Picture->Height; y++)
    {
      if (!pCanvas->Pixels[x][y])
      {
        // Black Pixel
        dat |= Bits[BitCounter];
      }

      if (BitCounter == 7)
      {
        // send the byte now that it is full

        ZComm1->WriteCommByte(dat);  // Send data
        while (!ZComm1->QCountIn);   // Wait for return from LCD
        ZComm1->ReadComm(&HSval,1);
        if (HSval != dat)
        {
          ShowMessage("Error in transmission - 9");
          ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
          return;
        }
        ZComm1->WriteCommByte(0x01);  // Confirm Echo
        BitCounter = 0;
        dat = 0;
      }
      else
        BitCounter++;
    }
    float progress = ((float)x/(float)Image1->Picture->Width)*100+1;
    ProgressBar1->Position = progress;
  }
  if (BitCounter) // There is a little left over
  {
    ZComm1->WriteCommByte(dat);  // Send data
    while (!ZComm1->ReadComm(&HSval,1)); // Wait for return from LCD
    if (HSval != dat)
    {
      ShowMessage("Error in transmission - 10");
      ZComm1->WriteCommByte(0x08);  // Send bad confirmation just in case
      return;
    }
    ZComm1->WriteCommByte(0x01);  // Confirm Echo
  }
}

This is for a font upload

Posted: Tue Feb 26, 2002 11:35 pm
by whookey
I think you meant "..is for bitmap upload."?

Though I see something I've been worried about:

<CODE>ZComm1->WriteCommByte('^'); // Upload Bitmap command</CODE>

Shoot, my original topic was incorrect, I have a GLK 12232-25SM (which gets a 0x24 back from (255,55)), not a 1223225, but according to the manuals for each module, the commands for bitmap upload are the same, 110 decimal, (or 'n' ascii). '^' in your code above is 94 decimal! The other day I was paging through the manuals for some other modules, and noticed at least one of them (can't recall which) used 94 for bitmap upload, so I tried it, and got an echo back as expected.

Please check the online manuals (110 is listed on my CD as well) and get back to me, so I can scream if I've been using the wrong command all along.

Thanks.

Posted: Thu Feb 28, 2002 9:02 am
by whookey
I've successfully uploaded a bitmap, using command 94. (!!yay! look for screenshots in the near future). <B> The manuals should be updated </B> to ensure that no one else wastes time using 110 like I did. Are there printed copies (of the updated version!) available? Are there other errata to watch out for?

Posted: Fri Mar 01, 2002 2:21 pm
by Henry
You are correct on the error.. I will fix it up ASAP, thanks for the heads up. There are no other hidden commands or features in the display, the reason why we haven't documented the 0x99 command is that it's not present in the GLK12232-25 but is in the GLK12232-25-WBL and GLK12232-25-SM. We are replacing the GLK12232-25 with GLK12232-25-WBL so we were keeping the command out of it until we finished phasing out the display.

Posted: Tue Mar 05, 2002 2:56 pm
by specialk
YES!
I FINALLY UNDERSTAND HOW TO UPLOAD BITMAPS! OMG, I AM SOOO HAPPY! I know it may seem corny, but I *just* figured out how to upload bitmaps... this will make programs *much* easier to work with (know how with my winamp program you had to upload each file? no more!)
:smile: :smile: :smile:

-special [k]