Controllogix ADD or CTU not operating properly

from OkiePC ...

A periodic task wouldn't interrupt the middle of a math function.

I'm pretty sure that's incorrect, Paul ... I'd be willing to bet substantially more than pocket change on it ...

a couple of my students brought up the question awhile back - and we put together a little program to test the concept ... please let me know if you find anything wrong with the logic specified in the rung comments ...

note that if you inhibit the periodic task, then the program will run without a problem ... if you allow the task to manipulate the value of tag A, then it only runs for a few seconds before being killed by that "fault rung" at the bottom ... the only way that I can explain these results is that the periodic task is indeed changing the value of tag A partway through the execution of the CPT ...

sample Boot Camp program attached ...
 
Last edited:
Wow, that's surprising. This could really ruin your day if your periodic task was depending on data that might be randomly half baked.

Thanks, Ron for correcting my mistake on this subject and for diligently testing these things.
 
Last edited:
Does the ControlLogix have a way of disabling and enabling interrupts?

yes, each "task" (scheduler/interrupt) can be "inhibited" (disabled) ...

additionally each task can be given a "priority" to determine whether or not it is allowed to interrupt/outrank other tasks ...

note that ALL other "active" tasks always interrupt/outrank the continuous/default task ... in other words, "continuous" does NOT mean "continuous" ...

if tasks with equal priorities are executed simultaneously, they "timeshare" the processor's time ... one millisecond for me - one millisecond for you ...

task_properties.JPG
 
Last edited:
Ron, inhibiting the task is different from disabling interrupts. Disabling interrupts keeps interrupts and higher priority tasks from running until the interrupts are turned back on. This should only be done for short periods of time but it avoids the problem that can occur when an interrupt happens during an ADD.

This is 186 code but is should be easy to figure out. This example disables the interrupts so no other interrupt routine can change A or B during the add.
Code:
      PUSHF              // Save the state of the interrupt flag
      DI                   // disable interrupt
      MOV   AX,A      // C=A+B
      ADD   AX,B
      MOV  C,AX
      POPF               // Restore the state of the interrupt flag.
This problem is common when dealing with interrupts or multitasking operating systems where the different tasks have a different priority. Cooperative multitasking systems are easier to deal with for beginners where one task can't interrupt another but interrupts can still cause problems.
 
inhibiting the task is different from disabling interrupts.

sorry, Peter ... I was engrossed in the "task" context we were discussing at the time and I misunderstood what you were asking ...

take a look at the:

UID (User Interrupt Disable) ... and the
UIE (User Interrupt Enable) instructions ...

personally I've never worked with these – or even seen them used in a program ...

the Online Help says that these:

"... work together to prevent a small number of critical rungs from being interrupted by other tasks."

I believe that's what you're shooting for ...

as a test, I entered a UID-UIE zone around the original CPT instruction ... the program that had previously been faulting then ran properly ... as an additional test, I temporarily disabled the UID rung - and the program faulted within just a few seconds ...
 
Last edited:
periodic task

Periodic tasks will inturrupt anything when they are triggered. This is an unfortunate side effect of periodic tasks and why Rockwell advises against using them unless it is used in a process that is very slow in processing, or using just a periodic and not a continuous. It is a very detailed process and we are in the middle of struggling with them right now.

So is there a periodic in the program in question?
 
Now we know how to make sure a CPT or ADD doesn't get interrupt

It is nice of you to test this out for us.
The CPS instruction probably disables and enables the interrupt automatically.

The UID and UIE instructions should be used with care because the interrupts will not activated when they are supposed to when interrupts are off. This will cause sample jitter in any sampling done during interrupts. This is especially troublesome when trying to compute speeds using an encoder.

Variable accessed by two or more tasks or interrupts need special care.
 
yep ... it can interrupt an ADD statement too ... takes a few seconds longer, but way less than a minute ...

I do not use L5K much so I may be missing something here. Basically what I think you are saying is that if the data ia being updated outside of the scan that is using it then the data can change while you are working with it?

If this is true can you not just move the data to another register in the same scan prior to your math function to prevent this?
Example:

You take A and move it to B in the task you are doing your math in?
 
Originally posted by Peter Nachtwey:

This will cause sample jitter in any sampling done during interrupts. This is especially troublesome when trying to compute speeds using an encoder.

Unless you go around big chunks of code the jitter caused by the I/O update stategy and the I/O itself in a plc will be much worse than anything you do with interrupt disables. PLC I/O just isn't very friendly when it comes to precision timing.


Originally posted by Clay B.:

If this is true can you not just move the data to another register in the same scan prior to your math function to prevent this?

As long as it is a base microprocessor size unit you will be OK. So if you are talking about moving a single DINT, for example, it should be fine using the MOV method. But anything dealing with any larger data grouping (UDT, array string, etc) cannot be handled this way without using a CPS. From what I understand the only restriction on interrupts is that the microprocessor needs to finish the base instruction it is working on before the interrupt can occur. So even with a MOV you can get caught in the middle. It's just that in that case all you are getting is newer data, not a mix of new and old data.

Keith
 
Last edited:
Does anyone know if the UID UIE can stop the motion planner from executing?
I cannot tell from the manuals

Back on topic
in bradal's last last movie TEST_COUNTER[1].ACC is showing two different values on the same rung at time 0:39
once as a .acc read the other as a counter read
 

Similar Topics

I am trying to add 9 DINT values with the CPT instruction in ControlLogix and I keep getting errors. I am just choosing each tag with an add...
Replies
13
Views
2,256
Good Morning , I am getting ready to install a Banner IVU Plus BCR in a ControlLogix . It seems like it is easier to install the IVU Plus...
Replies
0
Views
1,402
I am new to AOIs, and do not have a processor handy to test my program. I have a couple of simple questions, which I have not been able to find an...
Replies
10
Views
10,090
I have been using RS5000 for sometime now, since ver 11. Ver 16, now has the neat "add on" function. I have just started playing with this, and...
Replies
3
Views
6,194
Hi everyone i have a customer, who wants to show an alarm on the machine, if the I/O forces are enabled and set, on at ControlLogix L81E with...
Replies
3
Views
140
Back
Top Bottom