RSLogix5000 What's wrong with this CMP statement?

evanmars

Member
Join Date
Nov 2005
Location
MI
Posts
2
RSLogix 5000



I am getting a 'CMP, Operand 0: Invalid expression.' for this. It's been a long week, I can't see the problem.

(a = (b + 1)) OR (a = 1)
 
RSLogix 5000



I am getting a 'CMP, Operand 0: Invalid expression.' for this. It's been a long week, I can't see the problem.

(a = (b + 1)) OR (a = 1)

That is your problem. That is a True/False. You are essentialy checking if A = True or False. Let's Assume A = 5 and B = 10 and break that down.

TagA = TagB +1
This resolves to if 5 = 11 which is a valid statement but would be false with the current values.

OR

if TagA = TagA = 1 (5 = 5 = 1)
This of course does not make logical sense. For example, change that to A + 1 and you have a valid statement that the editor will accept.

OG
 
Last edited:
You are using OR as your final comparison, but OR is a bitwise or, not a comparison.
 
Last edited:
Compare-OR.png
 
Someone recently claimed a logical-OR was added to the Logix 5000 comparison expression operators, but as far as anyone replied it was not in version 30 or less if I remember correctly. Not sure if anyone checked the newer versions.
 
His OR logic did not make any sense to me, but the rung in the picture shown there were no error.
 

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
89
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
423
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,117
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
857
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,926
Back
Top Bottom