{"id":3212,"date":"2026-11-17T18:38:21","date_gmt":"2026-11-17T10:38:21","guid":{"rendered":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/mplc-m03-en-05\/"},"modified":"2026-11-17T18:38:21","modified_gmt":"2026-11-17T10:38:21","slug":"mplc-m03-en-05","status":"publish","type":"post","link":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/mplc-m03-en-05\/","title":{"rendered":"Chapter 5 Interrupt Function"},"content":{"rendered":"<h3>5-1  The Principle and the Structure of Interrupt Function<\/h3>\n<p>There are many jobs that M-Series PLC needs to carry out. For example, there are at least 20k words user\u2019s program need to be solved, 1024 points of I\/O status need to be captured or updated, many communication ports need to be serviced, and etc. However, jobs can only be executed one at a time as there is merely one CPU available. Therefore, PLC service one job after another in sequence until all the jobs are executed once. Then, it will return to the first job to repeat the same cycle. The time interval of each execution is called the \u201cscan time\u201d of PLC. The CPU execution speed is extremely fast in comparison with human response. As far as human feeling is concerned, PLC almost completes all jobs at the same time when PLC can normally complete the foregoing huge workload within tens of milliseconds(ms). Hence, it can meet the requirements of the most practical control cases.<\/p>\n<p>In most application cases, the control method described above is very much sufficient. But for some applications that require a high-speed response (such as positioning control), a delay in scan time will certainly mean an increase in error. Under the circumstances, only applying the \u201cInterrupt\u201d function can achieve the precision requirement.<\/p>\n<p>The so-called \u201cInterrupt\u201d means the interrupt request to the CPU during normal scan cycle when an immediate response is required. After receiving such request, the CPU will promptly stop all scanning work to prioritize to perform and complete the corresponding service work before return (the so-called \u201cReturn from Interrupt\u201d or RTI) to where interrupt occurred and resume the interrupted scanning work.<\/p>\n<p>The service work needed to carry out while interrupt occurred is called Interrupt Service Routine, which is a subroutine consisted by a series of ladder codes. It is placed in the subroutine area and begin with the LBL instruction with reserved label name (please refer to Section 5.3). Since it is placed in the subroutine area, it will not be executed in a normal PLC scanning cycle (PLC only constantly scans the main program area but not the subroutine area).<\/p>\n<p>In normal case, the CPU can promptly execute the corresponding interrupt routine within hundreds of micro-seconds when an interrupt occurred. When there are more than one interrupt occurred at the same time (i.e., M-Series PLC has 36 interrupts source), only the interrupt with highest priority can be executed. All the other interrupt routines need to wait until it became the highest priority among the pending interrupts. Consequently, a response delay of hundreds of microseconds, or even few milliseconds, may be caused. Hence, in a multiple interrupt inputs structure, an interrupt priority is given to each interrupt in accordance with its importance. In case another interrupt request is made when the PLC is carrying out the interrupt service routine for an interrupt request that has a higher priority than the new interrupt request, the CPU will wait until the execution of the subroutine is completed before accepting the new interrupt request. However, if the priority of the new interrupt request is higher than the one being executed, the CPU will stop the running of the current interrupt service routine immediately to execute the interrupt service routine with a higher priority. After completing the execution, the CPU will return to the previously interrupted service routine with a lower priority to continue the incomplete work. This kind of interrupt in an interrupt execution is called the \u201cNested Interrupt\u201d.<\/p>\n<h3>5-2  Structure and Application of Interrupt Service Routine<\/h3>\n<p>Although both \u201cInterrupt\u201d and \u201cCall\u201d are having subroutines, but the calling methods (to jump to subroutine for execution) are different. When the CALL command [FUN67] is executed by \u201cCall\u201d in the main program, the CPU will execute the subroutine with the label name designated by the CALL command. The CPU will return to the main program after the RTS (Return from Subroutine) command is executed.<\/p>\n<p>The calling of \u201cInterrupt\u201d is triggered by, instead of using software commands, the hardware interrupt signal to the CPU. The CPU will identify the source of the interrupt and jump automatically to the \u201cInterrupt Service Routine\u201d with the label name of the interrupt in the subroutine for execution. It will return to the main program after the RTI (Return from Interrupt) command is executed. Therefore, there is no ladder code relevant to interrupt in the main program area.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>As mentioned before, interrupt service routine must be placed in the sub program area. The structure is shown as the diagram on the right where a \u201chead\u201d, a \u201ctail\u201d and the main body of the service routine are included. The \u201chead\u201d is the \u201cinterrupt label name\u201d of the interrupt (to be discussed in the next section). The \u201ctail\u201d is the RTI command [FUN69], to tell the CPU that the interrupt subroutine is ended and it should jump to the place where were interrupted, please refers to FUN69 (RTI) instruction. In between the \u201chead\u201d and the \u201ctail\u201d is the main body of the interrupt service routine used to tell the CPU what control actions should be executed when interrupt occurs.<\/p>\n<\/td>\n<td>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-001.png\" \/><\/p>\n<p>The power line for subroutine is indicated by double lines to differentiate from the power line for the main program (single line) for <\/p>\n<p>easy reading.<\/p>\n<p>Figure 12 Interrupt Service Routine<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>5-3  Interrupt Source, Label and Priority<\/h3>\n<p>As described in the last section, every \u201cInterrupt Service Routine\u201d should have a unique \u201cInterrupt Label\u201d. There are \u201cInterrupt Labels\u201d for interrupts, namely \u201cInterrupt Reserve Words \u201cin UperLogic, can be used in the sub program area of M-Series PLC. These labels are dedicated to the interrupt routines hence cannot use for normal subroutine or jump target.<\/p>\n<p>The \u201cInterrupt Label\u201d (Interrupt Reserve Words) are all suffix with an \u201cI\u201d letter. For examples, the interrupt label for high-speed counter HSC0 should be \u201cHSC0I\u201d and the interrupt label for X0+ should be \u201cX0+I\u201d. The \u201cInterrupt Labels\u201d and their priorities for M-Series PLC interrupt sources are shown as below.<\/p>\n<p>The following table is the interrupt sources and their label names, the principle of use is to use STM0I~STM3I, X0+I~X7 first\u3002<\/p>\n<p>The smaller the priority value, the higher the priority of the interrupt source or tag.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Suspension source<\/p>\n<\/td>\n<td>\n<p>Priority<\/p>\n<\/td>\n<td>\n<p>Suspension marking<\/p>\n<\/td>\n<td>\n<p>Conditions<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>Remark<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"8\">\n<p>Hardware timing base<\/p>\n<\/td>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM0I<\/p>\n<\/td>\n<td>\n<p>Interval: 1ms\u201360000ms<\/p>\n<\/td>\n<td colspan=\"2\" rowspan=\"4\">\n<p>Time unit: 1ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM1I<\/p>\n<\/td>\n<td>\n<p>Interval: 1ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM2I<\/p>\n<\/td>\n<td>\n<p>Interval: 1ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>STM3I<\/p>\n<\/td>\n<td>\n<p>Interval: 1ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM0I<\/p>\n<\/td>\n<td>\n<p>Interval: 10ms\u201360000ms<\/p>\n<\/td>\n<td colspan=\"2\" rowspan=\"4\">\n<p>Time unit: 10ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM1I<\/p>\n<\/td>\n<td>\n<p>Interval: 10ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM2I<\/p>\n<\/td>\n<td>\n<p>Interval:10ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>LTM3I<\/p>\n<\/td>\n<td>\n<p>Interval:10ms\u201360000ms<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\">\n<p>HSC<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC0I<\/p>\n<\/td>\n<td>\n<p>HSC0 to (CV=PV)<\/p>\n<\/td>\n<td colspan=\"2\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC1I<\/p>\n<\/td>\n<td>\n<p>HSC1 to (CV=PV)<\/p>\n<\/td>\n<td colspan=\"2\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC2I<\/p>\n<\/td>\n<td>\n<p>HSC2 to (CV=PV)<\/p>\n<\/td>\n<td colspan=\"2\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>HSC3I<\/p>\n<\/td>\n<td>\n<p>HSC3 to (CV=PV)<\/p>\n<\/td>\n<td colspan=\"2\"><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\">\n<p>HST<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST0I<\/p>\n<\/td>\n<td>\n<p>HST0 to (CV=PV)<\/p>\n<\/td>\n<td colspan=\"2\" rowspan=\"4\">\n<p>Time unit: 100us<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST1I<\/p>\n<\/td>\n<td>\n<p>HST1 to (CV=PV)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST2I<\/p>\n<\/td>\n<td>\n<p>HST2 to (CV=PV)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>HST3I<\/p>\n<\/td>\n<td>\n<p>HST3 to (CV=PV)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"16\">\n<p>Digital input<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X0+I (INT0+)<\/p>\n<\/td>\n<td>\n<p>X0 Positive edge triggered<\/p>\n<\/td>\n<td colspan=\"2\" rowspan=\"16\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X0\u2212I (INT0-)<\/p>\n<\/td>\n<td>\n<p>X0 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X1+I (INT1+)<\/p>\n<\/td>\n<td>\n<p>X1 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X1\u2212I (INT1-)<\/p>\n<\/td>\n<td>\n<p>X1Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X2+I (INT2+)<\/p>\n<\/td>\n<td>\n<p>X2 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X2\u2212I (INT2-)<\/p>\n<\/td>\n<td>\n<p>X2 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X3+I (INT3+)<\/p>\n<\/td>\n<td>\n<p>X3 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X3\u2212I (INT3-)<\/p>\n<\/td>\n<td>\n<p>X3 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X4+I (INT4+)<\/p>\n<\/td>\n<td>\n<p>X4 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X4\u2212I (INT4-)<\/p>\n<\/td>\n<td>\n<p>X4 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X5+I (INT5+)<\/p>\n<\/td>\n<td>\n<p>X5 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X5\u2212I (INT5-)<\/p>\n<\/td>\n<td>\n<p>X5 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X6+I (INT6+)<\/p>\n<\/td>\n<td>\n<p>X6 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X6\u2212I (INT6-)<\/p>\n<\/td>\n<td>\n<p>X6 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X7+I (INT7+)<\/p>\n<\/td>\n<td>\n<p>X7 Positive edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>X7\u2212I (INT7-)<\/p>\n<\/td>\n<td>\n<p>X7 Negative edge triggered<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"18\">\n<p>Digital input<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X8+I(INT8+)<\/p>\n<\/td>\n<td>\n<p>X8 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X8-I(INT8-)<\/p>\n<\/td>\n<td>\n<p>X8 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X9+I(INT9+)<\/p>\n<\/td>\n<td>\n<p>X9 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X9-I(INT9-)<\/p>\n<\/td>\n<td>\n<p>X9 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X10+I(INT10+)<\/p>\n<\/td>\n<td>\n<p>X10 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X10-I(INT10-)<\/p>\n<\/td>\n<td>\n<p>X10 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X11+I(INT11+)<\/p>\n<\/td>\n<td>\n<p>X11 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X11-I(INT11-)<\/p>\n<\/td>\n<td>\n<p>X11 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X12+I(INT12+)<\/p>\n<\/td>\n<td>\n<p>X12 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X12-I(INT12-)<\/p>\n<\/td>\n<td>\n<p>X12 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X13+I(INT13+)<\/p>\n<\/td>\n<td>\n<p>X13 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X13-I(INT13-)<\/p>\n<\/td>\n<td>\n<p>X13 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X14+I(INT14+)<\/p>\n<\/td>\n<td>\n<p>X14 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X14-I(INT14-)<\/p>\n<\/td>\n<td>\n<p>X14 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X15+I(INT15+)<\/p>\n<\/td>\n<td>\n<p>X15 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X15-I(INT15-)<\/p>\n<\/td>\n<td>\n<p>X15 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X16+I(INT16+)<\/p>\n<\/td>\n<td>\n<p>X16 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X16-I(INT16-)<\/p>\n<\/td>\n<td>\n<p>X16 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"14\">\n<p>Digital input<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>X17+I(INT17+)<\/p>\n<\/td>\n<td>\n<p>X17 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X17-I(INT17-)<\/p>\n<\/td>\n<td>\n<p>X17 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X18+I(INT18+)<\/p>\n<\/td>\n<td>\n<p>X18 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X18-I(INT18-)<\/p>\n<\/td>\n<td>\n<p>X18 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X19+I(INT19+)<\/p>\n<\/td>\n<td>\n<p>X19 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X19-I(INT19-)<\/p>\n<\/td>\n<td>\n<p>X19 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X20+I(INT20+)<\/p>\n<\/td>\n<td>\n<p>X20 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X20-I(INT20-)<\/p>\n<\/td>\n<td>\n<p>X20 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X21+I(INT21+)<\/p>\n<\/td>\n<td>\n<p>X21 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X21-I(INT21-)<\/p>\n<\/td>\n<td>\n<p>X21 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X22+I(INT22+)<\/p>\n<\/td>\n<td>\n<p>X22 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X22-I(INT22-)<\/p>\n<\/td>\n<td>\n<p>X22 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X23+I(INT23+)<\/p>\n<\/td>\n<td>\n<p>X23 Positive edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>X23-I(INT23-)<\/p>\n<\/td>\n<td>\n<p>X23 Negative edge triggered<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>5-4  How to use Interrupt Function?<\/h3>\n<p>Whether internal timing suspension, external input suspension or HSC\/HST interruption, a similar operating method will be used. Because a dedicated section is provided for describing the operation method of HSC\/HST, this section shall provide the example in order to explain internal timing suspension and external input suspension.<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td><\/td>\n<td>\n<p>Start<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\">\n<p>Set up the Interrupt value in Main Program Field: For example, set the STM0 cycle as R35435.<\/p>\n<\/td>\n<td>\n<p>\tFor special register, please refer to Appendix A,<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\">\n<p>In Main Program Field, trigger the Interrupt of special relay; for example, set STM0 as M9166.<\/p>\n<\/td>\n<td>\n<p>\tFor special register, please refer to Appendix A,<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\">\n<p>In sub-program field, write the service Interrupt program.<\/p>\n<\/td>\n<td>\n<p>\tplease refer to Section 5.6\t<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>End<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>         Figure 13 The configuration of time-setting interrupt<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td><\/td>\n<td>\n<p>Start<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\">\n<p>Set up the suspended configuration<\/p>\n<\/td>\n<td>\n<p>\t Please refer to Section 5.5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\">\n<p>In sub-program field, write the service <strong>suspension  <\/strong> program<\/p>\n<\/td>\n<td>\n<p>\t Please refer to Section 5.6\t<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p>End<\/p>\n<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td colspan=\"4\">\n<p>Figure 14 The configuration of external interrupt<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h3>5-5  Configuring the Interrupt Function<\/h3>\n<p>In fact, the interrupt configuration means the application regarding whether certain interrupt functions should be used or not.<\/p>\n<p>The interrupt configuration comprises the I\/O relevant configuration and the I\/O irrelevant configuration. When using the I\/O relevant HSC\/HST and external interrupt, activate the corresponding I\/O interrupt in the I\/O configuration of the UperLogic. After being configured, the system will trigger the Enable to suspend such device.<\/p>\n<p>As for the \u201cinternal timing interrupt\u201d irrelevant to I\/O, the system will regard it that such interrupt function is being planned when the interrupt-running sub-program is enabled by the \u201cTiming interrupt\u201d wording that will be displayed in the sub-program field. In this case, set the interrupt cycle with Special Register and then enable the interrupt function by triggering the corresponding Special Relay. The value required for setting up the interrupt of Special Register cannot be written after Special Relay is triggered. Therefore, it should be changed before triggering the relay.<\/p>\n<h4>5-5-1 Example of Interrupt Configuration                                       <\/h4>\n<p>In project window, click \u201cI\/O Configuration Setup\u201d<strong>:  <\/strong>Project Name <\/p>\n<p>                                   System configuration <\/p>\n<p>                                     I\/O configuration  \ud83e\udc6a Select \u201cinterrupt setup\u201d<\/p>\n<p>After displaying the \u201cInterrupt setup\u201d picture, you may click the external input that will be suspended in the window.<strong> <\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-002.jpg\" \/><\/p>\n<p>Figure 15 Interrupt Configuration<\/p>\n<h3>5-6  Type of Interrupt Function<\/h3>\n<h4>5-6-1 Hardware timing base                                                      <\/h4>\n<p>The hardware time base comprises 1ms STM, 10ms LTM, 0.1ms graduation of High-speed Timer HST and a 32-bit cycle timer. In addition to the cycle timer, other hardware timing bases support interrupts, and can be turned on or off by calling the EN (FUN145) and DIS (FUN146) commands (after setting its special relay, the default is on). Interrupts are used by triggering their corresponding special relays. According to the period value of the register corresponding to the timing base, the interrupt program is executed periodically; the current timing register is also provided as a program or monitoring. See Section 8.2 for details.<\/p>\n<p><strong>Time-setting Timer STM<\/strong><\/p>\n<p>Totaling 4 of 16-bit timer, time unit: 1ms.<\/p>\n<p><strong>Time-setting Timer LTM<\/strong><\/p>\n<p>Totaling 4 of 16-bit timer, time unit: 10ms.<\/p>\n<p><strong>High-speed Timer HST<\/strong><\/p>\n<p>Totaling 4 of 32-bit high-speed timer, time unit: 0.1ms.<\/p>\n<p><strong>Cycle Timer HSTA<\/strong><\/p>\n<p>Totaling 1 of 32-bit cycle timer, time unit: 0.1ms.<\/p>\n<h4>5-6-2 High-speed Counter HSC                                                  <\/h4>\n<p>M-Series PLC supports the Hardware High-Speed Counter (briefed as HHSC) configured by hardware circuit. Such HHSC can read the high-speed signal that cannot be achieved by conventional counters. In this regard, M-Series PLC provides 4~8 HHSCs depending on the series, and they are serving as 32-bit high-speed counters (HSC0\u2013HSC7). For details, please refer to Section 8.1.<\/p>\n<h4>5-6-3 External Interrupt                                                        <\/h4>\n<p>The external interrupt is mainly used in the application that needs to be executed or reflected within a very short period of time when receiving the external signal from the PLC. When compared to general input, the external interrupt may vary according to the program scanning time. The system can execute the content of externally imported interrupt within a very short period of time in order to achieve the control action such as stopping the motor immediately when the motor reaches the intended position.<\/p>\n<ul>\n<li>Once completing the interrupt configuration, it cannot be changed during the PLC RUN process. In spite of this, M-Series PLC provides EN command (FUN145) and DIS command (FUN146) to allow or prohibit the external interrupt and the HSC interrupt so as to control the change flexibly during the PLC RUN process. Please refer to the description of the aforesaid two commands.<\/li>\n<\/ul>\n<h3>5-7  Example of Interrupt Program<\/h3>\n<p>Regarding the content of interrupt, following suggestions are provided as a reference for users:<\/p>\n<ul>\n<li>The content of the suspended program should be short and concise in order to improve the PLC efficiency.<\/li>\n<li>The efficiency of the M PLC is very high. The user program of a general application usually takes only 1~single digit milliseconds to execute. Therefore, if the application can tolerate a few millisecond variations for a specific time interval difference, consider calling Timer in the main program. And in the main program &quot;time up&quot; event occurs in the way of re-calling the sub-program. In this way, the CPU can be switched due to the removal of interrupts, and the overall program performance can be improved.<\/li>\n<li>The Jump and Label commands can be used in the suspended program for jumping alternately in the suspended program. However, you cannot jump from Main Program or Sub-program to the suspended Label or jump from the suspended content to the Main Program or Sub-program Label. Indicated below is the concept diagram:<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"D:\\patrick\\\u8aaa\u660e\u66f8\u7ffb\u8b6f_\u529f\u80fd\u7bc7\\\u5716\\16.png\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-003.png\" \/><\/p>\n<p>Figure 16 Using JUMP in an interrupt program<\/p>\n<p>Example 1 <\/p>\n<p>Example of position precision control for desired contact by suspending \u201cX0+\u201d with external hardware:<\/p>\n<p>X0: Detects the position of sensor<\/p>\n<p>X1: Emergency stop<\/p>\n<p>Y0: Controlling motor<\/p>\n<p>\u3010External interrupt configuration\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>\u3010INT : X0+\u3011<\/p>\n<\/td>\n<td>\n<p>During the configuration, input X0 and then issue the interrupt signal when 0\u21921<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u3010Main Program\u3011<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-004.png\" \/><\/p>\n<p>M0 (Enable). When 0\u21921, the Controlling Motor is ON.<\/p>\n<p>\u3010Sub-program\u3011<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-005.png\" \/><\/p>\n<p>When Sensor X0 detects that the command reaches the detected position. i.e., when X0 becomes 0\u21921 and the hardware will execute such Interrupt Sub-program automatically.<\/p>\n<p>When the Controlling Motor changes from Y0 to 0, the system will stop the motor immediately.<\/p>\n<p>In the interrupt sub-program, you need to issue the Input\/Output command immediately in order to achieve the real-time high-speed precision control effect.<\/p>\n<p>Example 2   1ms internal timing interrupt<\/p>\n<p>\u3010Main Program\u3011<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-006.png\" \/><\/p>\n<p>When M0=1, set the interrupt cycle of STM0 as 1ms. After R35435=1 and M1=1, the STM0 will execute timing interrupt once every 1ms.<\/p>\n<p>\u3010Sub-program\u3011<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/mplc-m03-en-05\/mplc-m03-en-05-007.png\" \/><\/p>\n<p>After enabling 1ms timing suspension, the system will run such suspension sub-program every 1ms automatically.<\/p>\n<p>R0 serves as the up-cycle timer of 1ms time base.<\/p>\n<p>R1 serves as the down-cycle timer of 1ms time base.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>5-1 The Principle and the Structure of Interrupt Functi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-3212","post","type-post","status-publish","format-standard","hentry","category-en-mplc-m03"],"_links":{"self":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/comments?post=3212"}],"version-history":[{"count":0,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3212\/revisions"}],"wp:attachment":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/media?parent=3212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/categories?post=3212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/tags?post=3212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}