CTD vs CTU

dbh6

Lifetime Supporting Member
Join Date
Jan 2013
Location
Central, NJ
Posts
552
Hello all, in RSLogix 5000 software i usually say you program a up counter to count up each seconds, its pretty straight forward to do with the up counter once you give a preset Ex. 60, the counter starts from 0 and counts up to 60. Say i wanted to do the same thing with the CTD down counter if i put a preset of 60 it doesn't count down from 60 but rather counts down from 0 and then -1,-2, etc. Is their a way around this using the down counter in logix 5000 so when you enter a preset of 60 it counts down from that value??
 
The counter Preset value .PRE is just a value at which the .DN bit comes on, it has nothing to do with the counting function at all.

CTU or CTD operate exactly the same way (except of course CTU increments the .ACC, and CTD decrements it).

The counter will always RESet to zero, and doesn't stop counting at the Preset value, unless you program the logic to stop it with the .DN bit.

Two ways of displaying "time-remaining" (at least that's what I think you want)....

1. Use a CTU, with .PRE = 60 : Display the difference between the .PRE and .ACC (use a SUB instruction).

2. Load the .ACC with 60 before use, and use a CTD.

HTH
 
The subtraction is what i have used to do the counting down Ex. Say pre of the CTU is 60 then (CTU.PRE-CTU.ACC) = Minutes Remaining, i just thought their was a way the CTU can decrement from a preset but thanks for clearing that up.
 
as for your second point loading the CTD's acc with 60 then counting definitely works, just have to do little bit more programming on reseting it correctly and knowing when to correctly load the 60 back into the .pre of the CTD
 
Here's another way....

from a RESet the .ACC will be zero (easiest)

display .ACC + 60, and use a CTD
 
Daba you said "from a reset", from what reset are you referring to? could you be a bit clearer??
 
RES instruction on a counter sets the .ACC to zero.

so the latest post is easier, Count DOWN from zero, and ADD whatever time you are targeting (eg. 60)

0 + 60 = 60
-1 + 60 = 59 ...
-30 + 60 = 30
-59 + 60 = 1
-60 + 60 = 0

You can use the Math Z flag (S:Z) after the add to signal "time-up".
 
Have you tried using a -60 as the preset?

The Preset is not the issue. dbh6 just wants to display "time-remaining" when using a clock driven counter.

There's lots of ways to do it, just poking a few at him, he can choose his favourite
 
The subtraction is what i have used to do the counting down Ex. Say pre of the CTU is 60 then (CTU.PRE-CTU.ACC) = Minutes Remaining, i just thought their was a way the CTU can decrement from a preset but thanks for clearing that up.

I read it....
 
@mickey yes, but if you use a .pre of -60 for the .pre the .dn bit of the CTD will be set because if the .acc is greater or equal to your preset.
 
Proficy machine edition software for GE does this much better, their version of the Down counter actually counts down from a preset, Come on allen bradley!!
 
Which is why I said use S:Z after the ADD to say "time-up".
 
Last edited:

Similar Topics

There has been posts on this before I guess I have used down counters in Siemens quite easily. But with RSlogix I am finding it difficult. I am...
Replies
11
Views
3,024
Hey, I have no experience what so ever with Quick Panels. I have Proficy Machine Edition 5.50 Software on my lap top. I have the Cimplicity...
Replies
2
Views
1,861
Hey, I have no experience what so ever with Quick Panels. I have Proficy Machine Edition 5.50 Software on my lap top. I have the Cimplicity...
Replies
1
Views
1,874
Integrated Circuit Temperature Device. I have to connect five of these doo-dads to PLC 4-20mA inputs, but I am not having any luck finding...
Replies
2
Views
1,954
I am trying to use a CTD to count down for 10 counts, but when the CTD is triggered the accumulated value starts counting down from 0 then goes to...
Replies
2
Views
4,519
Back
Top Bottom