Java source code
Java source code
I have already emailed MO support about this, and I was emailed some C source code - useless
the java source file linked in the thread above is DEAD.
I have searched for hours and I need someone to help!!!
the java source file linked in the thread above is DEAD.
I have searched for hours and I need someone to help!!!
Hi Spamzor,
Can you please contact me at myero@matrixorbital.ca and I'll see what I can find and send it to you ASAP. I apologize for the delay...
Can you please contact me at myero@matrixorbital.ca and I'll see what I can find and send it to you ASAP. I apologize for the delay...

Miles Y.
Head of Technical Support
Product Manager
Matrix Orbital
Head of Technical Support
Product Manager
Matrix Orbital
I emailed you and I got an email back telling me to look at the javelin source,Miles wrote:Hi Spamzor,
Can you please contact me at myero@matrixorbital.ca and I'll see what I can find and send it to you ASAP. I apologize for the delay...
that does not help!
I am not programming through javelin??
Hi Spamzor,
Sorry for any late replies. I had to look all over for a java sample. Here it is below. This program will take keypad inputs and display them on the LCD.
/**
* LCDControl.java
*
* Author: Owen Langman (langman@cs.wisc.edu)
*
* Description:
* Basic commands to control a Matrix Orbital (we love MO!)
* LCD screen.
*
* NOTE: This requires the javax.comm package.
* Check java.sun.com
**/
import java.io.*;
import java.util.*;
import javax.comm.*;
/**
* Collection of methods to control a Matrix Orbital LCD.
*
* <p> Bugs: None known.
*
* @author Owen Langman (langman@cs.wisc.edu)
*
**/
public class LCDControl {
private CommPortIdentifier portId;
private SerialPort serialPort;
private OutputStream outputStream;
public static final char COMMAND_START = (char)254;
public static final char COMMAND_NULL = (char)0;
public static final char COMMAND_ETX = (char)3;
public static final char COMMAND_DEL = (char)253;
/**
* Constructor. Uses COM1 as the default port.
*
**/
public LCDControl() {
this(1); //uses com1 with default const.
}
/**
* Constructor. Initializes COM port and resets the LCD.
*
* @param port Interger specifying the COM port to output to.
**/
public LCDControl(int port) {
String portname = new String("COM");
portname += port;
try {
portId = CommPortIdentifier.getPortIdentifier(portname);
} catch (NoSuchPortException ex) {
System.out.println(portname + " does not exist.");
return;
}
try {
serialPort = (SerialPort)portId.open("LCDControl",2000);
} catch (PortInUseException ex) {
System.out.println("Could not open " + portname);
return;
}
try {
serialPort.setSerialPortParams(19200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException ex) {
System.out.println("Could not set serial stuff");
}
try {
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}
resetLCD();
}
/**
* Resets the lcd in every way possible.
*/
public void resetLCD() {
String resetString;
resetString = new String(COMMAND_START + "B" + COMMAND_NULL +
COMMAND_START + "~" + COMMAND_NULL + COMMAND_START +
"T" + COMMAND_START + "Y" + COMMAND_ETX +
COMMAND_START + "X");
try {
outputStream.write(resetString.getBytes());
} catch (Exception ex) {
System.out.println("Could not reset lcd");
}
}
/**
* Clears the LCD screen.
*/
public void clear() {
String clearString;
clearString = new String(COMMAND_START + "X");
try {
outputStream.write(clearString.getBytes());
} catch (Exception ex) {
System.out.println("Could not clear lcd");
}
}
/**
* Writes a string to the screen at the cursor's current
* position.
*
* @param str String to write to the screen.
*/
public void display_write(String str) {
try {
outputStream.write(str.getBytes());
} catch (Exception ex) {
System.out.println("Could not write to lcd");
}
}
/**
* Changes position of the lcd's cursor.
*
* @param x Horizontal index to move the cursor to
* @param y Line number to move the cursor to
*/
public void display_position(int x, int y) {
String displayString;
displayString = new String(COMMAND_START + "G");
try {
outputStream.write(displayString.getBytes());
outputStream.write(y);
outputStream.write(x);
} catch (Exception ex) {
System.out.println("Could not change cursor position on lcd");
}
}
/**
* Full clear then shutdown of the LCD
*/
public void display_close() {
String clearString, closeString;
clearString = new String(COMMAND_START + "X");
closeString = new String(COMMAND_START + "F");
try {
outputStream.write(clearString.getBytes());
outputStream.write(closeString.getBytes());
} catch (Exception ex) {
System.out.println("Could not close lcd");
}
}
}
Sorry for any late replies. I had to look all over for a java sample. Here it is below. This program will take keypad inputs and display them on the LCD.
/**
* LCDControl.java
*
* Author: Owen Langman (langman@cs.wisc.edu)
*
* Description:
* Basic commands to control a Matrix Orbital (we love MO!)
* LCD screen.
*
* NOTE: This requires the javax.comm package.
* Check java.sun.com
**/
import java.io.*;
import java.util.*;
import javax.comm.*;
/**
* Collection of methods to control a Matrix Orbital LCD.
*
* <p> Bugs: None known.
*
* @author Owen Langman (langman@cs.wisc.edu)
*
**/
public class LCDControl {
private CommPortIdentifier portId;
private SerialPort serialPort;
private OutputStream outputStream;
public static final char COMMAND_START = (char)254;
public static final char COMMAND_NULL = (char)0;
public static final char COMMAND_ETX = (char)3;
public static final char COMMAND_DEL = (char)253;
/**
* Constructor. Uses COM1 as the default port.
*
**/
public LCDControl() {
this(1); //uses com1 with default const.
}
/**
* Constructor. Initializes COM port and resets the LCD.
*
* @param port Interger specifying the COM port to output to.
**/
public LCDControl(int port) {
String portname = new String("COM");
portname += port;
try {
portId = CommPortIdentifier.getPortIdentifier(portname);
} catch (NoSuchPortException ex) {
System.out.println(portname + " does not exist.");
return;
}
try {
serialPort = (SerialPort)portId.open("LCDControl",2000);
} catch (PortInUseException ex) {
System.out.println("Could not open " + portname);
return;
}
try {
serialPort.setSerialPortParams(19200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException ex) {
System.out.println("Could not set serial stuff");
}
try {
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}
resetLCD();
}
/**
* Resets the lcd in every way possible.
*/
public void resetLCD() {
String resetString;
resetString = new String(COMMAND_START + "B" + COMMAND_NULL +
COMMAND_START + "~" + COMMAND_NULL + COMMAND_START +
"T" + COMMAND_START + "Y" + COMMAND_ETX +
COMMAND_START + "X");
try {
outputStream.write(resetString.getBytes());
} catch (Exception ex) {
System.out.println("Could not reset lcd");
}
}
/**
* Clears the LCD screen.
*/
public void clear() {
String clearString;
clearString = new String(COMMAND_START + "X");
try {
outputStream.write(clearString.getBytes());
} catch (Exception ex) {
System.out.println("Could not clear lcd");
}
}
/**
* Writes a string to the screen at the cursor's current
* position.
*
* @param str String to write to the screen.
*/
public void display_write(String str) {
try {
outputStream.write(str.getBytes());
} catch (Exception ex) {
System.out.println("Could not write to lcd");
}
}
/**
* Changes position of the lcd's cursor.
*
* @param x Horizontal index to move the cursor to
* @param y Line number to move the cursor to
*/
public void display_position(int x, int y) {
String displayString;
displayString = new String(COMMAND_START + "G");
try {
outputStream.write(displayString.getBytes());
outputStream.write(y);
outputStream.write(x);
} catch (Exception ex) {
System.out.println("Could not change cursor position on lcd");
}
}
/**
* Full clear then shutdown of the LCD
*/
public void display_close() {
String clearString, closeString;
clearString = new String(COMMAND_START + "X");
closeString = new String(COMMAND_START + "F");
try {
outputStream.write(clearString.getBytes());
outputStream.write(closeString.getBytes());
} catch (Exception ex) {
System.out.println("Could not close lcd");
}
}
}
Re: Java source code
Hi!
I'm looking for an example that send and receive commands or text from the LCD on JAVA but in Linux.
Can anybody help me?
Thanks!
I'm looking for an example that send and receive commands or text from the LCD on JAVA but in Linux.
Can anybody help me?
Thanks!
Re: Java source code
Hi Tharos,
Unfortunately, with so many programming languages and operating systems we don't have a demo for absolutely everything. I would recommend taking a look at our Linux Appnote to determine how to communicate to the display in a Linux environment, and then changing the required methods in the code above over to Linux.
Thanks,
Troy
Unfortunately, with so many programming languages and operating systems we don't have a demo for absolutely everything. I would recommend taking a look at our Linux Appnote to determine how to communicate to the display in a Linux environment, and then changing the required methods in the code above over to Linux.
Thanks,
Troy
Troy Clark
Design & Development
Matrix Orbital
Design & Development
Matrix Orbital
Re: Java source code
Thanks for your answers Clark!
Re: Java source code
My pleasure Tharos,
Once you do have your code up and running, don't hesitate to post a little snippet to guide fellow developers. And if you do have any questions, just ask.
Thanks,
Troy
Once you do have your code up and running, don't hesitate to post a little snippet to guide fellow developers. And if you do have any questions, just ask.
Thanks,
Troy
Troy Clark
Design & Development
Matrix Orbital
Design & Development
Matrix Orbital
-
- LCD?
- Posts: 2
- Joined: Thu Jul 11, 2013 9:26 am
- Location: Virginia, USA
GLK Java API
We developed a Java API for use with the GLK19264-7T-1U, which we've then used with a product running on Linux.
The API is now a public repo on github, and we'd like to see if other users out there find it useful, and hopefully want to contribute to refining and expanding the API. You can find it at github.com/daveosborne66/lcd
The API is now a public repo on github, and we'd like to see if other users out there find it useful, and hopefully want to contribute to refining and expanding the API. You can find it at github.com/daveosborne66/lcd
- Dave Osborne
@daveosborne66
@daveosborne66
Re: Java source code
Hi Dave,
Your contribution is greatly appreciated; the code appears extensive and well written, an amazing resource for anyone starting Matrix Orbital development in Java.
If possible, we'd love to add an entry for your products in our gallery section, if you have any info/images we could use please shoot me an email.
Thanks again,
Troy
Your contribution is greatly appreciated; the code appears extensive and well written, an amazing resource for anyone starting Matrix Orbital development in Java.
If possible, we'd love to add an entry for your products in our gallery section, if you have any info/images we could use please shoot me an email.
Thanks again,
Troy
Troy Clark
Design & Development
Matrix Orbital
Design & Development
Matrix Orbital