Decimals

poisonfrog

Member
Join Date
Jan 2005
Posts
34
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 .. Thanks guys
 
To represent a number that is not a whole number (integer)? No, unless you would like to use the ASCII representation but then you couldn't use any of the math instructions.
 
You can, if you define the number stored within the N7 address to be 10^n x the actual variable.

For example, If I want a setpoint of 56.7 degrees, and I wanted to store it in N7:1 I could enter 567 in that address. However, keep in mind that your program would have to be aware of the situation and use the variable in that form (ie degrees x 10 in the SP as well as PV for a PID block).

If you needed to access the number as degrees once again, you could do a number of things to display that number (ie. configure the HMI to add a decimal position, or just divide the number by 10).
 
Floats & points

Interger Registers are 16 bit. Floating point are 32 bit. Allen-Bradley only guarantee's floating point numbers in the range of +/- 1.17594 e -38 to +/- 3.402823 e +38 and seven digits.

When using a copy instruction data is copied bit for bit from source to destination. Copying a float to int or visa-versa will maintain their bit integrity. Using a mov or math function will automatically do a data conversion to the destinations data format. Storing a real value < 1 into an integer word will result in a value of 0. Most people use integers to store decimals. Just note that the number is x10 or x100 etc. It is important to understand, when calculating, for accuracy use Floats, if moving, use integers and consider the rounding that happens if you move from float to integer, or back. This can be a real pain. If your application is an HMI do the calculations in the HMI. If not use the PLC but remember a float of 3976.442 will be transfered as 3976. Your application will determine what accuracy is needed.
I am now working with macros in excel to do may latest project math calcs... (grin)...Damm the PLC !!!:). OOPpppss.. sorry, must have lost it here...... PLCs are Kewl!!!! :) :) Bruce.
 
What I am trying to do is divide a number by a k factor of 3.10, this k factor may change from time to time for caibration by use of an HMI. So when I went to enter the factor into a integer file(surprise, surprise)it did not work. I should just be able to use a floating point like an integer, right? Are there any pros or cons to this? I would prefer to use a integer file, but the multiplications of the numbers make the program less accurate because of the rounding. I will check to see if panelview does math calculations.. Thanks guys:)
 
So when I went to enter the factor into a integer file(surprise, surprise)it did not work.

Why did you try to put a decimal value(the k factor) into an integer?

If working with decimals then why not use F files?

Sometimes I just dont understand.
 
I'm with Ron, just don't understand.

There may be a model of PLC-5 that doesn't support floating points, but I've never heard of it. I assume your HMI supports floating points. So.....why not use floating points?

The only time I would use the implied decimal is with equipment that doesn't support floating point. The work around of implied decimals is just that a work around. So.....why not use floating points?
 

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,591
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,523
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...
Replies
3
Views
1,407
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,370
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,847
Back
Top Bottom