<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>8051 &amp;amp; I2C</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/16757/8051-i2c</link><description> Does someone have ever develop a program defining an i2c communication protocol for a 8051 ? It would help me make my AT89C51ED2 communicating with another board via i2c bus. 
 
I would be interested if someone have some examples for that. 
jeab@free</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: 8051 &amp; I2C</title><link>https://community.arm.com/thread/42289?ContentTypeID=1</link><pubDate>Mon, 31 May 2004 04:00:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:788b5614-6a4d-4d3a-a63c-91ec453bb0ce</guid><dc:creator>Aleksandras Sharpilo</dc:creator><description>&lt;p&gt;In my case I wrote next:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
#define SDATA P1_6&lt;br /&gt;
#define SCLK P1_7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void i2c_start (void)&lt;br /&gt;
{&lt;br /&gt;
	SDATA = 1;&lt;br /&gt;
	SCLK = 1;&lt;br /&gt;
	SDATA = 0;&lt;br /&gt;
	delay(1);&lt;br /&gt;
	SCLK = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void i2c_stop (void)&lt;br /&gt;
{&lt;br /&gt;
	SCLK = 0;&lt;br /&gt;
	SDATA = 0;&lt;br /&gt;
	delay (1);&lt;br /&gt;
	SCLK = 1;&lt;br /&gt;
	delay (1);&lt;br /&gt;
	SDATA = 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void i2c_put (unsigned char put_data)&lt;br /&gt;
{&lt;br /&gt;
unsigned char i;&lt;br /&gt;
	for (i=0;i&amp;lt;8;i++)&lt;br /&gt;
		{&lt;br /&gt;
			SDATA = ((put_data &amp;amp; 0x80)?1:0);&lt;br /&gt;
			put_data &amp;lt;&amp;lt;=1;&lt;br /&gt;
			SCLK = 1;&lt;br /&gt;
			delay (1);&lt;br /&gt;
			SCLK = 0;&lt;br /&gt;
	  	}&lt;br /&gt;
&lt;br /&gt;
	 i = SDATA;&lt;br /&gt;
	 SCLK = 1;&lt;br /&gt;
	 delay (1);&lt;br /&gt;
	 SCLK = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
unsigned char i2c_get (void)&lt;br /&gt;
{&lt;br /&gt;
unsigned char i,input_data;&lt;br /&gt;
&lt;br /&gt;
	i = SDATA;&lt;br /&gt;
	input_data = 0;&lt;br /&gt;
&lt;br /&gt;
	for (i=0; i&amp;lt;8; i++)&lt;br /&gt;
		{&lt;br /&gt;
			input_data &amp;lt;&amp;lt;= 1;&lt;br /&gt;
			SCLK = 1;&lt;br /&gt;
			input_data |= SDATA;&lt;br /&gt;
			SCLK = 0;&lt;br /&gt;
		}&lt;br /&gt;
	return input_data;&lt;br /&gt;
}&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Read the description as mentioned above and everthing should be OK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 &amp; I2C</title><link>https://community.arm.com/thread/86798?ContentTypeID=1</link><pubDate>Fri, 28 May 2004 11:28:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2874b01b-0143-4f00-b16b-ad3966985c41</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;The best (and most) IIC appnotes including the bus specification:&lt;br /&gt;
&lt;a href="http://www.semiconductors.philips.com/buses/i2c/support/index.html" target="_blank"&gt;http://www.semiconductors.philips.com/buses/i2c/support/index.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8051 &amp; I2C</title><link>https://community.arm.com/thread/42282?ContentTypeID=1</link><pubDate>Fri, 28 May 2004 10:40:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:54986f12-d0bf-4021-85b5-00b72b4ce54b</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;a href="http://www.keil.com/i2c/"&gt;http://www.keil.com/i2c/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>