Sign in to follow this  
Followers 0
evenson57

Convert INT

8 posts in this topic

I am new to this stuff and I need some help please. How do I convert an INT to a REAL

Share this post


Link to post
Share on other sites
Converting Integer to Real is easy MOV Source - Your Int Dest - Your Real Converting back can be a little trickier. You may want to look at THIS thread. Also tell us what processor you are using

Share this post


Link to post
Share on other sites
I am using a Compactlogix L32E with controllogix 5000 software.

Share this post


Link to post
Share on other sites
Allen-Bradley controllers perform automatic data type conversion for most instructions. I know some other brands of controllers require you to execute a data type conversion instruction before you perform the math. The simplest method to move a value from an INT type tag to a REAL type tag is, as mentioned, the MOVE (MOV) instruction. MOV Source:MyInteger 123 Destination: MyReal 123.000

Share this post


Link to post
Share on other sites
Every time i try it on this controller i recieve a zero as the real number.

Share this post


Link to post
Share on other sites
What's the source value ? Maybe your logic routine is not being scanned (is it configured as the Main Routine, or is there a JSR instruction to jump to it ?) or some other logic is writing over the destination tag.

Share this post


Link to post
Share on other sites
can you post your code?

Share this post


Link to post
Share on other sites
Did you setup your data types as DINT and REAL.

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