Sign in to follow this  
Followers 0
kurt.brinker

Convert float to integer

4 posts in this topic

I am getting my feet wet with pid loops and right now my PV is in float format. I take several RTD inputs and divide them by the number of RTD's and then multiply that time .01 to get my xx.x value which is stored as a float. How do i convert this to an integer so i can place it as the PV in my PID loop. SLC 5/05, logix500 7.1

Share this post


Link to post
Share on other sites
The easiest way is to MOV the float to an integer address. You will lose the decimal value. If that is not acceptable, you can multiply the float times ten to an integer address and then compensate in the PID loop. Bill

Share this post


Link to post
Share on other sites
i think i might be able to get away with losing the decimal. thanks

Share this post


Link to post
Share on other sites
If you will refer to the manual for the PID instruction, you will see that the SLC5/05 PID instruction is expecting the PV to be scaled in the range of 0-16383. Therefore, use the SCP instruction to scale your floating point temperature to that range. This way you also won't loose resolution with the decimal. Edited by Alaric

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