Page 1 of 1
help with commards on lk202-25 serial display
Posted: Fri Oct 31, 2008 10:03 am
by ls78
hey there .
im trying to send commards ect such as clear to my display from visual basic . i can send text ok . But i cant seem to work out how to use the commard functions. im not sure what the sytax is. Im am confused from the data sheet.
i have been using hyperterm to test things .
please could someone give me an example of sending commards to display via hyperterm ect . or even better a vb snipet .
clear display or turn backlight off and on ect something simple .
any help would be great
cheers .
luke
Posted: Fri Oct 31, 2008 10:18 am
by Ray
Are you using vb.net or vb6?
Posted: Fri Oct 31, 2008 10:43 am
by ls78
hey thanks for your quick reply .
um i am using visual basic 2008 express .
Code: Select all
Dim display As SerialPort
'Creates and opens the serial port.
display = New SerialPort("COM1", 19200, Parity.None, 8, StopBits.One)
display.Open()
display.Write("hello")
display.Close()
End Sub
like i said i can sent txt but it just wraps from row to row .
i just want to work out the commards to
simply clear the display
write to row 2 ect
any ideas ?
cheers luke
Posted: Fri Oct 31, 2008 10:52 am
by Ray
Well once you get that far its not that hard, for clear screen for example the manual tells you
6.1.2 Clear display (254 88)
This command clears the display and resets the text insertion point to the top left of the screen.
so the following code should do the trick
Dim ClearScreen As Byte() = {254, 88}
Display.Write(ClearScreen, 0, ClearScreen.Length)
Posted: Fri Oct 31, 2008 11:52 am
by ls78
yeah that does work , thanks very much for your help
cheers
luke
Posted: Sun Nov 02, 2008 6:41 am
by ls78
theres just one more thing i would like to be able to do ,,,
is it posssible to get the button presses from my lcd panel ?
if so how can i do it with reference to my code i supplied above ?
cheers again .
luke
Posted: Mon Nov 03, 2008 7:09 am
by Ray
You would use Display.Read and check the return value to see which key was pressed.
Posted: Wed Nov 12, 2008 6:46 am
by Phutisarn
Hi all,
I'm new to the Serial port communication. I tried out your coding style with a few adjustments for Visual C++ and it works. Below is my code
array<System::Byte>^ code = {0xFE, 0x46};
this->port->Open();
this->port->Write(code, 0, code->Length);
this->port->Close();
However there seems to be a bit slower compare to MOGD program.
I tried to use portmon to check what is happening.
MOGD# sends 2 lines of data but my program sends at least 10 lines.
Is there any thing wrong with my code? or should I find another way to send data over? Please advise.
Truly appreciated,
Posted: Wed Nov 12, 2008 7:08 am
by Ray
mogd# is written in C# so is using the same serial port class you are, here's the code that opens the port and sets it up
Code: Select all
_Port = new SerialPort(comPort,speed);
_Port.Handshake = System.IO.Ports.Handshake.None;
_Port.ReceivedBytesThreshold = 1;
_Port.WriteBufferSize = 16;
_Port.Open();
Posted: Wed Nov 12, 2008 7:17 am
by Phutisarn
Thank you very much Ray. I will check the code and implement it to my program.
My apology for putting the incorrect information in the previous post. I was using MOGD not the MOGD#. I just found the new version and it seems to have a bit of delay just like my program too.
Is there a significant different between two programs? Please advise.
Thanks again for your quick reply.
Posted: Wed Nov 12, 2008 7:23 am
by Ray
MOGD# is a newer version that supports many of our newer displays and upload protocols.