LK204-25 and Arduino Mega

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Jacqmaster
LCD?
Posts: 4
Joined: Mon Mar 08, 2010 1:21 am
Location: Pomona

LK204-25 and Arduino Mega

Post by Jacqmaster »

I just bought the LK204-25 and its default setting is RS232 mode.
I connected the LK204-Rx pin to Arduino Mega Tx1 (Serial1) and get 5V power from Arduino as well.
When power up the module, I can see the default startup screen.
But when I run the below tiny program, the result totally awkward.


void setup() {
Serial.begin(9600);
Serial1.begin(19200);
Serial1.flush();
}

void loop() {
if (Serial.available()) {
Serial1.print(Serial.read(), BYTE);
Serial.flush();
}
}

If I enter "a" from Arduino serial monitor, the LK204 LCD will display "0" on it.
Can someone help me out? :o

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

I suspect the Arduino is operating on TTL levels

Jacqmaster
LCD?
Posts: 4
Joined: Mon Mar 08, 2010 1:21 am
Location: Pomona

Post by Jacqmaster »

Ray wrote:I suspect the Arduino is operating on TTL levels
Thus, I just need to add MAX232 driver between Arduino and LK204 to converting the voltage level, am I right?

THanks,

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

If you have a steady hand you can also move the zero ohm resistors on the back of the module from rs232 to ttl.

Jacqmaster
LCD?
Posts: 4
Joined: Mon Mar 08, 2010 1:21 am
Location: Pomona

Post by Jacqmaster »

Ray wrote:If you have a steady hand you can also move the zero ohm resistors on the back of the module from rs232 to ttl.
Finally, I added one MAX202 circuit and it works greats. But I got another while connecting to a 4x4 keypad. When I short R1-C1, the LCD will display 246, R1-C2 =>61.
How can get read the keypad map such as R1-C1=>A, R1-C2=>B

Raquel
Matrix Orbital
Matrix Orbital
Posts: 796
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi Jacqmaster,

It sounds like somehow the EEPROM in your display module has been corrupt. By default, the keys should be transmitting those that are depicted in the tables on page 40 of the manual.

By using Assign Keypad Code command (254 / 213) you should be able to assign any values that you want the display to transmit when certain key combinations are shorted (depressed). See section 9.9 of the manual.

I hope this helps,
Raquel Malinis
Design and Development
Matrix Orbital

Jacqmaster
LCD?
Posts: 4
Joined: Mon Mar 08, 2010 1:21 am
Location: Pomona

Post by Jacqmaster »

Raquel wrote:Hi Jacqmaster,

It sounds like somehow the EEPROM in your display module has been corrupt. By default, the keys should be transmitting those that are depicted in the tables on page 40 of the manual.

By using Assign Keypad Code command (254 / 213) you should be able to assign any values that you want the display to transmit when certain key combinations are shorted (depressed). See section 9.9 of the manual.

I hope this helps,
May I ask one newbie question. In Arduino, I have to send separate commands in order to achieve the execution. for example,

Serial.print(254, BYTE);
Serial.print(213, BYTE);

but now I am not sure to issue command correctly.

Serial.print("ABCDEFGHIJKLMNOPQRSTUVWXY");

or some other formats.

Thanks,

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Jacqmaster,

Text will be sent out to the serial port in the same way as commands. I'm not familiar with the Arduino language but you might try sending ('A', BYTE). If that fails you may be down to looking up values, such as (65, BYTE), I find ascii-table.com can help there.

To make things a little easier, you may be able to go with an array, something like BYTE mydata [2] = {254, 213}; and throw the serial.print into a for loop to spit out the bytes one by one.

Anyway, you may want to sift through our app notes on the matrixorbital.ca site for a little inspiration, and feel free to throw up another post if you get hung up again.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital

Post Reply