Scan-dependent Logic
If you use controller-scoped tags and program a lower priority task so that one instruction is dependent on another instruction that occurs elsewhere in your program, a task interrupt and switchover can disrupt your programming. The disruption can occur because the higher priority task can interrupt the lower priority task and then a switchover can occur before the lower priority task is completed.
When the lower priority task is executed from the beginning by the new primary controller after the switchover, the dependent instruction can fail to execute at the most recent value or state. For example, if a higher priority task interrupts the logic as shown below, the value of scan_count.ACC is sent to the secondary controller at the end of the program in the higher priority task. If a switchover occurs before the primary controller completes the EQ instruction, the new primary controller starts its execution at the beginning of the program and the EQ instruction misses the last value of scan_count.ACC. As a result, any programming that uses the Scan_Count_Light tag can also execute by using incorrect data.
The following logic uses a Counter Instruction (CTU) to count each scan of the program. An Equal To (EQ) instruction uses the accumulated scan-count value as a reference to turn on an indicator when the thousandth scan is complete.
Scan-dependent Logic
Bind Dependent Instructions with UID and UIE Instructions
If you cannot place scan-dependent instructions in the highest priority task, consider using the User Interrupt Disable (UID) and User Interrupt Enable (UIE) to help prevent a higher priority task from interrupting the scan-dependent logic. For example, if you bind the scan-dependent logic that is previously shown, a higher priority task would not interrupt the dependent instructions and a switchover would not result in inconsistent data.
Scan-dependent Instructions Bound with UID and UIE Instructions
For more information about UID and UIE instructions, see the Logix 5000 Controllers General Instructions Reference Manual, publication 1756-RM003.
Provide Feedback