13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Advanced Function <strong>Instruction</strong>FUN 69RTIRETURN FROM INTERRUPTFUN 69RTI• The function of this instruction is similar to RTS. Nevertheless, RTS is used to end the execution of subprogram, and RTI is used to end the execution of interrupt service program. Please refer to the explanationof RTS instruction.• A RTI instruction can be shared by more than one interrupt service program. The usage is the same as thesharing of an RTS by many subroutines. Please refer to the explanation of CALL instruction.• The difference between interrupts and call is that the sub program name (LBL) of a call is defined by user,and the label name and its call instruction are included in the main program or other sub program.Therefore, when PLC performs the CALL instruction and the input “EN”=1 or “EN↑” ( instruction)changes from 0→1, the PLC will call (execute) this sub program. For the execution of interrupt serviceprogram, it is directly used with hardware signals to interrupt CPU to pause the other less important works,and then to perform the interrupt service program corresponding to the hardware signal (we call it thecalling of interrupt service program). In comparing to the call instruction that need to be scanned toexecute, the interrupt is a more real time in response to the event of the outside world. In addition, theinterrupt service program cannot be called by label name; therefore we preserve the special “reservedwords” label name to correspond to the various interrupts offered by PLC (check FUN65 explanation fordetails). For example, the reserved word X0+I is assigned to the interrupt occurred at input point X0; aslong as the sub program contains the label of X0+I, when input point X0 interrupt is occurred (X0: ), thePLC will pause the other lower priority program and jump to the subroutine address which labeled as X0+Ito execute the program immediately.• If there is a interrupt occurred while CPU is handling the higher priority (such as hardware high speedcounter interrupt) or same priority interrupt program (please refer to Chapter 10 for priority levels), the PLCwill not execute the interrupt program for this interrupt until all the higher priority programs were finished.• If the RTI instruction cannot be reached and performed in the interrupt service routine, may cause a seriousCPU shut down. Consequently, no matter how you control the flow of program, it must be assured that theRTI instruction will be executed in any interrupt service program.• For the detailed explanation and example for the usage of interrupts, please refer to Chapter 10 forexplanation.7-52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!