about the CPT instruction in RSLogix

buhnen

Member
Join Date
May 2008
Location
Somewhereland
Posts
131
Hi folks,

I'm back again with a new question to you....While testing a code I made, I've noticed something I can't explain. I'm using the CPT instruction as you can see in the attached screencaptures showed below. It happens that depending on the order I choose for placing the operands (DINT's variables) in the equation I get different results (one of them is wrong ) when this shouldn't happen at all... I wonder what's the reason for this?

An image is better than thousand words, so it's better you see it by yourself...

And thanks in advance again for your attention.

1.jpg 2.jpg
 
Hi there
What I believe is that in case 1 (1.jpg)rounding off is taking place, that is 10/100=0.1 rounded to "0" and then multiplied by 100 hence result is zero.

In second case there is no rounding off is taking place and the result is as expected the "10"

To avoid the rounding of problem you need to define the variables as Floating (real) and not as integer or double integer.
 

Similar Topics

I was pleasantly surprised to learn that the Micrologix 1400 has the Compute (CPT) instruction available. But my problem is this: The two...
Replies
23
Views
9,483
I am trying to interpret a compute function in RSLogix 500. This seems like a stupid question but it has me stumped. Maybe someone can help. The...
Replies
3
Views
13,451
I have ran into something I have not seen before and wondering if any one had any ideas. The logic I'm currently troubleshooting is using a...
Replies
3
Views
1,662
Needing help with this, keep getting an error...
Replies
16
Views
4,956
What is the symbol for divide used in a CPT Instruction Expressions - The expression is zero or more lines, with up to 28 characters per line, up...
Replies
11
Views
3,624
Back
Top Bottom