Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

which variables for MCP23S17 inputs ?

Anonymous
2018-09-07
2018-09-07
  • Anonymous - 2018-09-07

    Originally created by: phenixrb

    Hello to all ,
    after configuring the SPI MASTER and having defined the physical addresses of the different MCP23S17 that I use,
    I use the following lines to control the outputs:
    for exemple:
    MCP23S17.byOutputsA.0:=GVL.BP9;
    MCP23S17_1.byOutputsA.6:=GVL.BP15;
    MCP23S17_2.byOutputsA.3:=GVL.BP12;

    it works perfectly.

    however, I do not find the variables that will allow me to acquire the state of the inputs.
    and the parameters to be defined in the SPI block MCP23S17.
    even by setting port B as input as shown in the description, I can not find any variables that change state when I put a + vcc on the MCP23S17 PORT B pin.

    Thanks for your help

    IMG: MCP23017.jpg

     
  • eschwellinger

    eschwellinger - 2018-09-07

    Hi,
    i would give this a try:

    BR
    Edwin

    IMG: MCP_.png

     
  • Anonymous - 2018-09-07

    Originally created by: phenixrb

    I have try this but it doesn't work

    if I put "2#11111111" in the spi device configuration ,MCP23S17_3.byInputsB.0 is always true

    IMG: MCP23017   inputs.jpg

     
  • Anonymous - 2018-09-07

    Originally created by: phenixrb

    in this configuration:
    the input changes state when I apply the gnd to the pin of the MCP23S17
    is there a way for the state of the input change when the + vdc is applied to the pin?

    IMG: MCP23017   inputs3.jpg

    IMG: MCP23017   inputs2.jpg

     
  • eschwellinger

    eschwellinger - 2018-09-07

    Hi,

    should work that way,
    with current RASBIAN we have seen problems on some boards (for example PIFACE) with SPI maxspeed. (_diMaxSpeed)
    Could you please change the speed to 100000 and give this a try.

    BR
    Edwin

    IMG: SPIMaxSpeed.jpg

     
  • Anonymous - 2018-09-07

    Originally created by: phenixrb

    with this configuration:
    - PORT B as input,
    - no internal pullup resistor enabled.

    some inputs are active at the start of the process,

    I think that in this configuration, it is necessary to put external resistors of pull down,
    to put the inputs pins to the GND; in the absence of control voltage (3.3vdc) on the pin.
    currently when I apply a +3.3 vdc on an input pin of port B,
    the state of the input changes to 1, but remains at 1, even if there is no more control voltage.
    the input returns to 0 only by applying a GND on the input pin.

    but except that, it seems to work,
    thanks a lot to EDWIN for the help he gives me on the forum and before that in private.

    for information: the speed is at 50 000 Hz, I will see if it is possible to increase it once the resistors connected to the GND.

    IMG: MCP23017   inputs WITHOUT PULL UP.jpg

    IMG: MCP23017   inputs WITHOUT PULL UP ON START.jpg

     

Log in to post a comment.