Industry Online Support
Technical Forum
3/10/2008 7:18 PM | |
Posts: 13 Rating:
|
Hi, i need to know how converter a floatvariable in a variable of time. Thank You. |
3/10/2008 10:24 PM | |
Posts: 2661 Rating:
|
You can do this by first converting the floating point number to a fixed point number and then using the standard function TIM_S5TI (FC40: Time to S5TIME). Sample STL code attached. Please note the following: 1. The maximum time value for an S5TIME variable is 9990s. Hence you shouldmake sureyour floating point variabledoes not exceed9990000.0 (ms). 2. The best possible accuracy for S5TIME is 10ms. Therefore you'll see rounding off for certain time values. For example 10552.0 (ms) will get converted to 10s_500ms. AttachmentF_TO_S5T.zip (591 Downloads) |
Follow us on