Announcement

Collapse
No announcement yet.

Multiple triggers needed to a single output

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Multiple triggers needed to a single output

    Good morning folks,

    I'm trying to write my first ever PLC program.

    I've done some reading and understand the complex problems that can occur with triggering the same output with different boolens, or tags multiple times within the same program.
    I get that you need to stick with out/or out, set/rst, or toggle.. and not mix them.

    I need to have the same output triggered on and back off three different times throughout my program. I tried putting them in a 'when called' task, but that changes the way my entire program works. Then i'm also struggling getting those outputs to reset to what I call a 'home' position to run the same short program with a simple start button.

    Does anyone have any suggestions?

    Much appreciated!
    Adam


  • #2
    For each triggering rung end each in an OUT to it own bit location. So three separate bits. Then add a rung toward the end of the program (or at least after the last triggering rung) with the three bit contacts in parallel leading to the actual physical output. If the bits are properly named the logic will be obvious.
    thePLCguy

    Bernie

    Comment



    • #3
      One way to do it.

      You would need to handle what triggers En_ON / En_OFF _AND_ whatever interlocking you need.
      The individual events can be (almost) anywhere in your program. i.e. It might not make sense to put one in a First Scan task

      Code:
      .//event 1
      .          E1_ON         E1_OFF             E1
      .----------] [------+-----]/[---------------(O)
      .                   |
      .          E1       |
      .----------] [------+
      Code:
      .//event 2
      .          E2_ON         E2_OFF             E2
      .----------] [------+-----]/[---------------(O)
      .                   |
      .          E2       |
      .----------] [------+
      Code:
      .//event 3
      .          E3_ON         E3_OFF             E3
      .----------] [------+-----]/[---------------(O)
      .                   |
      .          E3       |
      .----------] [------+
      Code:
      .//all events               
      .                                         PHYSICAL
      .          E1                              OUTPUT
      .----------] [------+-----------------------(O)
      .                   |
      .          E2       |
      .----------] [------+
      .                   |
      .          E3       |
      .----------] [------+
      Describe what you need to accomplish and any important process info.

      I get that you need to stick with out/or out, set/rst, or toggle.. and not mix them.
      Good advice for early to mid-range experience. While we are on this topic, consider Copy Data (CPD) the same as SET/RST. -- ONLY functions when the RUNG LOGIC is TRUE.
      I have mixed them, usually within other program flow-control constructs (FOR loop) to good effect.

      Comment



      • #4
        Excellent! I will try putting some logic to these examples and see where I get. The last bit of code makes the most sense to me, and trigger bits to fire the output. I sure appreciate the feedback and I will keep you updated! Thanks!

        Comment



        • #5
          It sounds like you may have a misunderstanding about the PLC scan cycle. Be aware that all the logic runs over and over again very quickly. Coming from a PC programmer world, this is often called and endless loop. PLCs run in endless loops by design. So you have to think differently than you would when writing code for a program that has a normal start and end.

          Comment



          • #6
            Thank you everyone for the constructive critism. I was able to take everyone's advice and get a functioning process today. I still have one bit that's a bit sporadic.

            Elaborating on what you said Okie PC, it helped change the way I was trying to implement the others suggestions.

            Im sure there is a cleaner more professional way to make the program I have written, but it works. I would like to implement a reset to home bit in the event the process was stopped or cycled incorrect without killing main power. Is there a quick and dirty solution any of you might have? I could upload the program tomorrow for you all, as long as you don't go to rough on me... XD

            Thanks again everyone!

             

            Comment



            • #7
              Youncan trigger an output how many times you want throughout your program. Since the program runs from one beginning to multiple ends depending on how it branches, it will eventually reach and end and then restart from the beginning. The output port is only updated when the program reaches the end and stays on until the next end is reached.

              if you toggle your output on and off 4 times before program ends, the output port will only switch once, being updated at the end of the scan cycle.

              if you want the outpost to switch given different step in your machine cycle, you need to program that step exclusively. Meaning the other toggles of the output are not active at the time the current one is.

              Comment



              • #8
                Originally posted by Genkboy View Post
                I would like to implement a reset to home bit in the event the process was stopped or cycled incorrect without killing main power. Is there a quick and dirty solution any of you might have?
                Make a button that when pressed, or is pressed and held for X seconds, that it turns on a tag. This tag will be programmed in a way to halt execution of the rest of the ladder program and will initiate resets of all the various parts of your machine in a way that it will safely revert back to its ready/start position of a cycle.

                I dont know the exact layout or design of your program, but you could do something like:

                Have your whole program in its own task under the "run when called" category. Have your start/run switch turn on a tag that initiates a "call task" instruction. This needs to stay on so that the task is called continually every scan cycle of the PLC.
                The reset/home button would turn off the tag that is calling your main program task, and run a new second task that is written to reset each part of the machine back to home position. When each part has tripped a sensor for each sections home position then the second task will reset itself and turn off. This will put the machine back to ready to run mode and wait for you to press the run switch.
                Last edited by MikeN; 11-21-2018, 12:12 PM.

                Comment

                Working...
                X