decimals and percentages?

clayd82

Member
Join Date
Apr 2014
Location
Indiana
Posts
14
I'm working with Logix 500 and trying to do a percentage. I have my 2 values, coming from n7:89 and n7:100, and used the divide command. This would perform the values 394/1567 which would equal .25, but it only shows 0. I believe this is happening because it is less than 0 and therefore just displays that, but I'm not sure. Any ideas how I can do this?? THANK YOU!!
 
If you are using N:xx files, these are integers, so will round up or down accordingly. (Be careful you may not get the rounding you expect)

If you use a F:xx as your destination, which is a float, you should get the result you desire.

Cheers

Mark
 
Your destination needs to be a floating point data type (ie. F8:1). An integer data type (ie. N7:1) truncates any fraction of the result into a whole number. Also, .25 is not less than zero, it is less than one.


Internet must be faster in UK. Night beat me.
 
That's what I meant. Sorry. Guess I'm a little frazzled trying to work as I learn. Thank you both for all the help! I'll change those to Floats instead of Integers. I appreciate the help and your time!
 

Similar Topics

Let me start by saying: "ARRRRRRRRRRGGHHHHHHH" I cannot for the life of me figure out how to use decimals in RL.:bawling: For example: I am...
Replies
8
Views
3,541
Hey there. I have a quick question about displaying data WITH a dcimal place. I am reading a tag from my Compact Logix. Lets say it looks like...
Replies
2
Views
1,518
I really need your help here! I have a Decimal Number that is being transferred in 1-byte words. The original number is larger than 1 byte...
Replies
2
Views
2,359
Hi what will be the value shown in the analog address memory read by PLC if I have 4-20 mA or 0-10v sensor signal,will this be 0 to 32000...
Replies
6
Views
2,818
Other than using a floating point, is there anyway to enter a decimal into a allen bradley 5 processor-like into a n7 file... using rslogix5 ...
Replies
7
Views
1,804
Back
Top Bottom