[?]: Convert "Floating_Point"=>"Time"

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
hoangnguyen1986
Posts: 33
Joined: Thu Mar 27, 2008 2:18 am
Location: Vietnam
Contact:

[?]: Convert "Floating_Point"=>"Time"

Post by hoangnguyen1986 »

I got a problem with my project.
I must be convert my data from a memory location (ex: MD40 ) with the data type is "Real"
to another location (ex: MD50) with the data type is "Time".
Please help me!
How can i covert data from "Real" type to "Time" type
Thanks so much!
Schtiel
Site Admin
Posts: 1122
Joined: Wed Sep 06, 2006 12:03 pm
Location: CIS

Post by Schtiel »

A variable with data type REAL is a fractional number which is stored as a 32-bit floating point number.

A variable with the data type TIME occupies one double word. The contents of the variable is interpreted as milliseconds and is stored as a 32-bit fixed point number.

Use conversion (and may be multiplication) functions.
Yury
Posts: 65
Joined: Thu Nov 01, 2007 9:41 pm
Location: Belarus

Post by Yury »

Code: Select all

L MD40  //  45.6
L 1000.0
*R
RND
T MD50  // 45s600ms
hoangnguyen1986
Posts: 33
Joined: Thu Mar 27, 2008 2:18 am
Location: Vietnam
Contact:

Post by hoangnguyen1986 »

Yury ! you're right.
Because the "Time" data type will be converted from the "Real" data type like that:

Code: Select all

EX: we have : 100000.0 "real" then
Time = 100000/1000=100/60=1
=> Time = 1minutes40second0minlisecond
Thanks so much.
xdoit
Posts: 36
Joined: Wed Nov 21, 2007 2:13 pm
Location: China

Post by xdoit »

Schtiel wrote:A variable with data type REAL is a fractional number which is stored as a 32-bit floating point number.

A variable with the data type TIME occupies one double word. The contents of the variable is interpreted as milliseconds and is stored as a 32-bit fixed point number.

Use conversion (and may be multiplication) functions.
Many thanks.
Post Reply