Jump to content

How do i split an MF digits into MI?

Recommended Posts


I would like to see if its possible to accomplish what i have in mind.  I have an floating point number  that i want to display in much bigger fonts that what is available in visilogic software.  at the moment i am taking MF2 then converting it to ascii with the num to ascii function block resulting in ML1.  i then take ML1  and display it as a variable ascii string.  this allows me to control the amount of decimal points i want to see which is the reason for the conversion.

Now what i would like to do is take this MF2 and separate all the digits and store them into MI locations.  My floating point number is defined to 8 digits so i would store them in MI0-MI7.  i have leading zeros selected to this number so every MI should have a value and i want to treat the decimal as a value too.  

I would then like to take those MI values and create list of images by pointer variables for each MI in my hmi with pictures of 0-9 and a decimal point so they can change as the MI value changes.

The problem is that i cant see any functions that would allow me to separate this MF value.  I came across the STRUCT function where i think i can do this but it will not work with a floating number.  i was thinking of using the ascii converted ML1 value and separate that number but i dont understand the ascii result enough to know how that 9 digit number represents my floating number.

Or if anybody knows how to get a font bigger than  MS sans serif 14B that would also solve my issue.  Thanks in advance



Link to comment
Share on other sites

  • MVP 2023

Decimal point control is a weakness in Unitronics when it comes to floating point numbers.  I hear you.

Use the Font Manager in the graphic editor to load any font you have installed on your computer.  Depending on your PLC model, you can go huge.  I like to load a 24 and a 36 point in MS Sans Serif.

It's the little button with the capital "A" on it or it's under the HMI menu.

Joe T.

  • Upvote 1
Link to comment
Share on other sites

Hello Joe,

thank you so much for your input, this solves my problem with the greatest of ease and stops my convoluted way of separating the floating digits that i figured out but would take various lines of ladder.

in regards decimal point control, i figured out a neat  way of doing so.  instead of converting a floating point number to a MI/ML using the float convert instructions, i convert the floating number to ascii with the num to ascii function block.  with the function block i set result string length  to 8 digits, set the result format to float, and i set an MI as my decimal point location.   in my hmi i setup a variable ascii string, set the length to 8(same as in my function block), and tie that variable to the result of the block.  now i also setup an input variable with the MI i am using for decimal control.

this leaves me with a 8 digit long floating number that i can change decimal point location and viewable digits by changing the value of the MI.  i can increase the size of the number by increasing the length in the block and in the hmi variable.  the only issue i found with this is that when i have the decimal set to "0", the number increases by whole numbers but you are left with "XX.0" on the screen.  To work around this i take my floating number and convert it so i can save the whole number to an ML, i made a 2nd num to ascii function block using this ML, set the same length, set the result format to  unsigned decimal,  and set decimal point location to constant "0".   so when i have the MI decimal control hmi variable set as 0, i move the 2nd num to ascii result into my hmi screen eliminating the decimal point and leaving me with whole numbers.  any number greater than zero moves the 1st num to ascii result into my hmi with the desired decimal points.

 I hope this can be useful to others who are working with displaying floating numbers.

Thank You,




Link to comment
Share on other sites

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 link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

  • Create New...