I/O Expander MCP23017

nexus161
2014-05-28
2014-05-28
  • nexus161 - 2014-05-28

    Hello everybody,
    I want to expand the I/Os of the Raspberry with the following IO Expander(MCP23017).
    I have created the „MCP23017.devdesc.xml“ and a libary „MCP23017.library“ file based on an copy of „SRF02.devdesc.xml“ und „I2C_SRF02.library“.

    The Rasberry indentify the MCP23017 but I can´t access with Codesys and don´t know why!!
    I think I fail because I didn´t use the right Parameters in “AfterReadInputs” and “BeforeWriteInputs” to activate the chip or port.

    I send you some files and hope you can help me!
    Maybe someone worked on MCP23017 and solved my problem already.

    thankfully

    MCP23017.library [337.29 KiB]

    MCP23017.devdesc.xml [2.35 KiB]

     
  • switcher - 2014-05-28

    Hi,

    Please look at this post for a good start:
    l viewtopic.php?f=21&t=5744 l

    You have to add this declaration in your device configuration file if you like to use also BeforeWriteOutputs method:

    I haven't deep dived in the MCP23017 device datasheet yet. But I saw imediately that you are using wrong device address in your lib. For MCP23017 you have to use 0x20, suppose you have A0-A2 low (usiAddress := 16#20;).

    I hope this helps you further.

    BR
    Zdenko.

    IMG: Bild

     

Log in to post a comment.