Kkula
Browse Questions » Motion Control System SIMOTION: how Is Able To i convert speed actual Parameter Originating From parameter r63 Including Information type floating point 32 into Lad Software so that i Retrieve real value?

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

Motion Control System SIMOTION: how Is Able To i convert speed actual Parameter Originating From parameter r63 Including Information type floating point 32 into Lad Software so that i Retrieve real value?

Dear experts,
I would like to ask how can i convert speed actual value from parameter r63 with data type floating point 32 into LAD program so that i get real value? When i tried to use conversion blocks(DWORD to real) in LAD all i could get were high numbers around 5 milions. So my question is it even posible to get the actual value in LAD program for example 200rpm, or do i have to use ST programing for this conversion? And if so could someone send me an example of how to get this values? The topology i am working with is the same as in my prewious treaths.
Thanks for your help

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Converting Speed Actual Value (r63) in LAD

Dear User,

You are right to encounter issues converting the floating-point speed actual value (r63) directly in LAD. LAD primarily handles integer data types, and direct conversion from a 32-bit float to a DWORD (as used in conversion blocks) will misinterpret the floating-point representation, leading to the large numbers you observed.

It is generally recommended to use Structured Text (ST) for accurate floating-point conversions within TIA Portal. ST offers native support for REAL data types, enabling precise conversion without data loss.

Here's an example ST code snippet to convert r63 to a REAL value:


REAL Speed_RPM;
Speed_RPM := REAL(Word_to_REAL(r63)); // Convert r63 (DWORD) to REAL

Explanation:

  • Word_to_REAL converts the DWORD value of r63 into a REAL value.
  • The result is then assigned to the REAL variable Speed_RPM.

You can then use this Speed_RPM variable in your ST code for further calculations or logic.

While possible with complex bit-shifting and scaling in LAD (not recommended due to complexity and potential inaccuracy), ST provides a cleaner and more reliable solution.

For more information on data type conversions in TIA Portal, refer to the Siemens Support article.

Sincerely,
Siemens Self Support

0