Chitt

Real to 3 decimal points

4 posts in this topic

I'm fairly new to Mitsubishi and I am trying to limit the amount of decimal places of a real value down to 3. I am using a FX3U CPU and the only thing I see in the manual is that real values are stored with approximately 7 significant figures. Is there a way to limit the amount of figures after the decimal point to 3 without converting to an int value? Also does restricting the decimal to 3 points on GT works change to PLC value at all?

Share this post


Link to post
Share on other sites

If you only want to do this for visualization on the HMI, then you should be able to do that with the HMI software.   If you want to do this for use in the PLC, then multiply by 1000 and store as a DINT, (long integer) then divide by 1000 and store as a REAL (floating point).  This is a general explanation you can use in any PLC or other programming languages since I am not familiar with Mitsubishi gear.  

Share this post


Link to post
Share on other sites

The company i'm editing their existing program for wants their measured results to be down to three decimal places because they think the 4th point is causing some good parts to be considered bad. Looking through the program, at first I thought it was a real value they are grabbing their data from, but its actually a double word. 

Share this post


Link to post
Share on other sites

+1 OkiePC

Divide by 10 and then multiply by 10. This will ensure that the fourth decimal place is always 0. 

Regards,
Garry

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