RSlogix5000 Floating number range

yuenli

Member
Join Date
Jul 2015
Location
Philly
Posts
8
I am writing a program that has requires a 32 bit floating number and the range is -1999000000 to 9999000000. When I use a REAL type, RSlogix seems to display these values in a different way. Any suggestions for displaying the values above?
 
It displays 9999000000 as 9.99899955e+009, right ?

It is odd that it truncates the decimal portion...I'm having a hard time figuring out why.

I did an equal between 9.99899955e+009 and 9.9999e+009

Also, do you really need a real ? How many decimal places do you need ?
 
Last edited:
A LINT will hold this range as integers. But I don't see any math functions which support it. Again, are you sure you need floating point? The significant digits will be much less.
 
Last edited:
I am writing a program that has requires a 32 bit floating number and the range is -1999000000 to 9999000000. When I use a REAL type, RSlogix seems to display these values in a different way. Any suggestions for displaying the values above?

If I'm counting zeroes correctly here, a DINT isn't quite going to cut it for the high range. 2,147,483,647 is your upper limit on a DINT.
Can you break your value into two chunks? Then either send or receive it and recompile on the other end? For example word one could represent every value above 999,999. Word 2 would be the remainder. So your max value would be represented as 9999 and 0. To rebuild multiply word 1 by 1,000,000 and add word 2.
Knowing more about what you are trying to do will yield better advice.
 
The value is broken up into two 16 bit INT values that I need to combine into one to create my 32 bit value as stated above. I am doing this in a AOI and the AOI does not allow me to create an input or output parameter as a LINT.

Any advise on what I can do here?
 
A LINT will hold this range as integers. But I don't see any math functions which support it. Again, are you sure you need floating point? The significant digits will be much less.

As an aside LINT AOI's exist on the rockwell knowledge base for adding subtracting and comparing
 
The value is broken up into two 16 bit INT values that I need to combine into one to create my 32 bit value as stated above. I am doing this in a AOI and the AOI does not allow me to create an input or output parameter as a LINT.

Any advise on what I can do here?

How about convert each 16bit INT to a string and concatenate the two?
 
The value is broken up into two 16 bit INT values that I need to combine into one to create my 32 bit value as stated above. I am doing this in a AOI and the AOI does not allow me to create an input or output parameter as a LINT.

Any advise on what I can do here?

Whoa
you have 2 16 bit integers to create one 32 bit signed DINT?

simplest is create an array of INT
MOV 16 low into array[0]
MOV 16 High into array[1]
then COP Array[0] to DINTtag length 1
 
The value is broken up into two 16 bit INT values that I need to combine into one to create my 32 bit value as stated above. I am doing this in a AOI and the AOI does not allow me to create an input or output parameter as a LINT.

Any advise on what I can do here?

Bit shift? You can bit shift the upper 16 bits by multiplying by 2^4 and adding it to a appropriate-sized data tag. Then add the lower 16 bits.
 
Thanks. That still does not explain why when I entered

9999000000 as a REAL tag value, it changed the display value to 9.99899955e+009 (under monitor tag dialog). This was using Studio 5000 v23.

You are under the misunderstanding that a computer "Real" number can handle any value. It cannot. There are only 23 bits of precision available, so best approximations have to be made.

https://en.wikipedia.org/wiki/IEEE_754-1985
 
Thanks for all the replies.

What is the best way for me to handle this number range and being able to display this in the correct format?
 

Similar Topics

Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,089
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
798
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,844
Hello, is it possible to create a data block, something like shared datablock in Siemens STEP 7, in the RS Logix5000 PLC project? I would like...
Replies
3
Views
1,039
Hi all. This is a machine programmed by the manufacturer. There is an event task and the event tag is a MOTION_GROUP tag. Screenshot . Since the...
Replies
2
Views
970
Back
Top Bottom