Conversion type time to real
I'm developing a program and I need convert a variable to type time to real.
How to do this using text structured?
Thanks in advance!
Voted best answer
Coversion from Time_to_real is the basic function available so it is as simple as you can get.
I will explain it with an example.
Define 2 Variables Say Test 1 - Time(datatype)
Test 2 - Real(datatype)
Then the expression in ST will be :
Test 2 := Time_to_Real(Test1) ;
Note one thing that the Real Value will be equivalent to the miliseconds. Say for e.g Test 1 Value is 1 Second then Test 2 Real Value will be 1000.
I hope it answers the question.