Page 1 of 1

Calculating time/duration

Posted: Sun 29. Jun 2014, 03:47
by Mud.AB
Hello,

I have CAN activity in which messages are sent to activate 3 motors and deactivate them. With a standard macro, I want to calculate and display the duration of each motor from start to stop using printToOutputWindow.

I was able to trigger the code on start and stop using waitData for each state, but I cannot find out how to calculate and display the time between two waitData lines. To explain further, the code looks like this:

//wait for motor 1 to start:
waitData 0 1 120h 9 13h 10h * * * * * *
//start calculating time here
//stop calculating time at:

waitData 0 1 220h 9 14h 10h * * * * * *
//display calculated time using printToOutputWindow or any other method

Is it possible to do this with a standard macro? If yes then how? And if no, what alternative is possible?

Thank you.

Re: Calculating time/duration

Posted: Sun 29. Jun 2014, 10:40
by PEAK-Support
when using the standard macros you could not measure any time. for that you need to use VBS macros. It is very easy to do this. if you like we could send you a link to a set of sample codes - please send a request to support[at]peak-system.com.