Posted 19 Apr 2006 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
Posted 19 Apr 2006 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
Posted 19 Apr 2006 I am using a Compactlogix L32E with controllogix 5000 software. Share this post Link to post Share on other sites
Posted 19 Apr 2006 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
Posted 19 Apr 2006 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
Posted 19 Apr 2006 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
Posted 19 Apr 2006 Did you setup your data types as DINT and REAL. Share this post Link to post Share on other sites