Page 1 of 2

I2C and Motorola HC08

Posted: Sun Jan 02, 2005 12:49 pm
by onb
Hello everyone.

I have a LK202-25-R-V that I m trying to write to over the I2C bus using a Motorola M68HC908JK3CP. My code is written in assembly and is based exactly on the ping.be website MO recommends. I have read all the information on this forum that I can regarding I2C, however I still cannot get the display to display anything properly. I noticed on the manual that it says that the I2C bus runs "at 100 kBps." Now here is my question, does this mean that I have to output data over the bus at 100 kBps? And did you mean 100 kByte/s or 100 kbit/s? I thought that I2C allowed you to run basically any baud rate you desired since the master device provided the clock. I have interfaced this same microcontroller to temperature probes and real-time clocks over I2C with a good deal of success, but this display has me scrathing my head. Can anybody answer these questions for me? Thanks

Posted: Mon Jan 03, 2005 11:14 am
by Tom
The 100kBps is meant that the display can communicate at 100k bits/second. You do not have to communicate at 100kBps. The 100KBps is the maximum bitrate the displays can communicate at, so you do not need to communicate at 100kBps.

Make sure you have the right addressing for the displays too. You might have read the information in this link already, just in case, the guide for I2C communication is at http://www.lcdforums.com/forums/viewtopic.php?t=910.

I hope it works out for you.

Best Regards, :D

Posted: Mon Jan 03, 2005 11:32 am
by onb
Thanks for clearing up the Byte vs. bit issue. I was taught that a B means Byte and a b means bit so I was a tad confused. :) I have read the I2C guide you provided, but it seems my display will respond to addresses that are not meant for it. I have been using the 0x50 address and get garbage characters out, but for trouble shooting changed the address to 0x60. The display still responded and outputted different garbage characters. :-?

Any ideas?!?

Posted: Mon Jan 03, 2005 1:10 pm
by onb
One more question...Is there any jumper settings or anything I need to change on that display to get I2C to work?

Posted: Mon Jan 03, 2005 1:22 pm
by Tom
Hi,

For the LK202-25 rev 1.5, you wouldn't need any jumper settings to communicate via I2C. If you have revision 2.0 and up, you will need to remove two jumpers that is labeled 232, and solder two other jumpers labeled I^2C.

Here is a good sample c code for I2C communication at http://www.lcdforums.com/forums/viewtop ... a&start=15.

It isn't assember, but the idea is similar.

I hope this helps you out.

Best Regards,

Posted: Mon Jan 03, 2005 2:26 pm
by onb
If I want to use both RS-232 and I2C but not at the same time, can I have both jumpers soldered?

Thanks so much for the help and the code I am using is already based on the sample code you mentioned.

Posted: Mon Jan 03, 2005 3:09 pm
by Tom
Which revision do you have for your LK202-25?

Posted: Mon Jan 03, 2005 3:13 pm
by onb
R2.0

Posted: Mon Jan 03, 2005 3:21 pm
by Tom
The traces for that revision uses the same data lines, so you must solder either RS-232 or I2C, but not both. The display will not work at all if you solder all the jumpers.

Best Regards,

Posted: Mon Jan 03, 2005 3:31 pm
by onb
Here is what I am trying to do, the microcontroller would communicate with the display over the I2C lines, and then would shut itself off, then a PC would communicate with the display over the RS-232 lines. So you are telling me this is not possible, right?

So, since the traces use the same data lines, the RS-232 chip would be connected to your controller as would the I2C at the same time right?

I apologize if I am being redundant, but when I ordered the display I was under the impression from the display's website that I would be able to run both protocols. I'm just tryig to get things straight beore I ruin a perfectly good display.

Thanks again for all you help and patience.

~David

Posted: Mon Jan 03, 2005 3:47 pm
by Tom
You are correct. If you soldered both the RS-232 and I2C, you would have both the RS-232 chip and the I2C line connected to the controller at the same time, so that is why it wouldn't work.

Your welcome to ask any more questions.

Best Regards,

Posted: Mon Jan 03, 2005 3:58 pm
by onb
Ok, so is there any way I can set up the display so that I can use I2C and RS232 together but not at the same time? (short of building a I2C to RS-232 conversion circuit) Can I solder the jumpers to a switch that allows me to switch back and forth between the two protocols?

Posted: Mon Jan 03, 2005 4:43 pm
by Tom
What you can do is have the normal RS-232 jumpers soldered, and have the display power normally through the power connector. You can then stick two wires on the left side of the I2C jumper. You can use the two vias beside the I2C jumper pad or the actual jumper pad. The top jumper is SCL, and the bottom jumper is SDA. DO NOT solder the I2C jumpers together, if you have the RS-232 jumpers on, or you can damage the pic.

For RS-232 you can talk normally via the DB-9.

This configuration should work out for you.

Best Regards,

Posted: Mon Jan 03, 2005 5:07 pm
by onb
Beautiful! :) :) Thanks so much for the help.

Posted: Mon Jan 03, 2005 9:24 pm
by Tom
Glad to help out. If you have anymore questions or concerns, please feel free to contact me.

Best Regards, :D