I/O extender


Closed Thread
Results 1 to 18 of 18

Thread: I/O extender

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    40

    Default I/O extender

    Happy New Year to all....

    Currently, i am still using pic16f84a for my project due to smaller size and no special task require. However the only problem is limited I/O. I also plan to migrate to pic16f628 soon. I/O still a problem for me. I have gone through some article to expand I/O however it is very limited. Is there any way to increase it to 32 or 64 ? How ?

    Thx..

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    It depends on what you want to do with the I/Os.

    An RC network using the ADC or POT or RCTIME for inputs.

    Outputs could be a "matrix" http://www.mackrackit.com/mac/www/dave/LED/LEDs.html

    But shift registers are I think the best, they can be used for both in and out. Three pins from the PIC can be turned into eight outputs. Four pins can be turned into 16 outputs by sharing the clock an load pins on the registers.

    Example for reading one register.
    Code:
    Clock   var PORTB.7
    
    Load    var PORTB.6
    
    Data_1  var PORTB.5
    
    pulsout Load,1
    
    shiftin Data_1,Clock,MSBPre,[keys]
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    See the Microchip MCP23016. (16-bit bidirectional I/O port expander).

    You can address up to eight MCP23016 in your system so this
    will give you up to 128 I/O pins.

    Microchip MCP23016 16-Bit I2C™ I/O Expander
    http://ww1.microchip.com/downloads/e...Doc/20090b.pdf

    Interfacing The MCP23016 I/O Expander with the PIC16F877A:
    http://ww1.microchip.com/downloads/e...tes/00245a.pdf


    * * *

    There is also a version with an 8-bit bidirectional I/O port.

    Microchip MCP23008 8-Bit I/O Expander with I2C Interface
    http://ww1.microchip.com/downloads/e...Doc/21919e.pdf

    Best regards,

    Luciano
    Last edited by Luciano; - 1st January 2008 at 08:52.

  4. #4
    Join Date
    Jun 2006
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    Thx Mackrackit.
    It only High and Low I/O. i think shift register would be a good idea. 4 to 8 lines. Bringing total of 128 bit of I/O. Meaning total pin require is 7 ( 4 for address, Clock, Load and Serial Data ). Am i right ?

    Thx Luciano for the suggestion. It really a new thing for me. But why both MCP23008 and MCP23016 have 3 addresses ? Can MCP23016 work with 16f84a ?

  5. #5
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mychangl View Post
    Thx Luciano for the suggestion. It really a new thing for me.
    But why both MCP23008 and MCP23016 have 3 addresses ?
    Can MCP23016 work with 16f84a ?
    Hi,

    Code:
    With three address lines you can set the address of up to eight devices.
    
    Binary / Decimal 
    ============
    000   =   0
    001   =   1
    010   =   2
    011   =   3
    100   =   4
    101   =   5
    110   =   6
    111   =   7
    The MCP23016 will work with the 16f84a.
    Use the software I2C commands of PicBasic Pro. (I2CIN and I2COUT).

    * * *

    See also this: (Basic Stamp + MCP23016).
    http://www.parallax.com/dl/docs/cols.../col/nv109.pdf

    Best regards,

    Luciano
    Last edited by Luciano; - 1st January 2008 at 15:43.

  6. #6
    Join Date
    Jun 2006
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Luciano View Post

    Use the software I2C commands of PicBasic Pro. (I2CIN and I2COUT).
    Do you mean I2Read and I2Write ?
    Sorry i am not familiar with it. However i would like to try.

    Correct me if i am wrong.
    From datasheet,
    control 0h and 1h is to read or write to the ports
    control 6h and 7h is to set port as input or output

    Given scenario 1 :
    Connect 23016 address as $01
    Assign GP0.0 to GP0.7 as input (control address is 6h)
    Assign GP1.0 to GP1.7 as output (control address is 7h)

    the code will be :
    addr var byte
    addr=01
    I2CWRITE DataPin,ClockPin,06,addr,[FF]
    I2CWRITE DataPin,ClockPin,07,addr,[00]

    Scenario 2 :
    Read the data on GP0.0 to GP0.7 and put inside Sample1

    the code will be :
    I2CREAD DataPin,ClockPin,00,addr,[Sample1]

    Scenario 3 :
    Write data 44h on GP1.0 to GP1.7

    the code will be :
    I2CWRITE DataPin,ClockPin,00,addr,[44]
    Cheers,

    mychangl
    "The Dream Is Everything"

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mychangl View Post
    Thx Mackrackit.
    It only High and Low I/O. i think shift register would be a good idea. 4 to 8 lines. Bringing total of 128 bit of I/O. Meaning total pin require is 7 ( 4 for address, Clock, Load and Serial Data ). Am i right ?

    Thx Luciano for the suggestion. It really a new thing for me. But why both MCP23008 and MCP23016 have 3 addresses ? Can MCP23016 work with 16f84a ?
    If you go with shift registers you will need a clock/load set for inputs and one for outputs.
    Look at a HC595 for output and HC165 for inputs (I think, been awhile)

    The solution that Luciano gave looks nice. I did not know about these chips. Learned something new and it is the fisrt day of the year Off to a good start.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Those microchip I/O extender are really nice. In the past i also used PCF8574A, maybe easier to find it locally 'cause it's a very old one.. still popular i guess.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default max6957

    I use 3 of the Maxim Max6957's for a total of 60 additional I/O's with only 3 PIC pins thru SPI interface. They also have a I2C version. In my app. 52 are used for LED's and 8 will be used for relays. TFM is a bit intimidating at first. I could post some code if interested.

    Hope this helps.

    !!!!!!!!!!!! Happy New Year to All !!!!!!!!!!!!!!
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

  10. #10
    Join Date
    Jun 2006
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    Interesting. If it is feasible, why not. However I just checked with our local distributor and they do not have max6957. Perhaps i should keep looking for the availability. I keep that in mind. Thx Ronjodu
    Cheers,

    mychangl
    "The Dream Is Everything"

Similar Threads

  1. PORTA Logic - Be the processor
    By Darrel Taylor in forum FAQ - Frequently Asked Questions
    Replies: 29
    Last Post: - 9th March 2009, 18:18
  2. I/O dilemma
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th January 2008, 16:45
  3. MCP23016 I2C serial I/O expander chip
    By GeoJoe in forum Serial
    Replies: 7
    Last Post: - 31st October 2007, 15:39
  4. 16F877 universal PCB with I/O module
    By cupajoe in forum Schematics
    Replies: 12
    Last Post: - 3rd September 2005, 13:39
  5. managing the I/O ports of the 16F84A
    By skyler_91600 in forum mel PIC BASIC
    Replies: 7
    Last Post: - 28th April 2005, 03:52

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