Go Down

Topic: Updated Centipede Library (MCP23017 I2C 16-port I/O expander) (Read 3275 times) previous topic - next topic

macegr

In response to a customer request I finally added internal pullup support in the Centipede Library ( for either the Centipede Shield or DIP MCP23017 chips).

Link: http://docs.macetech.com/doku.php/centipede_shield#code_example

Bonus tip: the MCP23017 supports up to 1.7MHz I2C speed, though the Arduino does not. However, the Arduino does support 400KHz I2C operation. For 16MHz Arduinos, simply add TWBR = 12; in your setup() function after Wire.begin();
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

kg4wsv

Quote
the Arduino does support 400KHz I2C operation. For 16MHz Arduinos, simply add TWBR = 12; in your setup() function after Wire.begin();

If you really want to make your library friendly, include code that does that automatically, for all the arduino variants.  Oh yeah, and put the control registers back the way you found it, so I can use my XYZ device at whatever speed, and use the MCP23017 as fast as possible.

Thanks for sharing your code!

-j

macegr

Yeah I might add support for it...you are correct that the TWBR register transparently and instantly changes the I2C speed. The prescaler registers work the same way. It would be interesting to write an I2C library that automatically negotiates to the highest speed that doesn't exhibit communication problems...could be very handy for long distance I2C without extra driver hardware.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Go Up