Converting Do More Timer to Red Lion format

ODUAE08

Member
Join Date
Nov 2015
Location
Virginia
Posts
1
Having trouble writing a string to convert the millisecond timer from a Do More to an HH:MM format on a Red Lion G315. Have tried writing the string in the Do More however, it will not transfer to the Red Lion.
 
Having trouble writing a string to convert the millisecond timer from a Do More to an HH:MM format on a Red Lion G315. Have tried writing the string in the Do More however, it will not transfer to the Red Lion.

This is a *very* simple program to convert seconds to mm:ss. You can modify it to work with milliseconds pretty easily. I have written more complex and better versions, but this should get you started. Arg1 is an integer passed to the program in Integer format. It includes the ability to modify it to include hours.

I haven't used this version in years, so play with it to verify it works in all situations - as I said, I have made more complicated ones than this, but I think it meets your needs. This should be called from a String Tag and the parameter passed should be an Integer Tag in seconds. I would think you could just divide milliseconds by 1000.

//converts a value in seconds to a string formatted "mm:ss"

//declare local variables
cstring val;
int hours;
int minutes;
int seconds;

//convert argument (Arg1)to hours, minutes, and seconds
hours = Arg1 / 3600;
minutes = (Arg1 % 3600) / 60;
seconds = Arg1 % 60;

//put the current run time total into mm:ss format
val = IntToText(minutes, 10, 2) + ":" + IntToText(seconds, 10, 2);

return val;
 

Similar Topics

I am very green at PLC programming. I have a program with 135 rungs running on a Direct Logic DO-06DR. I am wanting to remote control and remote...
Replies
11
Views
3,573
I am in the process of converting a bunch of old SLC 5/03s to AD DoMore H2s. I am sure people have done this before so I was just looking for...
Replies
2
Views
1,718
Hello everyone, can anyone help me with covert the STL code to ladder. Iam using plc s71200. A %DB1.DBX33.7 // angel of vaccum...
Replies
2
Views
201
Hello PLCs Forum, I am in a bit of a pickle and was hoping someone could offer me some help. I have a .rss file and just need to see the ladder...
Replies
2
Views
119
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
308
Back
Top Bottom