I2C and BLK 202A-WB

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

Moderators: Henry, Mods

Post Reply
ravton
LCD!
Posts: 12
Joined: Fri Oct 05, 2001 6:00 pm

Post by ravton »

I'm having some trouble using the BLK 202A-WB with my embedded design over i2c. The LCD display itself seems to work great, but the keypad isn't working as expected. I've tried many different things now and have had limited success. The documention is very poor on the i2c interface interaction.

Here's what I'm seeing:
1) When polled for keypresses by doing an I2C read, the characters are not what the documentation says. This is what I get (in decimal)
Up arrow: 36
Left: 39
Right: 34
Down: 37
Enter: 36
F2: 38
F1: 39
Please note that the Enter, F2 and F1 keys are the same as some of the arrow keys.

2) When trying to use KeyDown/KeyUp repeat mode, there is no change. I still get the previous results, with no extra notification when a key is released.

3) Multiple key presses are ignored. Contrary to what the documentation says, I never see the returned value with the high bit set when I press multiple keys within the polling period.

Anybody have any ideas?

Aniso
-=Beloved by all=-
-=Beloved by all=-
Posts: 286
Joined: Tue Aug 14, 2001 6:00 pm
Location: ...I could tell you my velocity...

Post by Aniso »

You are correct - that is not what you should be seeing. Please endeavor to try the same sort of thing with RS-232 first to make sure that the values that the unit is TRYING to send back are as expected. If so, then you can try to discover why you are not getting that. The RS-232 and I2C use exactly the same buffer for storing keys ready for transmission.

Do you at least get the zero code correctly for no keys pressed?

Maybe send a little code snip to Henry if you think it makes sense to do so (bearing in mind that he does not know your processor probably).

ravton
LCD!
Posts: 12
Joined: Fri Oct 05, 2001 6:00 pm

Post by ravton »

Sorry, I meant to add that to my post. It works perfectly with RS232, with the device returning values in the published range ('A' on up).

I do get 0 back when no keys have been pressed.

This is hooked up to an AVR ATMEGA163 microcontroller. The code is pretty basic:
if(i2c_start()) { //make sure bus is free
i2c_write(0x51);
cKey = i2c_read(0);
i2c_stop();
}
//The 0 on the i2c_read() means not to send an ACK. I've tried both sending and not sending an ACK with no difference.

The i2c routines are part of a library that came with the CodevisionAVR compiler. There's no known bugs with them and I've personally used them with about 15 different devices with no problem. :-(

Aniso
-=Beloved by all=-
-=Beloved by all=-
Posts: 286
Joined: Tue Aug 14, 2001 6:00 pm
Location: ...I could tell you my velocity...

Post by Aniso »

Cool, ok then I don't know! I suppose if it is consistent, then fine for now, but I guess we better but it on the list of things to do next week. Henry will keep in touch.

Henry: please add "Test I2C key read for LK202"

ravton
LCD!
Posts: 12
Joined: Fri Oct 05, 2001 6:00 pm

Post by ravton »

Bummer. I really hoped I wasn't doing some setup that I needed to do.

Please keep me informed. I bought this display due to perceived ease with the i2c interface, and the more time I lose the less attractive it is. :-(

ravton
LCD!
Posts: 12
Joined: Fri Oct 05, 2001 6:00 pm

Post by ravton »

I finally found something that returns the correct keycodes. I changed my i2c routines from a bit-banging library to hardware-based. Once I then lowered the hardware bitrate to under 100kbps (which is where it was before) the keys seem to be coming through okay. The lower bitrate doesn't hurt my application so I'll just leave it at that.

Post Reply