Look at the decimal portion of a REAL number

tkvech

Lifetime Supporting Member
Join Date
Jan 2006
Location
Moraga
Posts
3
We are using RSLogix 5000. I have numbers entered via the Panelview as Real numbers. I need to take a number such as 1.375 and only evaluate the decimal portion of the number. How can I strip away the whole number and leave only the decimal.
 
Convert the number to integer without rounding.
Convert the result back to REAL.
Subtract the result from the original.

Alternate:
Change the Panelview program to enter an integer with whatever number of implied decimal places you need. Your example of 1.375 could be entered as 1375. In integer arithmetic, 1375 MOD 1000 equals 375.
 
No conversion necessary...Do a CPT statement:

Fraction = Number - TRN(Number)
 

Similar Topics

In S7/TIA Portal, is there a function to round a real to a specified number of decimal places? e.g. If I have 22.519432 and I want to round it to...
Replies
16
Views
1,991
I am using a Micro 850E PLC (the new one with implicit messaging capability) to drive a Kinetix 5100 servo drive. The error code number on the...
Replies
7
Views
1,754
I'm using numeric input enable link tag to PLC DINT type. What I want is for the example in the panel view user will input 350.568 (and shown on...
Replies
1
Views
1,193
Hello, I have a SINT array I am receiving and one of the positions of this array contains the direction of the product. Inside the ladder...
Replies
4
Views
1,157
Hi, how do i include the fractional part of the position I set for encoder? I have an Omron PLC and using cx programmer. I need to command my...
Replies
16
Views
4,006
Back
Top Bottom