Sign in to follow this  
Followers 0
Guest hurler

Floating Math in Mitsubishi FX2N

6 posts in this topic

Hi, I was wondering if you could help. I am trying to do floating point Math using the FX2N PLC. Is there any way I can write floating point numbers into registers directly and then use them for Maths functions Example: Such as a number as 0.000567. Is there even any other way I can get such a number? I am also trying to get the Cosine of a number but the value being returned is the rounded up to the whole value number i.e .876 is rounded up to 1. Is there any way I can get the decimal point number. Would be very grateful for any help on this. Many thanks - Hurler

Share this post


Link to post
Share on other sites
If you set floating point mode flag m8023 to on. You can then enter values as floating point. All registers will be 32 bit. Rodney

Share this post


Link to post
Share on other sites
Hi Rodney, thanks for your reply. I tried this but it didn't seem to work. Possibly i am still doing it wrong but from the Manual it says that the FX2N doesn't require M8023 and that I can convert to decimal places by using the FLT (FNC49). I have used this and it works fine when doing floating point Maths Example: Say I wanted to divide 10 by 3 and multiply by .000789 I move K10 and K3 into registers and convert these to Decimal Places by using the FLT function. Now I have 10.000 and 3.000. I divide 10.000 by 3.000 using the DEDIV Function giving me a value of 3.333. So far, everything is fine. Now I have to multiply by .000789 but how do I load this value into the register in the first place? Do I load 789 to a register, convert to a floating number/Sientific number and then load the offset i.e 4 to the exponent, the D+1 second reg?? Again, appreciate any help and if I'am looking at the initial suggestion wrong would it be possible to elaporate. Many thanks - Hurler

Share this post


Link to post
Share on other sites
Hi Huler Sorry the flag to set is m8032 and not m8023. Rodney

Share this post


Link to post
Share on other sites
Are you trying to do that online or offline? If you are offline, see if you have MAIN under "Device Memory" (below Parameters, Comment etc.). Open it and change view to floating point and enter the value into register of your choice. Next time you go online you will have to download this to PLC. If you are online, it's the same procedure (except downloading), just open data table or Device batch monitor... Don't forget to change view to floating point.

Share this post


Link to post
Share on other sites
Lads, just to say thanks for the help. This solves the problem. Hurler

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