This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

reading Data using I2C

Hi

i want to read data using I2C, just like reading temperature from any digital sensor, located at the Address 0X00,

Is there a simple source code?

Parents
  • Why claim "the answer" when it isn't?

    Software delay loops like that, without connection to any hardware and without any defined side effect is not good to use.

    Documentation like:

        //Delay at while before writing to LCD display
        delay(200000ul);
    


    are not making anyone happy. How long is "at while"? Wouldn't it be much better to have a _real_ delay function and to be able to do: delay_ms(500) and know that you get a delay of 500ms +/- internal rounding/truncation?

    Dummy code like:

    /** Waits until the I2C bus is IDLE, and available to be used. */
    #define i2cWaitForIdle()
    

    is obviously not the answer to any problem.

Reply
  • Why claim "the answer" when it isn't?

    Software delay loops like that, without connection to any hardware and without any defined side effect is not good to use.

    Documentation like:

        //Delay at while before writing to LCD display
        delay(200000ul);
    


    are not making anyone happy. How long is "at while"? Wouldn't it be much better to have a _real_ delay function and to be able to do: delay_ms(500) and know that you get a delay of 500ms +/- internal rounding/truncation?

    Dummy code like:

    /** Waits until the I2C bus is IDLE, and available to be used. */
    #define i2cWaitForIdle()
    

    is obviously not the answer to any problem.

Children
No data