
adccommunitymod (AutomationDirect) asked a question.
Created Date: September 26,2008
Created By: jondecker76
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
PLC Used: DL05 When I first started using counters (and timers), I greatly over-complicated things. I would use an unused contacts (C20 and C21 for example) to power the counting/timing and reset inputs, use a comparitive contact later in the program to perform some action when the timer or counter reached its value. After some practical experience, I found a method that I prefer to use that saves me from having to use so many contacts to get things done. What some may not realize is that you can use the timer's own status bit to drive its self and reset itsself, saving you from having to manually use contacts to do this. Below is an example of using a counter's own status bit to drive it, and reset it. (this also works with timers). In this example, we are going to increment a memory location every 100 counts. Example using CT1 //Reset the counter if it has reached its reset setpoint - CT1--------------------------(RST)CT1 //Drive the timer using its own status bit (count if it hasn't yet reached its reset setpoint) //Disable the external reset input using SP2, as we reset it in the above step - CT1--------------------------|CNT CT1| - SP2--------------------------| K100| //We can now check to see if its time to increment our memory location -- CT1-------------------------|INC V2000| As you can see, we used no extra resources to have a useful counter that does something every X counts. It uses its own status bit to drive its self, to reset its self, and to do something at the set interval.
Created Date: September 26,2008
Created by: jondecker76
PLC Used: DL05
When I first started using counters (and timers), I greatly over-complicated things. I would use an unused contacts (C20 and C21 for example) to power the counting/timing and reset inputs, use a comparitive contact later in the program to perform some action when the timer or counter reached its value.
After some practical experience, I found a method that I prefer to use that saves me from having to use so many contacts to get things done.
What some may not realize is that you can use the timer's own status bit to drive its self and reset itsself, saving you from having to manually use contacts to do this. Below is an example of using a counter's own status bit to drive it, and reset it. (this also works with timers). In this example, we are going to increment a memory location every 100 counts.
Example using CT1
//Reset the counter if it has reached its reset setpoint
- CT1--------------------------(RST)CT1
//Drive the timer using its own status bit (count if it hasn't yet reached its reset setpoint)
//Disable the external reset input using SP2, as we reset it in the above step
- CT1--------------------------|CNT CT1|
- SP2--------------------------| K100|
//We can now check to see if its time to increment our memory location
-- CT1-------------------------|INC V2000|
As you can see, we used no extra resources to have a useful counter that does something every X counts. It uses its own status bit to drive its self, to reset its self, and to do something at the set interval.