Benji000

day counterdown

9 posts in this topic

Hello i need to make a program something that counts down 365 days from a set date. and i cant really find a instructions for it, does anyone know a way to program something like this

thanks for any help

Edited by Benji000

Share this post


Link to post
Share on other sites

Hello Ben, you may use DT compare function e.g. is listed in the SS that is counting 365 days from today date but you may change it at your convenience. Once scheduled task is done you can refresh and start next cycle.

immagine_2022-03-18_102113.png

A.jpg

1 person likes this

Share this post


Link to post
Share on other sites

The question is not clear.
Do you need to calculate a date that is 365 days before a set date?
If so, use CSUB instruction and subtract 8760 hours, which is 365 days.

Share this post


Link to post
Share on other sites
On 2022-03-18 at 1:04 PM, Sergei Troizky said:

The question is not clear.
Do you need to calculate a date that is 365 days before a set date?
If so, use CSUB instruction and subtract 8760 hours, which is 365 days.

Sorry if my question was a bit unclear. So basically im creating a service function and i need to find a way to keep track of real time clock firstly 365 days and later on im going to have a pop up screen for around 14 days and then reset everything and it should start counting a new year. Hopefully i made it a little bit clearer

Share this post


Link to post
Share on other sites
On 2022-03-18 at 10:05 AM, suresh_ said:

Hello Ben, you may use DT compare function e.g. is listed in the SS that is counting 365 days from today date but you may change it at your convenience. Once scheduled task is done you can refresh and start next cycle.

immagine_2022-03-18_102113.png

A.jpg

Thank you for the help i will definitely try this way thanks. 

Share this post


Link to post
Share on other sites

hello Benji,I think you can easily fit this logic to your needs , however you have to decide if your customer should be allowed or not to adjust (or tapering...) Clock settings from HMI. Finally using H register instead of D can preserve your setting in case of persistent power failure. 

1 person likes this

Share this post


Link to post
Share on other sites
25 minutes ago, suresh_ said:

hello Benji,I think you can easily fit this logic to your needs , however you have to decide if your customer should be allowed or not to adjust (or tapering...) Clock settings from HMI. Finally using H register instead of D can preserve your setting in case of persistent power failure. 

Yh my coustmer is going to be able to adjust when they want to have the service can be activated

Share this post


Link to post
Share on other sites
27 minutes ago, suresh_ said:

hello Benji,I think you can easily fit this logic to your needs , however you have to decide if your customer should be allowed or not to adjust (or tapering...) Clock settings from HMI. Finally using H register instead of D can preserve your setting in case of persistent power failure. 

Sorry if im being a bit annoying but can you tell me what you connect to what in the instructions bit. if you have some time 

Share this post


Link to post
Share on other sites

hello Benji, the basic concept is: once you set up your logic, you need to refresh it automatically every 365 days. First you have to set D0 that is control word for DT instruction and get rid of sec, min and hours. After that  you have to define your control logic and register it to PLC activating  W90.00 ( this can be done during commissioning or by the Client from HMI ) : clearly this has to be done automatically every 365 days. In the example given, today date is frezeed and MOV to D or (better) H register . To specify 365 days requirement  you may ADD #100 to D353 (meaning increment 1 Year =365 days ) and compare it with present date in the DT instruction. After 1 year from today date W0.00 will be ON triggering whatever actions you need. After your task is done W90.00 need to be refreshed again so the new date will be freezed for the next cycle. To check your logic you have to start simulation, go to Clock section in the Project workspace, manually increment the date by 1 year ( actually few seconds less) and see, after few seconds, if DT will set ON its output or not. If your logic is different you have to set up BCD data you need and MOV it to register, increment it by 1year and send to DT function as usual: DT function will  operate the timer accordingly. I hope it help.

1 person likes this

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