News:

  • August 24, 2026, 07:25:59 AM

Login with username, password and session length

Author Topic: CTR in a Stage  (Read 11947 times)

sgsims

  • Hero Member
  • *****
  • Posts: 127
CTR in a Stage
« on: August 26, 2016, 09:17:47 AM »
I seem to recall some rules for placing a CTR instruction inside of a stage.  Also is it bad practice to use the timer.done bit on the reset leg of the same timer?  I'm doing both of these things inside of a stage and things are not working as I intend.

plcnut

  • Hero Member
  • *****
  • Posts: 815
    • premiersi.com
Re: CTR in a Stage
« Reply #1 on: August 26, 2016, 09:40:18 AM »
I seem to recall some rules for placing a CTR instruction inside of a stage.
Do you mean TMR? or are you talking about CTRIO instructions?

Quote
Also is it bad practice to use the timer.done bit on the reset leg of the same timer?
This is perfectly fine. The other option is to use the RSTT instruction if that is cleaner for you.
Circumstances don't determine who we are, they only reveal it.

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

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: CTR in a Stage
« Reply #2 on: August 26, 2016, 09:45:43 AM »
Sorry I meant CNT

plcnut

  • Hero Member
  • *****
  • Posts: 815
    • premiersi.com
Re: CTR in a Stage
« Reply #3 on: August 26, 2016, 09:48:26 AM »
From the help topic:
Quote
Termination Scan Behavior:

If the Up Counter instruction is contained within a Program, a Task, or a Stage, the Up Counter will automatically be reset during the termination scan of that Program, Task, or Stage.

 

Refer to the Help topic on Termination Behavior for detailed information on the programming elements that have termination logic.
Circumstances don't determine who we are, they only reveal it.

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

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: CTR in a Stage
« Reply #4 on: August 26, 2016, 11:17:32 AM »
I think my issue had more to do with how to get the Edge Triggered behavior of the CNT Inst to work with my application rather than the fact that is was located in a stage and the .done bit toggling the RST leg of the timer.

I think I should really be looking at using the INC instruction for my application since it is Power flow based.  A subtle but important difference that I overlooked.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: CTR in a Stage
« Reply #5 on: August 27, 2016, 12:05:55 PM »
I think my issue had more to do with how to get the Edge Triggered behavior of the CNT Inst to work with my application rather than the fact that is was located in a stage and the .done bit toggling the RST leg of the timer.

I think I should really be looking at using the INC instruction for my application since it is Power flow based.  A subtle but important difference that I overlooked.


I frequently use INCs with edge contacts for simple stage or event counting.
"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