bespoken (Customer) asked a question.

Using a n/o input switch for an on or off function.

I am using a button/switch which will be connected to an input on the PLC. The switch is n/o. I can have that switch energize an output with one press up the button. I would like to have that same switch be able to turn off that output after holding the button for a specified time (say 2 seconds). Somewhat of a toggle, but with a time function.

 

Any ideas on how to program this?

 

Using a P1000.

 

Thanks,

 

Scott

 

 


  • CLIFF T (Customer)

    Could you use a timed coil for your output?

  • z28z34man (Customer)

    I would use a NO rising edge contact to a set coil and a no contact to a simple timer and have the output of that timer to a reset coil.

    Edit

    With the setup I mentioned if in the off state and the button is pressed and held it would be on for the timer amount then turn off. If this is not ​desirable use a NO falling edge contact and a NC done on the set coil rung

     

    Edit 2

    this shows what i was talking about. the normally closed TimerDN bit prevents the output from coming on if it is started in an off state and the button is pressed for more than 2 seconds

    Automation Direct-2020-11-03-07-52-35 

    Expand Post
  • kewakl (Customer)

    Here is a snippet of a Digital output to relay test procedure that I use in some of my projects.

    Maybe you can use some of it for your purpose.

     

    DI-0.1.1.1 is a N.O. PB.

    Out() is an array that is mapped to the physical outputs (the testing program has 100 digital outputs, I included one CPD instruction for the first output card.

    ptr_relay is a count for which relay the math points to

    When the button is released, the math counts to the next value (pointing to the next element of the array, and thus, to the next physical output)

    If the button is held for 1 second, the count is cleared and any output that might have been on, is turned off.

     

    I do not use this in operation of equipment, it is a post-build test procedure to verify that each of the 100 outputs are wired to the correct relay.

    Expand Post
    • DIO-Relay connection test
  • RobAus (Customer)

    CaptureMaybe something like this.

    Expand Post
  • Garry (Customer)

    Hi bespoken,

    This is similar to a flip flop circuit, but as you said with a timer.

    https://accautomation.ca/creating-a-flip-flop-circuit-in-the-plc/

    Here is some logic that will work as you indicated.

    P1000 Flip Flop with TimerI've used the simulator to test the circuit.

    Attached is the simple program.

    Here is a link on how to use the simulator.

    https://youtu.be/9TyA5FOcvrE

     

    I hope this helps you out.

    Regards,

    Garry

     

    https://accautomation.ca/series/productivity-1000-plc/

    Expand Post
  • kewakl (Customer)

    This is a good example of:

    Ask 10 programmers and get 10 different approaches.

     

    I admit, I did not put forth much effort in this, I already had existing code that does something similar to OP's request.

     

    @bespoken (Customer)​ , I hope one or more of these examples can help you on your way!

    • Garry (Customer)

      "Ask 10 programmers and get 10 different approaches"

      Well put kewakl

       

      Garry

  • Todd Dice (Customer)

    Toggle coilI'd use a toggle coil.

    Expand Post
  • bespoken (Customer)

    Thanks for all the suggestions! I will try them out later this week. Need to get the wiring done and the PLC running a basic program that I have for my immediate needs.

     

    Scott