Hey!
Having read several tutorials regarding the I2C protocol, I came across a major deficiency which is preventing me from the grasping the concept.
How do we interpret and find from an I2C device's datasheet the registers from which we have to request data, and vice versa?
The registers and their functions are defined in the data sheet.
What don't you understand?
What don't you understand?
What I can't construe is that many tutorials state that to request data from an I2C device, we first have to send a Wire.write(0) to the device, while some tutorials advocate writing the specific register's address in the Write function.
So, which one is true?
Wire.write(0) to the device, while some tutorials advocate writing the specific register's address in the Write function.
So, which one is true?
It depends if you want to start reading data from Register 0 or from some other specific register. The command is setting a location.
The command is setting a location.
Does it [write() function] sets the location or writes data to the location the cursor has been set?
It's becoming quite convoluted in here.
Does it [write() function] sets the location or writes data to the location the cursor has been set?
It's becoming quite convoluted in here.
It can do both. Your original request was about requesting data from a device.
There are specific protocols when using the Wire library to either read from or write to a slave device. Wire.write() is always sending data to the slave device. How the information sent is interpreted is part of communications protocol.
Perhaps if you post either a data sheet or the specific tutorial which is confusing you it will be easier to sort out.