how to program a MAX23017 so that I can use all pin outs

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?

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

#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);
}

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 :confused:

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

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.

carbondudeoxide:
so what pin on the max23017 would be 15?

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

johnwasser:

carbondudeoxide:
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:

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?

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:

mcp.begin();      // use default address 0

My guess would be:

mcpA.begin(0);      // use default address 0
mcpB.begin(1);      // use address 1

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

Some stuff about I2C and that port expander:

Here I drove an LCD screen with one:

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.