stop rounding??

escoplcguy

Member
Join Date
Jun 2010
Location
New Jersey
Posts
191
is there a way that i can stop all the rounding that is going on between plc and panelview?

i have a number thats lets say 8.82345 and all i want is the first number the 8. i want to take that number and display it on the panelview (600) if i use an interger it rounds 8.8 to 9. if i use the float and only try to display the first digit the panelview then rounds it also,

how can i get the 8 from 8.82345 to only be displayed on the panelview??

thanks guys!
 
Hello,

Normally a function named 'Trunc' (Truncate) will return just the part to the left of the decimal point. I do not know what the PanelView offers. Or do the Trunc in the PLC and put the result in an integer register.
 
For PLC/5, SLC500, Micrologix:

Subtract .5 from the float and store it in an integer location.

Eg

SUB 8.82345 .5 N7:0 - N7:0 will contain 8.
Sub 8.34202 .5 N7:0 - N7:0 will still contain 8.

For ControlLogix use Trunc.
 
For PLC/5, SLC500, Micrologix:

Subtract .5 from the float and store it in an integer location.

Eg

SUB 8.82345 .5 N7:0 - N7:0 will contain 8.
Sub 8.34202 .5 N7:0 - N7:0 will still contain 8.

For ControlLogix use Trunc.

Definately use Truncate in Logix5000 controllers, don't try the maths trick above !

Logix5000 uses a different rounding algorithm from the normal "xxx.5 and above goes up".

xxx.5 is neither nearer the integer above or below, so to always round up is statistically unbalanced.

So they use the "Round-to-Even" method, any number ending in exactly xxx.5 will round to the nearest even number.

Examples....

1 / 2.0 = 0.5 will store 0 in an integer destination (0 is considered even)
3 / 2.0 = 1.5 ...........2
5 / 2.0 = 2.5 ...........2
7 / 2.0 = 3.5 ...........4
9 / 2.0 = 4.5 ...........4

etc.

Can anyone try this in SoftLogix for me ?
 
For PLC/5, SLC500, Micrologix:

Subtract .5 from the float and store it in an integer location.

Eg

SUB 8.82345 .5 N7:0 - N7:0 will contain 8.
Sub 8.34202 .5 N7:0 - N7:0 will still contain 8.
....
Will work correctly only for positive values.
For negative ones, 0.5 must be added, not subtracted.
 

Similar Topics

Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
281
I'm looking to get some spare keys for this PLC. Does anyone know a source or have a part number? My searches are turning up nothing at the moment.
Replies
1
Views
76
Hey all, I am currently working on a depalletizer for a customer and we are doing a hoist upgrade. This is a SLC500 processor and the drives are...
Replies
6
Views
297
Hi everyone, I've got some trouble lately with a client and his communication with the server. I'm a beginner, and the project was not orginally...
Replies
0
Views
87
Hi First post here! I admit I am not too used to handle interrupt OBs in Siemens. I have a customer who has been buying a standardized solution...
Replies
4
Views
250
Back
Top Bottom