Ben H

Time T# to HH:MI:SS in CCW/Micro820

4 posts in this topic

Hi Guys,

Hoping someone can help me out.  I have a time variable, which stores the elapsed time of a timer.  I want to convert this to HH:MI:SS format so I can display on a LCD panel.  Couldn't find an easy way to do this.

Thanks in advance,

Ben.

Share this post


Link to post
Share on other sites

use the [any to Dint] and save that to a variable to use for holding the time in a dint then it should give you time in ms i believe, so divide by 1000 and you have seconds, divide by 60 and you got minutes and if it is in the hours then divide by another 60 to get hours. just make sure the time value is not larger then a DINT can hold I guess or it will be a roll over and error or wrap the value around either is bad. then for a display of seconds remainging take the seconds variable and subtract ((hours * 3600) + (minutes * 60) and the result is the left over seconds because your taking off the seconds worth of minutes and hours from the total seconds value giving you the remainder. hopefuly this is enough to get you going.

Share this post


Link to post
Share on other sites

there is a RA example of this on the examples webpage for CCW at their webpage.

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