Shop OBEX P1 Docs P2 Docs Learn Events
MCP23017 question - help please — Parallax Forums

MCP23017 question - help please

CheetahCheetah Posts: 26
edited 2007-02-06 05:39 in BASIC Stamp
I'm trying to get the BS2pe to work with the MCP23017 but so far I have been unable
to get it to respond.

I have LED's connected to GPB2 and GPA1. All I'm trying to do is turn on these LED's.

The MCP23017 has the device address pins (A0, A1 and A2) all grounded to 0.
Does anybody see anything wrong the code below?

SDA        PIN     8
SCL        PIN     9    

DevType    CON     %0100 << 4                   ' Device type
DevAddr    CON     %000 << 1                     ' address = %000 -> %111
Wr23017    CON     DevType | DevAddr | 0    ' write to MCP23017
Rd23017    CON     DevType | DevAddr | 1    ' read from MCP23017
IODIRA     CON     0
IODIRB     CON     16
OLATA      CON     10 
OLATB      CON     26 


I2COUT SDA, Wr23017, IODIRA, [noparse][[/noparse]%00000000]      ' GP0 pins are outputs
I2COUT SDA, Wr23017, IODIRB, [noparse][[/noparse]%00000000]      
I2COUT SDA, Wr23017, OLATA, [noparse][[/noparse]%11111111]
I2COUT SDA, Wr23017, OLATB, [noparse][[/noparse]%11111111]





Thank you

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-05 23:34
    Cheetah,

    Do you have the 4.7K pull-up resistors on the SDA/SCL lines?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • CheetahCheetah Posts: 26
    edited 2007-02-05 23:45
    Hi, Uhh... no I don't. I guess that could be a problem. Let me hook those up now
    and see how it goes. I'm more of a software guy so I didn't think of that.
  • CheetahCheetah Posts: 26
    edited 2007-02-05 23:54
    I put the resistors on but still no luck. Any other ideas?
  • CheetahCheetah Posts: 26
    edited 2007-02-06 05:39
    Never mind. The problem was a bad mcp23017 chip.
    I put in the 2nd one we bought and everything worked fine.

    Thanks anyway.
Sign In or Register to comment.