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

3 inputs and 2 outputs

4 days ago
4 days ago
  • edwin200000

    edwin200000 - 4 days ago

    Goodday,

    I have three buttons. Lets call the first one button 1 this is a bool by one press it's true by another press it's false. I have button 2 this is also a bool by one press it's true by another press it's false.
    I have also button 3 this one is different it's only true if the button is pressed.
    And as you could read in the title, 2 outputs these are also bools.

    I want that if I press button 3 that output 1 goes/is on and output 2 goes/is off. If I press another time button 3 I want that output 1 is/goes off and output 2 goes/is on. If I press another time button 3 I want that output 1 goes/is on and output 2 goes/is off. And so on. It's needs to overruled the other two buttons I mention earlier.

    And I want that if I press button 1 output 1 goes on or off. And I want that if I press button 2 output 2 goes on or off. This needs too overruled button 3.

    I tried a lot but couldn't find a solution. This is what I have so far. See the attachments and:
    TS19 = button 1
    TS20 = button 2
    knop_rechts_links = button 3
    ventiel22 = output 1
    ventiel21 = output 2

    But it's not working good when I change output 1 or 2 with buttons 1 or 2 and press then button 3 it works the opposite, all the outputs goes on or off.

    Everything is welcome. Thanks in advance!

     

    Last edit: edwin200000 4 days ago
  • edwin200000

    edwin200000 - 4 days ago

    I have simplified the code. I made from button 3 a bool. And when true stand_links and when false stand_rechts.

    But got the same problem.

     

    Last edit: edwin200000 4 days ago
  • sgronchi

    sgronchi - 4 days ago

    Well, please explain what values you want O1 and O2 to assume at each point of the following sequences (all starting from not pressed / scratch):
    1. <r1,r2,r3>,P1, P2, R2, R1
    2. <r1,r2,r3>,P3, R3, P3, R3
    3. <r1,r2,r3>,P3, R3, P1, R1
    4. <r1,r2,r3>,P1, R1, P3, R3
    5. <r1,r2,r3>,P1, P3, R3, R1, P3, R3, P1, R1
    6. <r1,r2,r3>,P1, P3, R1, P1, R3, R1</r1,r2,r3></r1,r2,r3></r1,r2,r3></r1,r2,r3></r1,r2,r3></r1,r2,r3>

    I guess some, based on your post:
    1. <o1f-o2f>,O1T-O2F, O1T-O2T, O1T-O2F, O1F-O2F
    2. <o1f-o2f>,O1T-O2F, O1T-O2F, O1F-O2T, O1F-O2T
    3. <o1f-o2f>,O1T-O2F, O1T-O2F, O1T-O2T, O1F-O2T
    4. <o1f-o2f>,O1T-O2F, O1F-O2F, O1T-O2T, O1T-O2T</o1f-o2f></o1f-o2f></o1f-o2f></o1f-o2f>

    <whatever> = initial condition
    Px = pressed button x (either momentary or latching)
    Rx = released button x (either momentary or latching)
    Oxy = output x has state y (T = on, F = off)</whatever>

    Button 1 and 2 are latching, button 3 is momentary

     

Log in to post a comment.