2 Integers into 1 Float

junkerjorg

Member
Join Date
Nov 2007
Location
Wisconsin
Posts
56
I am receiving data from a controller that is sending out floats or 32 bit words over devicenet to my 5/05 processor. The devicenet is mapped to M files which are 16 bit words. I need to map those two 16 bit M files back into a single floating point. I thought the COP instruction with a length of 2 would be wise enough to take M1:13.75 and M1:13.76 and copy it into F24:0 but it copies to F24:0 and F24:1. I'm sure there is an easy explanation but it is escaping my mind. Please help :)
 
Last edited:
I am receiving data from a controller that is sending out floats or 32 bit words over devicenet to my 5/05 processor. The devicenet is mapped to M files which are 16 bit words. I need to map those two 16 bit M files back into a single floating point. I thought the COP instruction with a length of 2 would be wise enough to take M1:13.75 and M1:13.76 and copy it into F24:0 but it copies to F24:0 and F24:1. I'm sure there is an easy explanation but it is escaping my mind. Please help :)

The length in the Copy Instruction is the Destination Length. Did you perhaps use a length of two? The other issue is getting the Data into the Float in the right order. You might need to use a SWP Instruction or MVM Instructions to reassemble the Data in the right order.

Stu....
 
Last edited:
I was afraid I might have to do a SWP.

It can be fun, I have had to do this in a ControlLogix from a unit that was giving me the data as four SINTs. There was no information in the Manual about the order the SINTs came in, so I had to do it by trial and error.

The reason I mentioned the Lenth, is becasue you are moving two INTs to one Real/Float. So, you shouldn't have it going into two Floats with a proper lenght of one.

Stu...
 

Similar Topics

Hi, I am using a Phoenix Contact PLC and trying to use it to write a Floating point over Modbus. To do this I need to convert it to two 16 bit...
Replies
24
Views
6,851
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,405
Hello, I have a (hope) simple problem with Logix500 (PLC is emulated with Emulate500) interacting with a VB6 program. When I write in a Float...
Replies
10
Views
2,330
I have two integers in Dec. 16169 and -30892. They get moved to a float and displayed. I am wanting to double check the value to expect. I...
Replies
11
Views
3,898
Hello All, I'm rather new to this site, so please forgive any dumbness. I'm posting this in an effort to do a better job of my programming. I've...
Replies
4
Views
4,008
Back
Top Bottom