简体   繁体   中英

easy -> When change register address i2c during read operation

My question is very easy (I think). Let's say I want to read a register, where a result is stored by a sensor.

At which moment do I need to specify the register I want to read? After the slave address as data? http://imgur.com/EhO6d6m

I don't think so. Because If I previously did a write operation in register 0x1234. And afterwards just do a read (without specifying anything). I will read data from register 0x1234.

Where/when do I need to specify the address of the new register I want to read?

If someone has an answer please let it be known. Thank you

Generally, you have to specify the register you want to read from (if it's not already set) by using a write!

Issue

STA
SLA+W
REGISTER
rSTA
SLA+R
DATA
STO

That's the most common format. Other less common variants include:

STA
SLA+W
READ_REGISTER_ADDRESS
REGISTER
rSTA
SLA+R
DATA
STO

Ie some devices only let you manipulate a pointer to the next data register that is read.

Some devices don't have multiple registers, so you always read from the same register.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM