News:

  • October 13, 2025, 09:25:45 AM

Login with username, password and session length

Author Topic: How to "Cleanly" Disable Stages  (Read 3049 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 585
How to "Cleanly" Disable Stages
« on: December 27, 2020, 12:15:52 AM »
I'm attempting to use a SG with a TIMEPROP inside of it. I'm also using a SGSET/SGRST in another stage to control this stage. Apparently the TIMEPROP uses some form of latch. I noticed that when I call the SGRST from the other stage, the output of the TIMEPROP "hangs" on (the same as if it were a latch). Is there a "clean" way to disable the SG with the TIMEPROP from another stage and have it turn off the outputs from the TIMEPROP at the same time?

Edit: It looks like one way to do this is to make a dummy variable for the TIMEPROP output and use that output as a NO into an OUT coil for the desired bit that I'm trying to control.
« Last Edit: December 27, 2020, 12:35:41 AM by RBPLC »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: How to "Cleanly" Disable Stages
« Reply #1 on: December 27, 2020, 01:09:36 AM »
I'm attempting to use a SG with a TIMEPROP inside of it. I'm also using a SGSET/SGRST in another stage to control this stage. Apparently the TIMEPROP uses some form of latch. I noticed that when I call the SGRST from the other stage, the output of the TIMEPROP "hangs" on (the same as if it were a latch). Is there a "clean" way to disable the SG with the TIMEPROP from another stage and have it turn off the outputs from the TIMEPROP at the same time?

Edit: It looks like one way to do this is to make a dummy variable for the TIMEPROP output and use that output as a NO into an OUT coil for the desired bit that I'm trying to control.

TIMEPROP in a stage definitely has the potential for trouble. I would put it above the first stage and drive with an intermediate bit via OUT instruction in the stage.
"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

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Re: How to "Cleanly" Disable Stages
« Reply #2 on: December 27, 2020, 10:43:23 AM »
What's the possibility of having an instruction that disables not only OUT within a stage but also SET and any other function with latching type behavior?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: How to "Cleanly" Disable Stages
« Reply #3 on: December 27, 2020, 11:56:29 AM »
What's the possibility of having an instruction that disables not only OUT within a stage but also SET and any other function with latching type behavior?

That's really the only difference between OUT and SET.

As for TIMEPROP, I think the terminator logic isn't correct. It should be cleaning it up, and it doesn't. Easy fix.
"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

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Re: How to "Cleanly" Disable Stages
« Reply #4 on: December 27, 2020, 12:49:19 PM »
"That's really the only difference between OUT and SET."

I don't understand what this means.

It would be nice to have an instruction that would force all "output" type instructions in a stage to their off state. At current time OUT's are turned off and SET's are left in whatever state they're currently in when a SGRST is used. This is a good action for a majority of applications I suspect. The addition of a separate instruction that would RST all latches and force all outputs to zero (and potentially set Words and Reals to zero) would allow a separate stage to act as a supervisory stage and disallow all output actions associated with words and bits within a slave stage in the event that the supervisory stage "turned off/overrode" all of the output bits/words. Also, having a HALT type instruction that would do they same would be useful for the same reasons.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: How to "Cleanly" Disable Stages
« Reply #5 on: December 27, 2020, 01:02:07 PM »
I don't understand what this means.

An OUT and SET are internally very similar. One significant difference is the termination logic, which is what shuts off outputs when stages or code blocks end.

If there are specific instructions which are not terminating as intended, we can easily change that. TIMEPROP was not, but really should be. Easy fix. A generalized instruction that affects the behavior of other instructions is simply not feasible.
"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

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3601
  • Darth Ladder
Re: How to "Cleanly" Disable Stages
« Reply #6 on: December 27, 2020, 05:19:09 PM »
It would be nice to have an instruction that would force all "output" type instructions in a stage to their off state.

SET doesn't have an "off state"; it can only do two things, set and don't set.   Sometimes that's the behavior you want and that's why SET & RST exist.  If you don't want that, use an OUT.   And it's not just in stage, those instructions are for different things in general ladder too.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: How to "Cleanly" Disable Stages
« Reply #7 on: December 27, 2020, 05:46:59 PM »
It would be nice to have an instruction that would force all "output" type instructions in a stage to their off state.

SET doesn't have an "off state"; it can only do two things, set and don't set.   Sometimes that's the behavior you want and that's why SET & RST exist.  If you don't want that, use an OUT.   And it's not just in stage, those instructions are for different things in general ladder too.

Precisely correct.
"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