Sign in to follow this  
Followers 0
Conor

RSLogix5K Convert Real to Int

5 posts in this topic

Hi guys, I was wondering if there is an easy was to convert a Real to an Int in Logix5000? I.E. I have a value we say 30.123 and I want to like 30123 Thanks, Conor Edited by Conor

Share this post


Link to post
Share on other sites
Multiply by 1000 then MOV the value to an Integer tag,

Share this post


Link to post
Share on other sites
Even better, just use the MUL instruction with your integer as the destination address.

Share this post


Link to post
Share on other sites
And if you don't want it to round the result then use a CPT instruction with the expression TRN(MyRealTag*.001) and a DINT tag as the destination.

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