Perhaps I misunderstood your question ?
The Wire.write() is used for the register address and for the data. The amount of bytes depends on how many bytes the register address is and how many bytes are written.
this part was what I never read about anywhere - nowhere an example was given how to address a register by which code for writing! - :
Wire.write(HIGH(regaddr)); // this assumes the device expects MSB,LSB
Wire.write(LOW(regaddr));
if(ndatabytes>29) ndatabytes=29; // Wire's internal transmit buffer is 32 bytes
Nothing about HIGH(regaddr) and LOW(regaddr) and MSB or LSB first or last or other way round or if anyhow, and how and where and when to pass that to whatever.
The REST is simple of course then.
The I2c protocol doesn’t define message structures down to the "register " level. Those are specific to the chip you are talking to, and thus not appropriate for documentation at the arduino level…
aha, thank you, that's indeed new to me.
would it be possible then perhaps to provide some specific example source codes (no libs!) how to access e.g., PCF8574 (edited, has no registers)
PCF8591
MCP23017
to write to (and perhaps to read from if it's non-standard too) ?
Some of the popular chips have have additional libraries provided by Shield Vendors, for example for the MCP23017 there is GitHub - adafruit/Adafruit-MCP23017-Arduino-Library (it even has the readRegister/writeRegister functions you were looking for.)
I didn't see anything for the 8591, but googling "PCF8591 Arduino library" turns up a couple of "tutorials."
thank you very much! Now I already understand a little more about the topic, e.g.
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.send (0x00); // register 0 is the I/O direction register for Port A
Wire.send (0x00); // 0x00 for all pins to output mode, 0xFF for all pins to input mode
Wire.endTransmission ();
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.send (0x12); // register 0x12 is the I/O port "A"
Wire.send (0x56); // what to put on that port
Wire.endTransmission ();
...
Wire.requestFrom (0x20, (byte) 1);
byte data = Wire.receive ();
I did'n understand so far that there is no general system to do this but each device would need it's own commands.