integer to float conversion

Greetings ilias, and welcome to the forum.

Do you want to convert a single 16 bit integer to a floating point number such as 1234 to 1234.0?

Or are you looking to convert a bit pattern for an IEEE754 float stored in two 16 bit integers to a floating point number, as in 17562 and 4000 converts to 1234.0?

Or are you wanting to convert a 32 bit integer containing the bit pattern of an IEEE754 float to a floating point number, as in
1150959616 converts to 1234.0

More detail will really help us help you.
 
Ok,look!I have got an input to the plc,as an integer between 27648 and 0.Then I convert this number into an integer,in a way that at the end shows me the weight of something I measure!Till now everything is ok.But from th plc I can read only integers,lets say 20 ,21!I am trying to find a way to represent the weight not as an integer but as a real!I have found DTR!Does it work?I am writing the code that converts the number between 27648 and 0 to an integer.
L PIW 756
T MD 10
L 100
L MD 10
*D
L 27648
/D
T MD 50

Thanks
 
u must convert the integer to double integer first





so

l md 600

itd

dtr

t md 604



now md 604 has the number in floating format
 

Similar Topics

I'm reading some data from a device using Modbus TCP and am having some difficulty getting the two 16 bit words converted to FP. I've done...
Replies
2
Views
1,659
Hello there, I have a MicroLogix 1100 PLC (modbus master) reading data from an Crompton Integra 1534 Power Meter(modbus slave). The Integra 1534...
Replies
8
Views
8,929
Hi. I'm using a Modbus ProSoft where I basically map data to a big INT array. Example, where GX_I_63HPU is a REAL, MNETC.DATA.WriteData[200] an...
Replies
21
Views
416
How do I convert a float to an integer? I've got a floating-point number D606, value 3999.863. I need to convert it to an integer (4000), then I...
Replies
14
Views
4,110
I can't quite figure out what the issue is here. I read some things about floating point integers and rounding and I assume that's my issue but...
Replies
13
Views
3,892
Back
Top Bottom