Internet PLC Forum
General => Technical support => Topic started by: rosssyscon on September 10, 2003, 06:03:39 AM
-
I am having some diffculty with the exact operation of the [DNCtr]. I am using it as a simple timer for a motor. When it times out, motor stops. I am using the built in Clk:1.0s to decrement the counter. I am using the SetCtrSV function to set the timer value.
Issues:
1) I need to be able to adjust the time on the fly. However, I can't seem to move a new value into the counter until it has been reset. ?
2) When the counter is reset, the CtrPV is equal to -01. Is there a better way to do what I am doing?
Thanks,
-
Normal use of a down counter is by means of the output coil -----(CTR) instead of [DNctr]. The latter is meant to be a ring counter which will roll over to the setvalue when it hits zero.
When a counter is reset, it is internally loaded with -1. That's how it is represented.
You can change the counter value anytime by assigning it with a new value in custom function:
CTRPV[1] = 123 ' set the present value of the counter to 123.