Convert number to Number of decimal places

Bob, how do you mask digits in the PLC?

Danny, Its not that easy, still leaves too many decimal places in the REAL because of binary math artifacts. I had forgotten about that when I started this quest.

Are you trying to make the REAl value forced to nnn.nn000 ??

The REAL will be what it wants to be, that's the nature of the floating point math, and you will always find occasions when 1 = 0.9999999, along those lines, you get the point...

I don't know why you are trying to suppress a REAL to 2 decimal places.. if it is for display purposes, then surely the HMI or SCADA can format it for you, if it is used internally , then the actual value is better than a forced value ??

A better understanding of what you are trying to achieve, and why, would help...
 
Yes that was the quest (except for inserting the lagging zeros).

I was reminded of the futility using any sort of PLC math because of the binary nature od the calculation. I get that. Until I simply place the exact numbers I want into the REAL register there will always be binary math artifacts.

And Yes again, SCADA and HMI can do this for me and Yes using the full value for math is best. I get all that.

I was just trying to beat the system to see if it was possible. I found that it is possible, but what an ordeal to get there!

What originally prompted this was that I was trying to troubleshoot a fast moving number and the variable length caused by the varying number of decimal places was constantly moving the numbers location in the field causing my old eyes some trouble.
If that number was left justified I might never have tried it :)

The MASK idea was a good one and would have been of value had it been possible.
 

Similar Topics

I'm working with SLC 500 Data File. I have a few numbers like 8.313452e+07 . I forget , how do you convert these numbers . Thanks so much.
Replies
11
Views
2,520
Firs of all I'm working with Structured Text on B&R Automation Studio 4.0: I have a binary message on a string (collected from serial port). The...
Replies
4
Views
8,203
Jees... Continuing from this thread... http://www.plctalk.net/qanda/showthread.php?t=85341 I now have the correct pressure in Torr and mBar...
Replies
24
Views
7,440
Number 0-4500, available from the on-site collection, how to convert 4-20 mA?To the analog output module PME6.0,IC694ALG392 Thank you
Replies
3
Views
2,148
I am working on a problem with a scanner. The data comes in as ASCII. I am scanning the quantity. The data looks like Q1^M or Q21^M (They can...
Replies
2
Views
3,083
Back
Top Bottom