Page 1 of 1
I2C Read not working...
Posted: Wed Aug 06, 2008 6:28 pm
by tedlarson
I have a GLK19264-7T-1U. I can control the display with i2c, and display information with no problem. However, I cannot get the read to work. I am trying to read the keypad.
I am using a CCS compiler on a PIC18F252 chip, with a hardware i2c controller on board. My read routine looks like:
i2c_start();
i2c_write(LCD_ADDR);
i2c_write(254);
i2c_write(c);
i2c_start();
i2c_write(LCD_ADDR+1);
r = i2c_read(0);
i2c_stop();
and it hangs during the read, like the display is unresponsive.
Any suggestions on how I can get the read to work?
-Ted
Posted: Mon Aug 11, 2008 4:49 pm
by Clark
Hi Ted,
You'll want to make sure that the unit is responding via I2C rather than RS232. To do this, you'll have to issue the command found in your manual under the communication setting. It'll be three (3) bytes total, 254, 160, then a 0 or 1 depending on whether transmission in RS232 is turned on or off.
Anyway, check out the manual, send the code, and just put up another post if you have any more trouble.
Thanks,
~Troy
Posted: Mon Aug 11, 2008 5:21 pm
by tedlarson
Clark wrote:Hi Ted,
You'll want to make sure that the unit is responding via I2C rather than RS232. To do this, you'll have to issue the command found in your manual under the communication setting. It'll be three (3) bytes total, 254, 160, then a 0 or 1 depending on whether transmission in RS232 is turned on or off.
Yes.....doing this....has no effect. The code examples I have seen where people are bit banging the receive doesn't conform to the Phillips protocol, so perhaps it is possible that the on-chip hardware cannot handle the receive? Short of pulling out the protocol analyzer and capturing a trace, there is probably no way to confirm this 100%.
What I am really looking for is someone to tell me with certainty that you can comminicate with the display using an on-chip SSP on a PIC for the receive. So far all I have seen on all these forums is bit-banged examples on various CPU's without I2C hardware.
I ended up switching to serial for now, because I ran out of time to screw around with trying to debug why it doesn't appear to work correctly. It doesn't work like any I2C device I have seen before, and I have written applications that talk to dozens of them.
-Ted
Posted: Tue Aug 12, 2008 10:13 am
by Clark
Hi Ted,
Sorry to hear that you still aren't receiving data even with the auto transmit set to I2C. You'll also want to make sure the keypad is polled correctly, 254, 38 in decimal, then read. This should return the first value in the ten (10) key buffer, OR'd with 128 decimal if there is another byte still waiting in the buffer.
If you do happen to go back to I2C, or have any questions regarding the serial protocol, please feel free to post them up, and I'll do my best to get them answered.
~Troy
Re: I2C Read not working...
Posted: Fri Feb 20, 2009 2:01 pm
by aliya
Hello Rachel,
I tried what you said and its not working still. Just get my blinking cursor and when I use the auto transmit off and set auto 232 txdata off as written below, nothing happens, don
Posted: Fri Feb 20, 2009 3:01 pm
by Raquel
Hello Aliya,
To do a keypad read, you must first make sure:
- keypad auto transmit off
- auto transmit in RS232 is off
And for the I2C read transaction:
<start><disp read address><clock in data(8 bits)><send a ACK or NAK on 9th clock><stop>
so something like:
char lcd_keypad_info(char data) {
i2c_start();
data=i2c_read(LCD_ADDR_READ);
i2c_stop();
return(data);
}
You might also want to check out this
appnote.
I hope this helps. Please let me know how it turns out.
RE: I2C READ - not working
Posted: Sat Feb 21, 2009 9:54 am
by aliya
Hello Rachel,
I tried what you said and its not working still. Just get my blinking cursor and when I use the auto transmit off and set auto 232 txdata off as written below, nothing happens, don
Posted: Mon Feb 23, 2009 9:13 am
by Raquel
Hi Aliya,
Maybe its time to scope things out. Are you able to post some scope captures, something like
this?
Are you able to display characters at all?
Thanks,
Posted: Wed Feb 25, 2009 10:19 am
by aliya
Hi Raquel,
I am not able to. I have got the keypad to display something. Not the characters or numbers I am looking for. Do I just reassign the keypad to get the values I want or is there something else that I should do?
Aliya
Posted: Wed Feb 25, 2009 4:04 pm
by Raquel
Hi Aliya,
Keypad presses are not supposed to display characters on the screen. Unless the master I2C sends data to the display, you should not see any characters on the screen.
So you are not able send characters at all? I wonder if you are able to send commands, like clear screen ( 254 / 88 ) ?
Do you have a scope? Maybe just take pictures of the waveforms instead?
Also, if you please send me an email to
support@matrixorbital.ca and we can continue correspondence there, if that is okay with you.
Thanks,