Author Topic: Counter  (Read 12047 times)

rosssyscon

  • Newbie
  • Posts: 6
  • Thanks for the help!
    • View Profile
Counter
« 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,
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Counter
« Reply #1 on: September 10, 2003, 11:11:08 AM »
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.

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS