Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: sgsims on August 26, 2016, 09:17:47 AM

Title: CTR in a Stage
Post by: sgsims 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.
Title: Re: CTR in a Stage
Post by: plcnut 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.
Title: Re: CTR in a Stage
Post by: sgsims on August 26, 2016, 09:45:43 AM
Sorry I meant CNT
Title: Re: CTR in a Stage
Post by: plcnut 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.
Title: Re: CTR in a Stage
Post by: sgsims 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.
Title: Re: CTR in a Stage
Post by: BobO 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.