RSLogix500 CPT Instruction Help

julianf400

Member
Join Date
Jun 2008
Location
Melbourne
Posts
10
Hi all,

I am having a few difficulties with the CPT instruction and getting the dreaded "invalid expression ! Two operands in sequence! ", my formula is as follows:

Pw = EXP (C8/Tg+C9+C10*Tg+C11*Tg^2+C12*Tg^3+C13*Ln(Tg))

and my CPT function logic is this

( 2.7182818284 * ( F8:0 | F8:6 + F8:1 + F8:2 * F8:6 + F8:3 * ( XPY ( F8:6 , 2 ) ) + F8:4 * ( XPY ( F8:6 , 3 ) ) + F8:5 * ( LN ( F8:6 ) ) )

all of my "Cxx" and "Tg" values are either constants or derived from previous compute functions which are compiling fine.
 
Last edited:
I don't see any glaring errors but usually when I have to do an exponent in CPT I use **, as in F8:6**2.0.
 
I believe the problem to be with the orientation of the XPY command, if i replace them with the "**" it will compile, however it then re-arranges my equation to look like this automatically?

2.718282 * ( ( ( ( ( ( F8:0 | F8:6 ) + F8:1 ) + ( F8:2 * F8:6 ) ) + ( F8:3 * ( F8:6 ** 2.0 ) ) ) + ( F8:4 * ( F8:6 ** 3.0 ) ) ) + ( F8:5 * ( LN F8:6 ) ) )
 
( 2.7182818284 * ( F8:0 | F8:6 + F8:1 + F8:2 * F8:6 + F8:3 * ( XPY ( F8:6 , 2 ) ) + F8:4 * ( XPY ( F8:6 , 3 ) ) + F8:5 * ( LN ( F8:6 ) ) )
8 red ones
7 green ones
 
I confirmed that XPY is not a valid operator for the CPT instruction; you have to use **. Once I made this change to your original expression, and corrected the number of parentheses, it compiled OK on my system.
 
Thanks for the help everyone, i will run manual calcs before commissioning just to confirm that more parentheses isnt going to upset anything.
 
Welcome to the PLCTalk forum community, lokeshdhayal7940.

In general, it's best to create a new thread with a new question. This thread is six years old and is specifically about the Exponent operator.

For general questions, always start with a user manual or reference manual.

The SLC-500 instruction set reference is detailed in the RSLogix 500 Instruction Set Reference Manual, available in PDF format from Rockwell:

http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1747-rm001_-en-p.pdf

There may be minor differences when you're dealing with a modern MicroLogix controller, but your general question of "how does the CPT instruction work" should be well answered by that manual.
 

Similar Topics

Hi All I am getting a 'Source and Destination may not be an immediate' Error from a CPT instruction, I am using both Floats and Ints in the...
Replies
21
Views
6,047
So here's my situation, I have been tasked with modifying the logic to mimic a button press in the PLC. I have two identical machines however one...
Replies
6
Views
533
Hello, I'm new to programming. I'm using RSLogix500 to modify an existing program for a SLC500. My plan was to use one of the existing inputs...
Replies
26
Views
1,952
So i have an allen bradley rack (2080-LC50-24QWB), i have it connected through ethernet. I dont have an offline program so im trying to upload...
Replies
6
Views
657
Hi Everyone, I am supporting a system which runs on a SLC 500 (1747-L532). A fault has developed whereby the output state of some digital outputs...
Replies
10
Views
985
Back
Top Bottom