Docsity

Understanding Interrupts in Programmable Logic Controllers (PLCs) by Dr. D. J. Jackson, Slides of Programmable Logic Controllers

Partial preview of the text

Download Understanding Interrupts in Programmable Logic Controllers (PLCs) by Dr. D. J. Jackson and more Slides Programmable Logic Controllers in PDF only on Docsity!

Programmable Logic

Controllers

Interrupts

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

Interrupt Basics

 In terms of a PLC

 What is an interrupt?  When can the controller operation be interrupted?  Priority of User Interrupts  Interrupt Latency  Interrupt Instructions

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

What is an Interrupt?

• An interrupt is an event that causes the

controller to suspend the task it is currently

performing, perform a different task, andf f d ff k d

then return to the suspended task at the

point where it suspended.

• The Micrologix PLCs support the following

User Interrupts:

U F l R i

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

  • User Fault Routine
  • Event Interrupts (4)
  • High-Speed Counter Interrupts(1)
  • Selectable Timed Interrupt

Interrupt Operation

  • An interrupt must be configured and enabled to execute. When any one of the interrupts is configured (and enabled) and subsequently occurs, the user program:
    1. suspends its execution
    2. performs a defined task based upon which interrupt occurred
    3. returns to the suspended operation.

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

Priority of User Interrupts

• When multiple interrupts occur, the

interrupts are serviced based upon their

individual priority.d d l

• When an interrupt occurs and another

interrupt(s) has already occurred but has not

been serviced, the new interrupt is scheduled

for execution based on its priority relative to

the othe pending inte pts

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

the other pending interrupts.

  • At the next point in time when an interrupt can be serviced, all the interrupts are executed in the sequence of highest priority to lowest priority.

Priority of User Interrupts

  • If an interrupt occurs while a lower priority interrupt is being serviced (executed), the currently executing interrupt routine is suspendedinterrupt routine is suspended, and the higher and the higher priority interrupt is serviced. - Then the lower priority interrupt is allowed to complete before returning to normal processing.
  • If an interrupt occurs while a higher priority interrupt is being serviced (executed), and the pending bit has been set for the lower priority interrupt, the

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

been set for the lower priority interrupt, the currently executing interrupt routine continues to completion.

  • Then the lower priority interrupt runs before returning to normal processing.

Interrupt Priorities

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

Interrupt Latency

  • Interrupt Latency is defined as the worst case amount of time elapsed from when an interrupt occurs to when the interrupt subroutine starts tooccurs to when the interrupt subroutine starts to execute.

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

UID - User Interrupt Disable

  • The UID instruction is used to disable selected user interrupts.

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

p

Types of Interrupts Disabled by

the UID Instruction

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

Types of Interrupts Disabled by

the UID Instruction

• To disable interrupt(s):

  1. Select which interrupts you want to disable.
  2. Find the Decimal Value for the interrupt(s) you selected.
  3. Add the Decimal Values if you selected more than one type of interrupt.
  4. Enter the sum into the UID instruction.

• For example to disable EII Event 1 and EII

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

• For example, to disable EII Event 1 and EII

Event 3:

  • EII Event 1 = 32, EII Event 3 = 4
  • 32 + 4 = 36 (enter this value)

UIE - User Interrupt Enable

  • The UIE instruction is used to enable selected user interrupts.

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 13-

p

  • The parameter for the UIE instruction is computed exactly as the UID instruction.