Sign in to follow this  
Followers 0
DaProgrammer

Long totalizing timer function needed

12 posts in this topic

Using CX-One I need a function to track total time that a specific output is turned on. When the output is off I need the timer to stop but retain its value and reset only on demand. This is a filter change function for an intermittent pump that will need send a flag after say 40 hours of actual pump on-time to instruct the user to change the filter. The standard timers zero out when the execution condition turns off and the TTIM counter maxes out at 999.9 seconds. Can anyone help with this? Edited by DaProgrammer

Share this post


Link to post
Share on other sites
DA Have you considered using a (1 minute) timer in conjunction with a CNTR (reversible counter) to accumulate your time? I think it will work. I have done something similar with AB. Everytime the timer times out you can use a one-shot (UP) to increment the counter and a work bit to reset the timer. Does this make sense? D2B

Share this post


Link to post
Share on other sites
Or just increment a register, and only reset the register when required...

Share this post


Link to post
Share on other sites
Thanks, the 1 minute TIM>>CNTR approach should work just fine.

Share this post


Link to post
Share on other sites
I think that lostcontrol idea was better because in case of power lost, timer and counter are reseted. All you need is a 1 min pulse flag and an increment instruction. Comparison and reset to zero when value reached.

Share this post


Link to post
Share on other sites
Thats actually slightly simlpler but as a rookie programmer I want to clarify this - an Increment instruction retains its value even in the event of a power loss?

Share this post


Link to post
Share on other sites
As long as you Increment D memory, the value will be retentive.

Share this post


Link to post
Share on other sites
CNT and CNTR are data retentive.

Share this post


Link to post
Share on other sites
With the function @INC or @++ or @++L (depending on the PLC) you can increment either a DM (retentive) or CIO channel (non-retentive) as you wish - ++L is long. To reset just MOV #0000 or MOVL #00000000 into the counting channel. Use @ or the channel will increment while ever the closk pulse is on giving you 'unexpected' results.

Share this post


Link to post
Share on other sites
I regularly use the totalising timer funtion for pump minute counters along with a long word increment, incrementing 2 DM words. The only problem with your 1 minute counters is that the output could run 50 seconds then go off, start again and start counting the timer from the start again, hence losing best part of a minute. Over enough cycles the filter could run miles out of spec. Use BSET function to reset once the filter has been changed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0