Integer and Floating Points on AB

adeah

Member
Join Date
Dec 2003
Posts
10
Hi all!

I'm still confused with the integer "N" and floating points "F" on the Allen Bradley PLC. Thanks

-adeah-
 
Last edited:
Iteger=Whole number with out decimal fraction.1,3,10.....ect
Floating point=Number with decimal fraction of number like 1.23,12.9....ect

Floating point call sometime Real number too.
 
integers are like bigger bytes (at least the unsigned type).
signed type is the same except that most significant bit is reserved for sign. it is 0 for positive numbers and 1 for negative numbers.
this menas if you interpret content of 16-bit register as
signed bit, value would be in range -32768 up to 32767.
same value if interpreted as unsigned integer would have
range 0-65535.
in floating point or real, some of the bits are used to represent
value just like in integer, one bit is always reserved for sign
and remaining bits are used to form 'multiplier' (proper terms are
sign, exponent and mantissa).
format of real type varies depending on register size (32bit, 64bit etc).
as far as i know plcs use 32bit. although it is possible to
create custom format for particular application with exponent and mantisa using any number of bits, widely accepted standard is one
defined by IEEE.
 
Hello Everyone,

I am using ML1400 series B PLC. I am doing Modbus Master communication with one of the Power meter (LG+5310) on Channel 0. I read data successfully and communication is done. But Power meter is sending value in Floating point format. And in Program I am getting values in Integer format.

In MSG instruction, can I enter Data table address as floating point register say F10:0? As after doing this I am getting error at MGS block. An so unable to read data.

Sorry I don't know how to create new thread here as I am new at this forum. So posting in this thread.

Thanks,
Shailesh
 
You will have to use Integer (N) as the target for the MSG command. After that use the COP command to copy two adjacent integers into a single Float. You may want to check if swapping of the order of the integers will be needed.

I use this site to help me visiualize the layout of a float.

Also attached - how to start a new thread.

StartThread.jpg
 
Hi bernie_carlton,

Thanks for quick reply.

How can I copy two adjecent Integers using COP instruction? How to do it? I tried copying integer into Float (source #N7:0 and dest #F8:0)..... But it gives error as Operand size do not mach..
Can u explain hoe to do it? Or do u have sample backup of it?

Thanks,
Shailesh
 
Last edited:
Hi,

Thanks..

My question is how to combine those two adjacent integers into single Float register.
If I copy one Integer N7:0 in F8:0 then after how can I copy second integer (N7:1) in same Float F8:0.

Thanks,
Shailesh
 
The "CPW" instruction will do that for you with a length of one. The destination file type
determines the number of words copied. Sense a floating point file type has 32 bits ( two words) then both N7:0 and N7:1 are copied into F8:0. Try it.
 
Hi,

I have attached backup for the same.

Is it a right way do it? Please tell me.

In "N11:0" and "N11:1" I am getting values which is actually a float value coming from salve device. :confused:

Shailesh
 
Hello Everyone,

Is there any sample program available for above mentioned query.
I want to know how CPW instruction can be used to do it. I tried to use it. But I am unable to understand. How can I copy 1st and 2nd word in same floating point number?
I have attached the program backup in previous thread. Please tell me what am I doing wrong? I am stuck at this problem.

Thanks,
Shailesh
 
1. You will only need one CPW command. Unlike a MOV command the CPW command does not attempt to interrpret the value stored in the source registers. it just moves the bit patterns. The number of bits it moves is determined by the size of the destination. Because a float used 32 bits then a CPW to a float with a Length of 1 will move 32 bits (the content of N11:0 and N11:1 in you example).

2. The values in N11:0 and N11:1 from your program, viewed in hexadecimal, are C85D and 4383. Using the calculator at the site I mentioned in my first post I get a value of -226574.05 when interpreted as a float. After using the online calculator with the hex groups in the opposite order I get 263.56534. If the float value you get is not what you expect then MOV the contents of the two registers to another two but in the opposite order. For example MOV N11:0 N7:21 - MOV N11:1 M7:20. Then use a CPW using the first of those two as the source.

3. Have you run your revised program in the PLC? I ask because I only see one value in the first float register and it appears to be the result of a MOV command from N11:0 Run the revised program (only one CPW) so that values appear in the float registers. Then, while online, save the program (thus capturing the data values) and post the result.
 
Last edited:
Hi bernie_carlton,

I got it. I just changed length to 2 in CPW instruction and got result "263.56534". It was easy. I just not looked at it in other way.(y)

Many thanks for ur support.

Shailesh
 

Similar Topics

Hi eveyone. I need transfer signal from system 1 to DCS via modbus. System 1 only can send 32 bit floating point. DCS receive 16 bit integer. How...
Replies
20
Views
10,547
Hello everyone ! Is there a way to get a variable, like a Word Memory (MW) and separate the integer part and the float part and save them in...
Replies
5
Views
1,598
Does anyone know of any such PLCs? Usually I'm lazy and don't want to think about precision and overflows.
Replies
20
Views
6,960
RSLogix 500 FTVS-ME I have a floating integer that I only want to go 2 places to the right of the decimal point(100th) but I can't find the...
Replies
1
Views
1,659
Hi i have micrologix 1100 and load cell. i need to change the floating f8:0 to n7:0 so i can use fll (first in) how is that posibuel ?
Replies
15
Views
3,759
Back
Top Bottom