Page 1 of 1

Soft I2c library, suggestion for comment in example code

Posted: 24 Jul 2008 19:18
by Dany
Hi,
I used the "Soft I2c" library and it works fine. I have one remark though (mP v 8.0.0.1): the comments added to the example code in the library help could be a little better with respect to the device that is driven (24C02). I would like to propose the following:

Code: Select all

      
       Soft_I2C_Start();               // Issue I2C start signal
       Soft_I2C_Write($a2);            // Send I2c Write Slave Address (of the 24c02)
       ee_adr := 2;
       Soft_I2C_Write(ee_adr);         // Send EEPROM Word Address (here EEPROM place "2" will be written to)
       ee_data := AA;
       Soft_I2C_Write(ee_data);        // Send data(data that will be written)
       Soft_I2C_Stop();                // Issue I2C stop signal

       Delay_ms(11);                   // wait for the maximum write time

       Soft_I2C_Start();               // Issue I2C start signal
       Soft_I2C_Write($A2);            // Send I2c Write Slave Address (of the 24c02)
       ee_adr := 2;
       Soft_I2C_Write(ee_adr);         // Send EEPROM Word Address
       Soft_I2C_Start();               // Issue I2Csignal repeated start
       Soft_I2C_Write($A3);            // Send I2c Read Slave Address (request data from EEPROM)
       ee_data := Soft_I2C_Read(0);    // Read the data, no ackcnowledge (last byte read)
       Soft_I2C_Stop();                // Issue I2C_stop signal
It is better reflecting what is happening towards the 24C02 in this case.

Thanks in advance and keep up the good work! :D

Posted: 28 Jul 2008 13:08
by filip
Hi Dany,
thank you for your suggestion, note taken.

Re: Soft I2c library, suggestion for comment in example code

Posted: 20 Feb 2010 09:33
by seraulu1
Wow that's good!learn hypnosis