Sign in to follow this  
Followers 0
bill n tn

converting timer to display minutes and seconds

4 posts in this topic

I am creating a count down timer in a control logix , I have subtracted the acc from the preset and dumping this in a dint called remaining time and i want to display this in minutes and seconds. I can get the minutes working but I am having trouble with the seconds. I am div the remaining time by 60000 to get the minutes and putting this into a dint called minutes. I have tried div tag minutes buy 1000 and this does not work. I am displaying this in a PV+. I am fairly new to Allen Bradley, any suggestions?

Share this post


Link to post
Share on other sites
Okay let me lay out what I am reading from your post. 1. You have a tag called CountDownTimer. 2. You are doing math as follows : CountDownTimer.PRE - CountDownTimer.ACC = TimeRemaining {type DINT} 3. You are doing math as follows : TimeRemaining DIV 60000 = MinutesRemaining {type DINT} 4. You need to do the following math to get the SecondsRemaining {type DINT} 4a. TimeRemaining DIV 60000 = MinutesRemainingFloat {type REAL} 4b. MinutesRemainingFloat {type REAL} - MinutesRemaining {type DINT} = SecondsRemainingFloat {type REAL} 4c. SecondsRemainingFloat {type REAL} MUL 60 = SecondsRemaining {type DINT} Hope the above is clear enough. There are other ways but this one will do.

Share this post


Link to post
Share on other sites
at one time I was using the real(floating point) but I was div by 60 instead of multiplying. Thanks for the help!!!!!

Share this post


Link to post
Share on other sites
Glad to assist. Please let us know when you get it working or if you need more help. And Welcome to MRPLC.

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