CTD vs CTU

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!!

Don't have a "downer" on A-B.

Different manufacturers do things differently, and you just have to use whatever they give you.

If the built-in counting instructions in A-B controllers don't do what you want you can always program your own counting functions. From V16 onwards you can use an AOI (Add-On Instruction) and do whatever floats your boat.

Personally I see nothing wrong with the supplied counter instructions, you can do just about anything with them with a little bit of code around them.

I've given you some ideas, you choose what is best, and easiest to implement, in your case.
 
@Daba or Mickey this is a question related to what we have discussed thus far, so i have a CTU thats counting up number of seconds when it reaches sixty it reset and starts counting again, also i'am using the .DN bit of the one sec CTU to another CTU counter thats going to serve as my one min CTU. So every time the .DN bit of the one sec CTU goes true the one min CTU increments by one and that also resets at 60 which is really 60 mins = 1hr. Then i have another CTU counter for my number of hours so each time the .DN bit of the one min counter goes true the hour CTU increments by one. The hour CTU is not reset when a preset is reached but rather when a Normally open push button is set.

Now the question,
i am using this to display time remaining on the agitators run time before they can service the agitator. The Preset time the customer requested is 30 hrs.
the remaining time has to be displayed on the HMI for hours and minutes COUNTING DOWN! notice how so far my counters are up counters.

So logic wise to display the remaining time i subtracted 60 from the one minutes CTU.ACC to display RUNTIME MiNUTES . For the Hour CTU i used the preset of 30 subtracted by the .ACC of the Hour CTU to display REMAINING HOURS. Lastly i also used a rung such that when the RUNTIMES MINUTES tag = 60, I moved a 0 into RUNTIME MINUTES because when you are counting down say you are at 30:01 you would expect the next number to be 30:00, but the number jumped to 29:60 make sense.

Now finally the problem i'am having looks like this. Say you reset the counter and start counting down this is what my count down looks like
1. 30.00
2. shoulf display 29.59, but diplays 29:00, then after a minute elapses displays 29:59 then it counts down normally, thats basically where i am stuck on i even tried it on different intervals say at 13:00 next number is 12:00 instead if 12:95 then after a minute elapses displays 12:95, ive tried different thing but so far they lead to nowhere help would be nice. Sorry for the long post just wanted everything out their
 
see if the ideas here will help ... I knocked this together while waiting for another project to "settle out" so I can't guarantee that it's exactly what you want - but if it's not, you should be able to massage it into what you need ...

note that this is based on my understanding that you want to start with some amount of time (specificed in hours and minutes) and display the Hours and the Minutes that are remaining - as the clock ticks down ...

.
 
Last edited:
Thank you Ron for your time, I will check out the code and let you know how it worked out, thanks
 
Just treat this like a math problem. Accumulate your runtime as you have been.
Let's say that the agitators have been running for 16 hours, 37 minutes, and 23 seconds. We need to turn that 37:23 into a fraction of an hour.

23/60 = 0.38mins
37.38/60 =. 623 hrs
30.0 - 16.623 = 13.377 hrs remaining
.377 * 60 = 22.62 mins
. 62 * 60 = 37.2 secs

So your display will show 13 hrs, 22 mins, and 37 secs. I would only perform this calculation once a second, or minute, depending on the resolution necessary
 
There are two threads on using counters as timer registers - I know this works, and is an "old school" method of keeping time in different registers. RSL5000 uses a millisecond timer which at first I hated, but it is fairly simple to use.

The conversion to different registers can be done with a timer, and some math. This might be more "scan time consuming" than using counters, I'm not sure. Coming directly off a timer seems easier to me though, and using counters may seem easier to other people.

I had a semi-argument with a fellow programmer regarding setting a timed alarm. He wanted to use a counter, to count the "bits" of the discrete device, I went with a timer, which to me, seemed easier. And it works.
 
@ Ron i duplicated your code, works nicely :) i just had to add in logic to reset the hour time back to its preset when its timing is done. Thanks once again.
 
i just had to add in logic to reset the hour time back to its preset when its timing is done.

I figured you'd move the desired value in by having the operator press a button when he wanted to start the next cycle - or something along those lines ...

glad it worked ...
 

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,058
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,872
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,886
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,960
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,668
Back
Top Bottom