Manually convert 64-bit float to 32-bit float using MicroLogix

Epy

Lifetime Supporting Member
Join Date
Jul 2012
Location
no
Posts
376
Hi all,

Going to use a ML1400 to talk to a Krohne gas meter via Modbus. Krohne's totals come as doubles (64-bit floats). I was wondering if anyone had come up with a good way to do the 64 to 32-bit float conversion (since ML's do not recognize doubles).

It looks like I can just isolate the sign bit, mantissa, and exponent with bit operations, then run them through a compute to do the downcast, as shown in the first answer here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/fee6cb46-9918-430c-8c99-861a716a1552/convert-from-64-bit-double-to-float?forum=vclanguage , but if someone has something already they'd be willing to share, or a better suggestion of how to do it, I'd appreciate it.
 
Hi,

See if this helps...

607722 - SLC / MicroLogix: Converting 64-bit Real value to 32-bit Float
Access Level: TechConnect

...and the other Technotes linked inside it.

Any detailed questions...you can direct them at the "others" viewing this thread! :p

I'm off to bed!

Regards,
George
 
Hi,

See if this helps...

607722 - SLC / MicroLogix: Converting 64-bit Real value to 32-bit Float
Access Level: TechConnect

...and the other Technotes linked inside it.

Any detailed questions...you can direct them at the "others" viewing this thread! :p

I'm off to bed!

Regards,
George

Appreciate the help/gesture, but don't have an AB support contract.
 
Appreciate the help/gesture, but don't have an AB support contract.

Question

How to convert a Scaled: Double precision floating point to a Float data on the SLC or MicroLogix controller

Environment

RSLogix 500
SLC Modular and MicroLogix controllers
Answer

RSLogix 500 only supports the IEEE 754 single precision float data.

The project attached below, made for a MicroLogix 1100 controller, converts the 4 integer data with the Double Precision Floating Point value on a native Float data.

The value is stored on the N7:0 to N7:3 data. The result is stored on the F8:2 data.

The conversion process from 64-bit formatted data to 32-bit formatted data is explained on the Tech Note: 36632 - Logix Platform: How to convert 64-bit Real value to 32-bit Float

The Formula applied to convert the value on this project is explained on the Tech Note: 7765 - Floating Point Format
 
Question

How to convert a Scaled: Double precision floating point to a Float data on the SLC or MicroLogix controller

Environment

RSLogix 500
SLC Modular and MicroLogix controllers
Answer

RSLogix 500 only supports the IEEE 754 single precision float data.

The project attached below, made for a MicroLogix 1100 controller, converts the 4 integer data with the Double Precision Floating Point value on a native Float data.

The value is stored on the N7:0 to N7:3 data. The result is stored on the F8:2 data.

The conversion process from 64-bit formatted data to 32-bit formatted data is explained on the Tech Note: 36632 - Logix Platform: How to convert 64-bit Real value to 32-bit Float

The Formula applied to convert the value on this project is explained on the Tech Note: 7765 - Floating Point Format

Thanks!
 
deemon113,

We are all here to help but it is forbidden to directly and blatently copy and paste the contents of Locked TechConnect Articles. It can place the owner of the Forum in hot water, not mention that it places you in breach of your TechConnect Contract.

While doing the above is fast and easy, there are other more subtle ways to lead someone down the right path and provide the necessary information, but that can involve a little bit more of your time to do so. However, that is what this Forum is all about; giving our time to help others.

You are relatively new post count-wise so that's a little bit of advice going forward. You have the right attitude, wanting to help. So I know you'll understand where I'm coming from.

Regards,
George
 

Similar Topics

To quickly test a plc output which is wired to a relay do I dob a cable between the output and 24vdc+ source I.e something with 24vdc+ live such...
Replies
6
Views
696
Hi there, I am trying to determine the input, output, and config assembly and entering it into a beckhoff plc, and couldn''t get proper active...
Replies
22
Views
7,370
Hello everyone‚ Fairly new to PLC prog I seek your advise concerning what is said in my thread title; I program using workbench components; I...
Replies
1
Views
1,255
We have a customer that requires a CISCO network switches by government regulation. We are using a IE-4000-8GT4G-E industrial network switch. I...
Replies
37
Views
18,701
Dear Sirs, I have several Siemens MasterDrives (of dubious parentage) and I'm not sure if they are operational or not. I have an old laptop...
Replies
9
Views
2,809
Back
Top Bottom