Sign in to follow this  
Followers 0
electric101

Monthly Bit Reset

9 posts in this topic

Im working on a way to reset a RTO (retentative timer) that counts how long a motor runs above alarm current levels and keeps a record of the highest current recorded... currently it just counts forever but

I want to reset it each month... and to possibly move data into monthly registers to evaluate and compare.   I have my GSV setup monitoring the clock and am trying to think of a way to monitor my WALLCLOCK[1] DINT that houses the month (Currently 2)   I want to trigger a reset anytime that DINT  changes state.... any ideas?? 

Share this post


Link to post
Share on other sites

here is an image of the part of the code im working on.... this was all designed and modified years ago by germans and the only modifications I've made so far is adding the system clock on line 40

mill.PNG

Share this post


Link to post
Share on other sites

Maybe something like this?

Oops - That should be wallclock[1]

 

Steve

wallclock.jpg

Edited by nehpets

Share this post


Link to post
Share on other sites

Thanks nehpets,

that was just the inspiration I  needed I think.  I didn't understand the adding 1 to an index but check out what I have now, I think it gets done what I need... i'll just have to extract the data each month before the rollover.

 

 

thanks again

Share this post


Link to post
Share on other sites

new_mill.PNG

Share this post


Link to post
Share on other sites

The Variable 'index' is incremented to increment the array, so on the first iteration of the rung, the value you want to save would be written (MOV'ed) to 'month_store[0]' then 'index' would be incremented so that on the next iteration of the rung the value to save would be written to 'month_store[1]' etc. etc.

I noticed that the value you are saving is a REAL, the example I've shown is using a DINT you may or may not want to change this.

To save Hi_Amp_in_Minutes Move to month_store[index]

To save Highest_Amp_Temp_Storage Move to month_store[index+1]

Put in the ADD and change the add to 2

Steve

Share this post


Link to post
Share on other sites

Look up the DTR (Data Transitional) instruction.

It will provide a one-shot action on any change.

Share this post


Link to post
Share on other sites

thanks guys, I love learning cool stuff like that.

Share this post


Link to post
Share on other sites

You can archive the monthly totals by moving the data into an indexed array, with logic to reset the indexer and start over.

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