Strange behavior of RSLogix CPT instruction

What if you tried adding another pair of parentheses around the whole formula?
I did mess with the parentheses quite a bit... When I tried putting them around the entire expression, RSLogix just removed them.

I suspect it's some kind of nesting limit as Damian suggested.
 
After some more playing around I've determined that the problem occurs when nesting constant values more than one level deep, but only when using Long data file elements. That would make it specific to the 1400, since it's the only PLC that supports both CPT and Long registers.

In the screenshot, all rungs verify on my system (v8.4) except 0002. I'll submit the issue to RA tech support and see what they say.

cptinst2.JPG
 
Are all these paranteses necessary ?

((L10:11 + (L10:12 * 2)) * 1000) | L9:4

can be rearranged as

(L10:11 + (L10:12 * 2)) * 1000 | L9:4

And maybe this is less hard for the CPU (because it can close the L10:12 * 2 parantesis before doing the add with L10:11)

((L10:12 * 2) + L10:11) * 1000 | L9:4
 
I don't have much control over the parentheses; RSLogix adds them.

If I were to type

(L10:11 + (L10:12 * 2)) * 1000 | L9:4

it is changed to

((L10:11 + (L10:12 * 2)) * 1000) | L9:4
 
I don't see why 3 level of parentheses should be a problem. This should be easy stuff.
Now that I know much more about how compilers and interpreters work I suggest trying this:
Code:
(L10:12*2+L10:11) * 1000 | L9:4
Internally this should required only two registers.

RSLogix turned your suggestion into
( ( ( L10:12 * 2 ) + L10:11 ) * 1000 ) | L9:4

and did not compile.
 
Looks like it's actually a bug. Here's the reply I got from Rockwell:

Engineering reports that this is a compiler issue and may get fixed in the future. The workaround is to MOV the constant into a Long integer (Lx:y) and then use Lx:y in the CPT instruction instead of the constant itself.
 

Similar Topics

Hello all, I am facing an issue with my Commander SK that I cannot solve on my own, I am struggling on it since several days :confused: The...
Replies
9
Views
1,063
I have a small system controlled by a Siemens S7-1200 PLC. I created a totalizer function block (TIA v17), where I'm counting total revolutions...
Replies
16
Views
3,144
Hi, I'm experiencing a very strange issue with the functionality of an AOI after upgrading to firmware V32. Bit of background: CPU is a CLX...
Replies
9
Views
3,308
Our CNC machine's spindle has a speed feedback encoder connected to it via a belt. The feedback rpm is displayed on the operator screen. When we...
Replies
4
Views
2,193
I have two output cards sitting next to each other in a rack: 1746-OW16 1746-OW16 (Octal) output 13 in the first card triggers a solenoid. When...
Replies
2
Views
2,209
Back
Top Bottom