Help - Search - Members - Calendar
Full Version: Programming a lot of Expressions
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
mulderm
Hello,

I must programming a lot of expressions in a PLC5/25 processor
using RSLogix5.
When I will program the follow expression:
n7:241 = (500-n7:240)+114 with the CPT-instruction I get the
error: Expression not allowed.
When I program this using the SUB and ADD instruction I see
on the histogram that the value will changes between 311 and 425.
And this must be 425!
Who can help me?

mulderm
BobLfoot
QUOTE(mulderm @ Nov 24 2006, 10:19 AM) [snapback]44385[/snapback]

Hello,

I must programming a lot of expressions in a PLC5/25 processor
using RSLogix5.
When I will program the follow expression:
n7:241 = (500-n7:240)+114 with the CPT-instruction I get the
error: Expression not allowed.
When I program this using the SUB and ADD instruction I see
on the histogram that the value will changes between 311 and 425.
And this must be 425!
Who can help me?

mulderm


The RSlogix program grabs the value of N7:241 and displays it asynchronus to the program scan. Sometimes you get N7:241 before the 114 is added sometimes after. Extend the branch down and mov N7:241 to N7:242 and you'll always see 425 in N7:241. Another way to do this Sub 500 N7:240 N7:242 Add N7:242 114 N7:241 and you'll see 425 in N7:241.

What you've stumbled on is the internal working of RSLogix.
OZEE
The reason the historian is showing the value changing between 311 and 425 is that it's occasionally capturing the temporary value in the SUB instruction before ADDing the 114. If you wish to stop that, you'll want to use a separate N for the Destination of the SUB instruction (then obviously the Source A of the ADD)


As far as why the CPT isn't working, I don't have RSLogix5 on this computer to be able to play with it... Sorry.

Why not try (614-N7:241) -- do the constant addition yourself so you don't "waste" PLC resources for that??
mulderm
The values are example's.

When I use N7:241 as the destination I know that this is good.

N7:242 is then use as an accumulator.

So when I use morther expressions I have a lot of accumulators

and that is not what I want.

Can I using the S24 indexed addressing for this and how must I

program this?



mulderm

BobLfoot
QUOTE(mulderm @ Nov 24 2006, 11:00 AM) [snapback]44391[/snapback]

The values are example's.

When I use N7:241 as the destination I know that this is good.

N7:242 is then use as an accumulator.

So when I use morther expressions I have a lot of accumulators

and that is not what I want.
mulderm


N7:242 was picked at random you can use N7:?? where ?? is any previously unused integer.
BobLfoot
Hey I finally opened my work laptop with RSlogix and have your answer. Go to Help - Instruction Help and select the CPT instruction. There you will read that "Complex Compute Instructions with more than two operands are only supported in Ehnhancd PLC 5 processors". The PLC 5/25 does not qualfy as enhanced. You'll need to upgrade processor or do the math in steps {Sub, ADD}.
mulderm
Thank you for the information guys.

mulderm

newpageboba
I learned something new about something old.

I would never have thought that was a enhanced function

Good catch BobLfoot
BobLfoot
QUOTE(newpageboba @ Nov 24 2006, 09:08 PM) [snapback]44427[/snapback]

I learned something new about something old.

I would never have thought that was a enhanced function

Good catch BobLfoot


Hey I had to Open Logix5 and read the help file myself to find it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.