Pages: [1]   Go Down
Author Topic: how to program a MAX23017 so that I can use all pin outs  (Read 538 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello i recently got some MAX23017 port expanders but i am having trouble controlling them. i know that there are 2 port on this IC and so far i have only been able to get the 0 output on port A to work using the adafruit library. How do i use this library to control the port expander (they only need to be outputs)?

i would like to be able to use these port expanders to control a BCD to decimal decoder (74141) to drive some IN-12 nixie tubes.

how would i use this library and if it cannot be done can it be done with the wire library?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8719
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you try setting the pin number to something other than 0 to try other pins?  Here is the example code re-written to use Pin 15 instead of Pin 0

Code:
#include <Wire.h>
#include "Adafruit_MCP23017.h"

// Basic pin reading and pullup test for the MCP23017 I/O expander
// public domain!

// Connect pin #12 of the expander to Analog 5 (i2c clock)
// Connect pin #13 of the expander to Analog 4 (i2c data)
// Connect pins #15, 16 and 17 of the expander to ground (address selection)
// Connect pin #9 of the expander to 5V (power)
// Connect pin #10 of the expander to ground (common ground)

// Output #15 is on pin 8 so connect an LED or whatever from that to ground

Adafruit_MCP23017 mcp;
 
void setup() { 
  mcp.begin();      // use default address 0

  mcp.pinMode(15, OUTPUT);
}


// flip the pin #15 up and down

void loop() {
  delay(100);

  mcp.digitalWrite(15, HIGH);

  delay(100);

  mcp.digitalWrite(15, LOW);
}
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so what pin on the max23017 would be 15?

i did try other numbers but i could not the get the test led to light up :/

is there anything special in the way i wire these up that i need to do?
Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I do believe our resident expert and all round guru Nick Gammon has done some trials using this chip to interface to a LCD matrix display but I cannot remember where.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8719
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so what pin on the max23017 would be 15?

Like I said in the code:  pin 8 (port B bit 7)
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so what pin on the max23017 would be 15?

Like I said in the code:  pin 8 (port B bit 7)

sorry i did not notice smiley-grin

do i put the 4.7k resitors before the first IC or at the end of the SCL and SDA lines?

alo how would i control the outputs of another max23017 chip on the i2c with its A0 pin high and A1 and A2 low?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8719
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



>  do i put the 4.7k resitors before the first IC or at the end of the SCL and SDA lines?

I don't know if it matters but I would put them near the ATmega.

> alo how would i control the outputs of another max23017 chip on the i2c with its A0 pin high and A1 and A2 low?

Since the examples use:
Code:
mcp.begin();      // use default address 0
My guess would be:
Code:
mcpA.begin(0);      // use default address 0
mcpB.begin(1);      // use address 1
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

also how would i do this using just the wire library? that would then allow me to use my pcf8574AP IC's smiley-grin
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some stuff about I2C and that port expander:

http://www.gammon.com.au/i2c


Here I drove an LCD screen with one:

http://www.gammon.com.au/forum/?id=10940

Quote
alo how would i control the outputs of another max23017 chip on the i2c with its A0 pin high and A1 and A2 low?

Use the appropriate I2C address.
Logged

Pages: [1]   Go Up
Jump to: