MCP23016 I2C serial I/O expander chip


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31

    Default

    My mistake. I've been changing the code and trying all kinds of different stuff. I had tried the write command just to see what happened and didn't change it back when I posted that reply. However I have the write command in there now. I don't think the clock is correct. It isn't idling high. I am still working on this so if anyone has any wisdom to share please do. This is a really sweet chip set, the pic has a bunch of i/o's, on board USB and huge instruction memory space of 128k; the i/o expanders add an extra 16 gpio's each. I have 3 on my board. This left the other pic pins open for things like wireless modem, a maxstream zigbee module, LCD, and left many of the ATOD's open.

    Any advice on this???????????

  2. #2
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31

    Default

    read command that is.

  3. #3
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31

    Default Ok ok

    Thanks Jeff.............
    An email to melabs support got me the answer. Here it is:
    I2Cread portc.4, portc.3, %01000000, command, [insin], noitwoc

    Where command is what register you want to read 0 or 1. Now I get the value of the I/O expansion chip into the variable insin. Just missed the brackets around the variable name!

    Now I'm trying to figure out the write command. Some difficulties, I'll post my results. Hope this helps someone. This is a nice chip set. The I/O's on pics go fast. Faster and faster the deeper I get into designing with them.

    Joe

  4. #4
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31

    Default Reading and writing successfully

    i2cwrite portc.4, portc.3, %01000010, %00000111, [%00000000] ' SET U9 PORT 1 TO OUTPUTS
    i2cwrite portc.4, portc.3, %01000010, %00000011, [acout] ' WRITE VARIABL ACout TO U9 PORT 1 LATCH REGISTER
    insin = 0
    i2cread portc.4, portc.3, %01000000,[insin]', noitwoc ' READ U8 PORT 0 AND 1 PIN STATES
    i2cread portc.4, portc.3, %01000010, %00000000, [inson] ' READ U9 PORT 0 PIN STATES

    Here are the write and read lines I've found to be successful with the MCP23016 I/O expander chip.

    Use in good health.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. MCP23016 I/O expander
    By Demon in forum mel PIC BASIC Pro
    Replies: 42
    Last Post: - 24th October 2005, 01:01
  4. MCP23016 I/O expander with PBP?
    By Jon Chandler in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd August 2005, 09:32
  5. I2C I/O Expander PCF8574 hanging?
    By NavMicroSystems in forum Serial
    Replies: 12
    Last Post: - 4th August 2005, 02:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts