Studio 5000 (V24) Two Integers to REAL

Rich0147

Member
Join Date
Feb 2015
Location
Yorkshire
Posts
11
Hi, how do I convert 2x Integer registers to a Real?
The two integers are from Modbus registers that contain a floating point value, I need to convert to a REAL register in my ControlLogix L71 PLC.
 
Are they consecutive registers in an integer array? Look at the COP instruction in Logix. It performs a bit-by-bit copy of the source into the destination. Length parameter is number of destination elements. So...if your modbus data is in 2 consecutive 16-bit elements of an array called "ModbusData" of type "INT[2]", try this:
COP
Source: ModbusData[0]
Destination: RealTag
Length: 1

If the result is "weird", look at the datasheet for the device you're reading data from to figure out the byte/word order. Or look at the bit patterns to figure it out Or....trial-and-error doing byte swaps and word swaps (or both) until it matches up.
 
Or....trial-and-error doing byte swaps and word swaps (or both) until it matches up.
+1 đź‘Ť for this.

There are only a few possibilities, and it is usually quicker to solve it empirically than to figure it out analytically.

It assumes you know at least one float value in the device so you can experiment.

Are you getting any single-register values from this device? There is an off-by-one issue that can make it seem like you have the float conversion solved when you don't, and the float result is off by up to about a percent.
 

Similar Topics

Hi all, I recently was upgraded from Win7 machine to a Win10 machine with lots of horsepower. Last Friday, I tried exporting a routine and when I...
Replies
9
Views
4,700
Hi everyone. I am using a CompactLogix 1769-L24ER with Studio 5000 V24 to control a small machine. Part of the project requires me to communicate...
Replies
3
Views
7,021
I just updated our Studio 5000 Version to v24 but all my program files are v21. How can I update my program files to v24 if I need to? I realize...
Replies
11
Views
11,160
Hello I just installed Studio 5000 onto my computer and after a short bit of time (1-2 min) with the program open I get the following error...
Replies
8
Views
16,074
I am connecting to a remote device. When attempting to upload I receive an error that states: Error: Auto_Functions: The Import was aborted due...
Replies
2
Views
42
Back
Top Bottom