JohnInTX Thank you so much for the response. I haven't thought of anything specific yet. I just thought that one is a mater and the other is slave and I made flow chart to show how they will communicate for i2c communication. I thought I should start with a simple example, so I didWhat is the part number of the slave device?
Yes I made a flow chart to read the sequence of of bytes from an I2C slave into a bufferIt doesn't make much sense. Are you trying to read a sequence of bytes from an I2C slave into a buffer?
I think it should be work as per your explanationsIf you are writing to an I2C slave, you only need one START. You send START, the slave address with R/W=0, the data byte(s) then a STOP. Verify ACK after each byte sent. Send STOP when the last byte is written.

I have recreated flow chart after reading description on page 15 and chapter 3Please read page 15 of the spec. What does START do? What ALWAYS comes after a START? Where does the STOP go?
You replied while I was editing last post. There is one image and one PDF file to show how we can write data to slave device.Much better!
A few things:
1) R/W = 0 for write.
2) The last decision diamond doesn't show that it checks anything. That is incorrect. You say 'GET ACK/NAK From Slave' but you don't test anything. Always ask yourself if you have considered all of the possibilities at each step.
3) On the last byte of a slave WRITE, the slave will still ACK the byte to indicate that it has received the second byte. It is when the master is reading from the slave that the master generates a NAK to indicate that no more data will be read.
I was confused by reading descriptions #3The flow chart in the image has different problems. What are they?
Alright Here I am doing similarGetting there.
int buffer[N} declares the buffer. I assume you mean buffer[N] = byte_read; Declare the buffer at the top of the flow chart and use it in the flow.
What is happening in the buffer loop? You are not reading anything from the I2C slave.
As you read each byte, put it in the buffer.
ACK each byte read from the slave.
After the last byte read, send NAK instead of ACK.
Send STOP
alright I done with few changesYou need a block in the loop that says 'Read Byte From Slave' to show where that happens.
You need to show what you do with the data received.
Declare the buffer at the top, not in the loop.
Otherwise, you basically have it.
cheers JohnInTX it was impossible without your help.Well, I still don't like buffer[N]; there but if that's a declaration, it's technically legal.
Otherwise, looks like it would work!
Good job.

| Condition | SDA | SCL | Comment |
| Start | H --> L | H | SDA transitions high to low while SCL is held high |
| Stop | L --> H | H | SDA transitions low to high while SCL is held high |
| And so forth ... |