i2c read sequence

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

Moderators: Henry, Mods

Post Reply
NiTris
LCD?
Posts: 6
Joined: Tue Dec 30, 2008 5:20 pm

i2c read sequence

Post by NiTris »

I am having a problem verifying the correct read sequence for the LK204-7T-1U series display.

My other i2c devices are all fairly similar in behavior:

[start][write address][A][command][A][start][read address][A][READ DATA][NA][end]
or
[start][read address][A][command][A][READ DATA][NA][end]

The well documented keypad read sequence does give me reliable data, although it differs from the manual: Right Arrow gives 0x61 not 0x43 etc.

I do not really trust any data I am reading back from the LCD since the 0x37 command is not returning 0x2B, I get either 0x7f or 0x9b depending on the sequence above that I use.

Any breakdown of a detailed sequence would help.
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hello Nitris,

Thank you for posting on the forum.

There are 2 different read sequences on the display module:

1) To read key presses, all you need to do is to send the read address:
[start][read address][A][READ DATA][NA][stop]


The READ DATA needs to be checked for bit 7. If bit 7 is set, this means there are more data left to be read (instances that there were 2 or more keys were pressed before the display was read). The sequence then becomes:
[start][read address][A][command][A][READ DATA][A][READ DATA][A].. [READ DATA][NA][stop]


2) To read query replies (data) back from the display, eg for cmd 0x37 which replies with 1 byte:
[start][write address][A][FE][A][37][A][stop]
[start][read address][A][READ DATA][NA][stop]


Please note though that you need to make sure that the display is set to have the Auto Keypad TX off, and Auto 232 TX Off when in I2C (so you might want to add these commands in init):
command FE / 93 / 1 - set remember ON
command FE / 4F - set Auto Keypad TX off
command FE / A0 / 0 - set Auto 232 TX off
command FE / 93 / 0 - set remember OFF

I hope this helps. Please let me know how it turns out.

Thanks,
Raquel Malinis
Design and Development
Matrix Orbital
NiTris
LCD?
Posts: 6
Joined: Tue Dec 30, 2008 5:20 pm

Post by NiTris »

Thank you for that information. I isolated one issue to the mcu not releasing back to the idle state on stop.

Doing a quick read on the keypad now returns all the correct information, so things almost work.

Any read that utilizes a command still does not work. I had already been disabling rs232 and the keypad auto transmit, but I have now included the remember command.

All the write commands work, and the quick keypad read works. I am not sure why reads that need commands will not work. The scope shows what I expect and exactly what is happening; the correct sequence is being sent out, the read sequence starts, and the LCD does not provide any data.

The addresses are correct, the clock is well within the capabilities of the LCD, but the LCD remains unresponsive to formal commands. I have verified my sequence against yours above, any ideas would be helpful.
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Try adding a delay in between the sending of the query command and actual reading of the reply. Add about 5ms before reading from the [stop] to [start].
Raquel Malinis
Design and Development
Matrix Orbital
NiTris
LCD?
Posts: 6
Joined: Tue Dec 30, 2008 5:20 pm

Post by NiTris »

Does not make any difference. Any other ideas?
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Can you please post a scope capture? Hopefully we'll find something.
Also, try a bigger delay, say 250ms.
Raquel Malinis
Design and Development
Matrix Orbital
Post Reply