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
I2C Read not working...
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
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
Troy Clark
Design & Development
Matrix Orbital
Design & Development
Matrix Orbital
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%.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.
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
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
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
Troy Clark
Design & Development
Matrix Orbital
Design & Development
Matrix Orbital
Re: I2C Read not working...
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
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
Last edited by aliya on Sat Feb 21, 2009 9:07 am, edited 2 times in total.
Aliya
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.
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.
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital
RE: I2C READ - not working
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
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
Aliya
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,
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,
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital
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,
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,
Raquel Malinis
Design and Development
Matrix Orbital
Design and Development
Matrix Orbital