Converting Floating Point to Decimal

zibby07

Member
Join Date
Oct 2004
Posts
1
I am working with a flow meter that registers floating point values through a pipe and want to first convert that to a decimal value, and second to only keep the values to the left of the decimal point.

I tried BLKM and ADD to zero.

I'm not sure what would be a way to convert that floating point value from the flowmeter to a decimal number I can use.

Thanks.
 
Maybe there are someone out there who can readily identify the hardware and software platforms you are using from the two instructions you listed there.
But for the rest of us to have even the smallest inkling of a chance to reply to your post:
Please state everything relevant about the platform you are using.
 
I believe if you "MOV" the floating value to a DINT, the value will be rounded to nearest integer.
In other words, you get the rounded result rather than truncated float value.
 
Well it looks like he's using Mitsubishi so shahn4 is correct.
If you have real value and want to scale it use E* instruction.
You can use E/ as well but in this case you have to watch
the divider value or you can get famuous Div0...
Once you adjusted the number of decimal places use DINT to
convert it to 32-bit integer. This will remove places after
decimal point. You can convert it back to real if you want to
but this is basic approach... Watch your calucalations closely
because 32-bit math takes two registers to hold the value.
It is also good idea to make all 32-bit addresses even (like
D10, D12, D14 etc.). If you don't do so, you will have hard
time using device batch monitor...
 

Similar Topics

I am using an AB Micrologix 1200 that contains a counter with a destination of a floating point number. The number can get very large so I need...
Replies
8
Views
8,385
i am communicating 1766-l32bwb with conzerv make energy meter em 6436. I have communicated it on Modbus rtu. but i am not able to decode the data...
Replies
2
Views
4,625
Hello everyone, can anyone help me with covert the STL code to ladder. Iam using plc s71200. A %DB1.DBX33.7 // angel of vaccum...
Replies
2
Views
175
Hello PLCs Forum, I am in a bit of a pickle and was hoping someone could offer me some help. I have a .rss file and just need to see the ladder...
Replies
2
Views
95
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
267
Back
Top Bottom