Float to two 16 bit integers - PLC5 or SLC

dash

Lifetime Supporting Member
Join Date
Jun 2003
Location
Birmingham, AL
Posts
589
A recent challange I worked out tonight was getting a float, which represents the number of counts for an indexing drive to move, split into a low and high 16 bit word. This example is for a PLC5 so it will also work for a SLC, but there may be some better math choices for a SLC.

Anyway, I am sure someone could probably do a cleaner job, but I never sould find an example I could follow. Attached is my attempt in a PDF file. The code has been fairly well checked, but if you use it check it out yourself before applying.

Darren

By the way. It will have an accuracy of +/- one count. For me that was good enough. :D
 
Last edited:
By the way. As you cross the 10 million mark you will start to loose resolution due to the way floats are handled.

Darren
 

Similar Topics

I have a MicroLogix 1400 that I am using to communicate with Micro Motion Coriolis meter. I wrote some simple logic that grabs the temp via Modbus...
Replies
22
Views
8,386
I need help converting from a floating register to two integer words. I'm using a SLC 5/05 and need to be able to write 32 bit data to a servo...
Replies
2
Views
4,722
The topic of reading or writing floating-point values via Modbus seems to come up regularly, and it is to my mind not that difficult. That said...
Replies
0
Views
1,396
Hey all, I have an AcuDC energy meter which provides data on voltage, current, and power over RS-485/Modbus RTU. It provides float values in two...
Replies
8
Views
2,043
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...
Replies
5
Views
4,709
Back
Top Bottom