News:

  • May 02, 2026, 09:36:00 PM

Login with username, password and session length

Author Topic: SET's and OUT's in stages  (Read 14550 times)

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
SET's and OUT's in stages
« on: January 24, 2013, 11:24:31 AM »
Can someone please explain this for me. I'm running low on sleep so I might be missing something.

Open the attached program and load it in the simulator, when C1 is turned on it will reset itself and run the program through one loop. I would expect C0 and Y0 to be on when it is done, but it is not. I placed an INC at the end to confirm it is going through the loop.
Thanks
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: SET's and OUT's in stages
« Reply #1 on: January 24, 2013, 11:53:27 AM »
Remember that, once you JMP from a Stage, one final pass is made on the next scan to turn off any outputs which are the object of an OUT. The 'turnoff' scan of S1 will be doing that nullifying the effect of S2.

As a test in S2 add a second rung copying the state of Y0 and C0, by means of a SET, to another pair of memory spots. E.g. RST C2, C3, STR Y0, Set C2, Str C0, Set C3

Edit - I added the RSTs of C2 and C3 to the end of S2's first rung. The two conditional SETs were one rung each.
« Last Edit: January 24, 2013, 11:57:18 AM by b_carlton »
An output is a PLC's way of getting its inputs to change.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: SET's and OUT's in stages
« Reply #2 on: January 24, 2013, 12:02:42 PM »
Mr. Nut...you love to color outside the lines don't you? ;)

Bernie is right. Stages manage OUTs, and a handful of other instructions with specific behaviors, using 'termination' code that runs of the following scan. The task behavior you found before was actually due to the termination code not running in the specific case you identified.

Generally you would not want to mix SET/RST and OUT instructions in a Stage program for exactly this reason. And it is reasons like this that some people find Stage confusing. While very powerful, there are a few caveats.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: SET's and OUT's in stages
« Reply #3 on: January 25, 2013, 05:19:49 AM »
Thanks. I figured it had something to do with out's and termination.

 
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com