Sign in to follow this  
Followers 0
AndrejP

Structure Text REAL constant

2 posts in this topic

Hello.

I'm having difficulties of how to write REAL constant in ST.

For example (Gap1 is defined as REAL):

Gap1:= UDINT_TO_REAL(P_Cycle_Time_Value) / +1000.0;     RETURNS ERROR ERROR:   Conversion cannot convert from Integer Literal to REAL

I have also tried 1000.0

If I use: 

Gap1:= UDINT_TO_REAL(P_Cycle_Time_Value) / INT_TO_REAL(1000);  COMPILES OK

My question..

How do I write REAL constant in Structure text? I don't want to use  INT_TO_REAL anytime I want to do calculations with constants..

Thanks.

BR.

Share this post


Link to post
Share on other sites

I guess it has something to do with Regional Format (SL).
I have to use comma (1000,0) instead of dot (1000.0)....
In other software which uses structure text, I didn't have this kind of problem...
BR.
 

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0