Soft I2c library, suggestion for comment in example code

Post your requests and ideas on the future development of mikroPascal.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Soft I2c library, suggestion for comment in example code

#1 Post by Dany » 24 Jul 2008 19:18

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
Last edited by Dany on 02 Sep 2008 09:02, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

#2 Post by filip » 28 Jul 2008 13:08

Hi Dany,
thank you for your suggestion, note taken.

seraulu1
Posts: 1
Joined: 20 Feb 2010 09:28

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

#3 Post by seraulu1 » 20 Feb 2010 09:33

Wow that's good!learn hypnosis

Post Reply

Return to “mikroPascal Wish List”