RsLogix5000 same code in AOI vs. Subroutine produce different results

cmandric

Member
Join Date
Feb 2013
Location
Port Moody
Posts
5
Does anybody have run into the issue when the same structured text code from a subroutine has hiccups while copied/pasted an AOI? The issue is that I'm getting transient garbage data at 5% of the time. The code uses a lot of FOR-NEXT loops and array of UDT's. :confused:
 
Does anybody have run into the issue when the same structured text code from a subroutine has hiccups while copied/pasted an AOI? The issue is that I'm getting transient garbage data at 5% of the time. The code uses a lot of FOR-NEXT loops and array of UDT's. :confused:

Quick guess without seeing your code you are probably getting caught on loop variables initializing differently
 
Hi Michael, Is there any chance the processor to do some multitasking stuff, bailing off my AOI in the middle of it? Should the program be linear or the controllogix does some sort of optimizations, especially when it has to do long routines(the AOI it takes about 7 mS on a L61 controller) Without getting into details, the garbage data I'm getting makes no sens.
Thanks for your replay.
 
Is there any chance the processor to do some multitasking stuff, bailing off my AOI in the middle of it?

to answer your specific question: yes ... in the asynchronous scan sequences used by the ControlLogix and the CompactLogix platforms, the processor can actually "interrupt" things right smack-dab in the middle of a math instruction ...

read posts #61 through #64 of this thread ...

http://www.plctalk.net/qanda/showthread.php?p=376167&postcount=61

in particular, take a look at the sample program printout (PDF) provided in post #64 ... this type of stuff takes a lot of programmers by surprise ...

read the rest (or even ALL) of the thread for additional information that might be helpful to you ...

since you haven't posted your program file, all we can do is guess – but if you have other tasks operating in your system, then you might be experiencing the types of problems discussed in the thread that I've linked above ...

good luck with your project – and welcome to the forum ...
 
Hi Ron, In the power generation our processes are fairly slow and we never bothered with the scheduled tasks. We always had everything in the Main Task. Lately I've been trying to standardize our process based on sub-processes (AOI) and I've choose to use Structured Text, as this would make porting the code to S7 or any CodeSys based PLC a piece of cake. Now I have to think twice. However, I've moved my tasks in the scheduled task with a priority of 1 and this have cured the issue. Many thanks. Cristian
 
glad I was able to help ...

regarding your statement:

I've moved my tasks in the scheduled task with a priority of 1 ...

you're probably OK with that approach IF (that's a big IF) you stay with the CONTROL-Logix platform ... just be aware that if you ever try doing this with a COMPACT-Logix system, then setting your tasks for a priority higher than 6 (lower number than 6) can cause troubles for you ...

the COMPACT-Logix platform uses a "dedicated task" with a priority of 6 to handle its I/O transfers ... so setting other tasks with too high a priority (especially if those tasks take a fair amount of time to execute) can "hog the time" away from the I/O task ... that will fall squarely into the "bad" column of life's experiences ... basically you can intermittently "miss" or "skip" fast-acting counts from field devices, etc. ...

secret handshake: just because the CONTROL-Logix and the COMPACT-Logix both use the same RSLogix5000 software for their programming does NOT mean that the two platforms operate the same "under-the-hood" ...

once again, since we can't see your program code, all we can do is GUESS – but it sounds like your problem has been taken care of ...

party on ...
 
No problems having for next loops in AOI

As a matter of fact you can use for next loop. I'm using at least 10 of them, some of them loop in loop with a lot of conditionals if_elseif in an AOI that just passed my tests.
Here is a sample of one of my loops=>Two loops in a loop. PRIO_1_FOUND := 0;
FOR j := 1 TO NO_OF_UNITS DO
FOR i := 1 TO NO_OF_UNITS BY 1 DO
IF GEN_OUT.PRIO_REAL = 1 THEN
PRIO_1_FOUND := 1;
EXIT;
END_IF;
END_FOR;

IF NOT PRIO_1_FOUND THEN
FOR k := 1 TO NO_OF_UNITS BY 1 DO
IF GEN_OUT[k].PRIO_REAL > 1 THEN
GEN_OUT[k].PRIO_REAL := GEN_OUT[k].PRIO_REAL - 1;
END_IF;
END_FOR;
END_IF;
END_FOR;
 
I tried for loop while back... Interesting part is it don't gives you errors and It don't works.

Check attached screenshot from manual.

Alternative ... I used Repeat ..Until Loop and then its working.

Untitled.jpg
 
Remember there are TWO different FOR..Next instructions in a ControlLogix. One is for ladder and the other is for structured text. I *think* the reference in the manual is for the ladder FOR NEXT instruction.
 
Interesting... And the manual it is not that outdated. Maybe they don't work in older FW revisions. I did my tests on FW 19.01. I should probably check with Rockwell to make sure I won't have any surprises on the field. It would be a very disappointing not to use the AOI's I've created.
 
Remember there are TWO different FOR..Next instructions in a ControlLogix. One is for ladder and the other is for structured text. I *think* the reference in the manual is for the ladder FOR NEXT instruction.

+1
I have used the structured text FOR DO in AOI's without issue

Never tried to use the ladder FOR NEXT
 

Similar Topics

Hi, Anyone can guide me? Can i run Factory Talk SE client file and communicate with RsLogix5000 emulator by using in a same laptop? If yes, how...
Replies
2
Views
17,886
Dear Sir, I am using RSlogix 5000 V17.01.00 (CPR 9 SR 1). I want to add two chassis in hardware configuration... like Chassis 1 and...
Replies
2
Views
3,275
A guy is telling me if a ControlLogix 5000 was programmed with version 15 RSLogix 5000 you need Ver 15 RSLogix 5000 to open it That version 19...
Replies
10
Views
6,311
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
112
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
427
Back
Top Bottom