Page 1 of 1
Uploading a bmp file into a GLK12232-25-SM
Posted: Wed Jun 30, 2004 7:46 am
by shasson
Hi,
I was wondering if anyone had any example of uploading a bitmap into an LCD (specifically a GLK12232-25-SM ) in pseudo code or real code? Or even if there was a complete transfer explained byte by byte for a small bitmap?
I have been trying to upload a bitmap file into my LCD from my own C code without any success. The LCD appears to be echoing the data I have sent to it okay as I go along (as expected), but when finished, the bitmap does not get displayed.
Thanks.
Scott
Posted: Wed Jun 30, 2004 11:42 am
by Miles
Do you have to load it this way or can you create a bitmap and load it using mogd.exe...? I'll see what I can dig up code wise...

Can you show me your code...?
Another question about bitmaps
Posted: Wed Jun 30, 2004 11:44 am
by shasson
Hi,
I have another question about bitmaps.
In the GLK12232-25-SM manual there is talk of writing "inline" bitmaps which I assume is writing bitmaps directly to the LCD without saving them to memory. Is there a different command for this? If so what is it? It doesn't seem to be explained anywhere else in the manual.
Thanks.
Scott
Current Pseudo-Code
Posted: Wed Jun 30, 2004 12:12 pm
by shasson
Hi,
I can give you my code in pseudo form:
unsigned char byteCount = 0x08;
unsigned char fileBytes[byteCount];
unsigned char lowByteCount = byteCount;
unsigned char highByteCount = 0x00;
unsigned char confirmEcho = 0x01;
fileBytes[0] = 0xFF;
fileBytes[1] = 0xFF;
fileBytes[2] = 4;
fileBytes[3] = 8;
fileBytes[4] = 0x55; // see below WBWBWBWB
fileBytes[5] = 0x55; // see below WBWBWBWB
fileBytes[6] = 0xAA; // see below BWBWBWBW
fileBytes[7] = 0xAA; // see below BWBWBWBW
SerialPort.Write(254); //instuction indicator
SerialPort.Write(36); //upload bitmap instruction
SerialPort.Write("1"); //place in position 1
SerialPort.Read(readVal); //returns "1", echoing the first position to use
SerialPort.Write(confirmEcho); //confirm that we received the echo correctly
SerialPort.Write(lowByteCount); //the low half of the byte count for the file
SerialPort.Read(readVal); //returns lowByteCount value
SerialPort.Write(confirmEcho); //confirm that we received the echo correctly
SerialPort.Write(highByteCount); //the high half of the byte count for the file
SerialPort.Read(readVal); //returns highByteCount value
SerialPort.Read(readVal); //returns that the file will fit in the space
for(int i = 0; i < byteCount; i++)
{
SerialPort.Write(fileBytes);
//write the first byte of the file
SerialPort.Read(readVal); //returns the byte just written
SerialPort.Write(confirmEcho); //confirm that we received the echo correctly
}
As you can see I am not ensuring in code that the correct values are returned before proceeding, but I have stepped through my code and all the correct values (the values I have just written) are echoed back to myself, that is why I am unsure what I am doing wrong. With the data that I sent I would expect to see the following on screen when the LCD is turned on (since position 1 is used to show a bitmap when the screen is turned on), W=blank, B=black:
WWBB The rest would be white space... Right?
BBWW
WWBB
BBWW
WWBB
BBWW
WWBB
BBWW
Any thoughts?
Also, please check out my other reply post concerning putting a bitmap on the screen inline or "on the fly", rather than storing it in memory. Is that possible?
Thanks.
Scott
Can I upload it using the mogd.exe program?
Posted: Thu Jul 01, 2004 1:40 pm
by shasson
Hi,
I noticed I did not answer your question of whether I needed to upload bitmaps in the manner that I discussed.
If there was an executable that I could use to upload the bitmaps from the command line I could use that, otherwise, I need to be able to upload a bitmap myself or write my own executable to do so.
For example, I need an executable that could upload bmp files in the following manner:
c:\Matrix Orbital\mogd.exe BMP UPLOAD 1 companyLogo.bmp
I don't think your executable (mogd.exe or LCDTester.jar) or anything you provide has that capability right? They all have a gui requiring user intervention.
Please let me know what you think.
Thanks.
Scott
Posted: Mon Jul 05, 2004 4:23 pm
by Miles
Unfortunately Mogd.exe does not have the ability to be run from an executable line. It must have user intervention. As for "inline" bitmaps, I'll have to get more information for you on how this works correctly. From your code you have shown me, it appears your approach of loading a bitmap it should be working fine...I'll see if I can did up some example code for you to compare...

The most important thing involved in file exchange is that everything is echoed accordingily. The module will store the data, then read it back from memory and send the read value back to the host. If the host system receives an incorrect echo, it should send status as 0x08 instead of 0x01. This will terminate the transfer.