I2C communication protocol doubt

dendad

Joined Feb 20, 2016
4,637
"Many slave devices will require configuration upon startup to set the behaviour of the device".
For example, some of the configuration for an application using the MCP23017 to setup how the port pins are used...

mcp.write8(iodira,0x3f) # 8-13 inputs, 14 & 15 outputs
mcp.swrite8(iodirb,0xff) # 0-7 inputs
mcp.write8(gpioa,0x3f) # 8-13 high, 14 & 15 low
mcp.write8(gpiob,0xff) # 0-7 high
mcp.write8(gppua,0x3f) # pullups 8-13
mcp.write8(gppub,0xff) # pullups 0-7

There are many more functions that are available in this chip but were not used in this application, like interrupts....
So, the first thing you do when talking to just about any device other than a real dumb chip, is to select the functions you want to use.
 
Last edited:
Top