Pages: [1]   Go Down
Author Topic: Updated Centipede Library (MCP23017 I2C 16-port I/O expander)  (Read 2539 times)
0 Members and 1 Guest are viewing this topic.
SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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();
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Pages: [1]   Go Up
Jump to: