Mcp 23017 and Pic 16f877


Closed Thread
Results 1 to 17 of 17

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Code:
    sda var porta.0 'sda est sur le porta.0
    scl var porta.1 'scl est sur le porta.1
    So you have 16 LEDs on ports A and B, but you also use Port A for I2C communication?

    Why not use Port C.3 for SCL and Port C.4 for SDA (PIC 16F877 datasheet pinout p.3) to avoid interfering with your LEDs?
    Actually If I understand properly, it is worst than this. If the LED are connected to Ground on the I2C line, they Screw-up the line as they have to be Pulled-high (hi-z) but the LED LOAD it to gnd.

    Get rid of the LED on those I/O or, like BobyBert said, move the I2C line elsewhere (it doesn<t need to be on a specific SCL, SDA PIC line as you're using I2CREAD/I2CWRITE who's not using the built in SSP module). You want the I2C line on their own I/O.
    Steve

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

  2. #2
    Join Date
    Apr 2011
    Location
    BELGIQUE
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Hello,

    Thank you for your answers.

    When I speak of the port A and B have ports MCP23017 and not PIC.
    The PIC used is a 877A.
    The PIC controls only the LCD and I use the port A of the PIC to bond with the I2C MCP23017.

    A big thank you for your help.

    Soon

    Claudy

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Hi, Claudy

    Following your adventures on many forums for a moment ... I still miss a small thing : YOUR USED SCHEME ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Apr 2011
    Location
    BELGIQUE
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Hello Alain,

    I still have not found the solution.

    Here's a quick diagram as requested.Printing TEST MCP23017-sch.pdf

    Thank you

    Claudy

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Looks there's also a missing register named IOCON in the settings.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Apr 2011
    Location
    BELGIQUE
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Hello everyone,

    Ok it works!

    Bit 7 of Port A and B of the MCP23017 must be 1 before the startup of the program.

    And in this case each power program is operating normally the first

    Here is the code added.

    i2cwrite sda,scl,$40,[iolata,128] 'Output Latch Reg
    i2cwrite sda,scl,$40,[iolatb,128] 'Output Latch Reg


    If you have comments please.

    Thank you

    Claudy

  7. #7
    rauloj's Avatar
    rauloj Guest


    Did you find this post helpful? Yes | No

    Default Re: Mcp 23017 and Pic 16f877

    Quote Originally Posted by CLAUDY View Post
    Bit 7 of Port A and B of the MCP23017 must be 1 before the startup of the program.

    And in this case each power program is operating normally the first

    Here is the code added.

    i2cwrite sda,scl,$40,[iolata,128] 'Output Latch Reg
    i2cwrite sda,scl,$40,[iolatb,128] 'Output Latch Reg


    If you have comments please.

    Thank you

    Claudy
    Hi Claudy!

    It's not OLATA/OLATB you are setting 1, but IOCON.
    After power-on BANK bit = 0 and IOCON's adr = 0A/0B not OLATA/OLATB's.
    After setting IOCON bit 7 to 1 you can use address mapping as described in datasheet table 1-5.

    R

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