No announcement yet.

Codesys and triggering one output in multiple places

  • Filter
  • Time
  • Show
Clear All
new posts

  • Codesys and triggering one output in multiple places

    Hi all,

    Im currently working my first job out of college and i found myself using codesys. just went to simulate my program and found that my outputs that are triggered in multiple places aren't turning on. a quick test with the visualizer showed me that only the last rung in the scan with that output would determine whether or not it turned on. is there an option in codesys somewhere to tell it that if i trigger the output anywhere in the program i want it on regardless of if other rungs in the program end with a false for the same output.

    the end result is lamp1 is false

    can i turn on lamp1 if either button is pressed without putting them in parallel? i understand in this example it would be trivial to just put the buttons in parallel but my project has multiple programs addressing the same global variable in multiple locations so it becomes rather time consuming very quickly and quite honestly confusing.

    thanks for the help
    Last edited by Riskiest; 02-14-2020, 08:01 PM.

  • #2
    The rule in PLC's with outputs is "The last one always wins".


    1. Use intermediate coils (internal coils) to turn on the outputs
    2. Use series or parallel contacts to turn the output on

    In your example, using an OUT coil, the only way to do it is with series contacts. There are other ways to solve this using Set Coils and Reset Coils.

    button1(true)------>button2(false)------>(OUT) lamp1(true)

    To do it like you had drawn, you would use Set and Reset Coils

    button1(true)------>(SET) lamp1(true)
    button2(false)------>(RESET) lamp1(false)

    Hope this helps.
    If you have an urgent issue, please contact AutomationDirect's Technical Support team. Technical Support: 1(800) 633-0405 or (770) 844-4200 Email Tech Support


    • #3
      ok, yea i'm not having any issue with the set and reset coils i have in the project already. after the frustration subsided i started cracking on with paralleling the outputs, wasn't as bad as i thought it would be.

      thanks for the help


      • #4
        Another method is to use an unconditional RST of each output at the beginning of the scan then use SET at each rung during the scan. Any true rung turns on the output. Note that this is only valid which write to the physical outputs at the end of the scan. Not for asynchronous I/O systems.