Convert MI to MF

Recommended Posts

Hello,

I am using a V570 with V200-18-E2B snap IO. Software version is 9.8.65

I am linearizing a pressure sensor (4-20 ma) to be able to read from 0 to 30.00 inHg. As you can see in the image below I made y2 a value of 3000 to be able to display it with 2 decimals in the HMI.

However I still need to get it with 2 decimals into a Float (MF) to be able to convert this value to mbar by multiplying it by 33.86.

So basically what I can't figure out is that if I get a value 3000 (30 inHg) I need to be able to put into a float 30.00, If I get 15 should be able to put into a float 00.15 and so on.

Is this something that can be done by using Num to Ascii and putting the ascii value into 2 MIs?  then using those 2 MIs into a float convert A+b/n?

I am hoping somebody point me in the right direction in how to achieve this.

Share on other sites

This is what I did and the result is very close.  However I still need to  know how to do it the other way described in my previous post.

Share on other sites

Hi

You could use the formula function to do the calculation.

Feed in the MI into the formula and divide by 100 and save as an MF, then multiply as normal.

Share on other sites

Why not simply use a second linearization function?

Besides that, be aware that you are demonstrating a precision which is not existing, when you display the inHG-Value with two decimal digits.
Your PLC can only read 819 value points (highest value 1023 - lowest value 204), which means every increase of MI0 by 1, will increase MI 1 by 3,663 (3000 inHG / 819).

Share on other sites

• MVP 2022

I see no reason to use Float for any of this. Just multiply the numbers, use MLs for the result, divide to get the precision you want, and keep track of where the decimal is for displaying.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×