**PLC Subroutine Calling Method**
1. To enter a subroutine, use the CALL instruction, which is also known as FUN67. Within the subroutine, use the LBL instruction (FUN65) to define a label. Once the subroutine is complete, use the RTS instruction (FUN68) to return to the main program.
2. When using an interrupt mode, you need to assign the corresponding interrupt name with an "I" suffix for the subroutine tag. For example, if you're setting up a rising edge interrupt on X1, the interrupt number would be "X1+", and the interrupt tag would be "X1I". In the subroutine, use the LBL instruction (FUN65) to define the starting point as "LBL X1I". At the end of the interrupt routine, use the RTI instruction (FUN69) to return from the interrupt.
The CALL instruction is numbered FNC01. It accepts operands P0 through P127 and occupies 3 steps in the program. The SRET instruction (FNC02) is used to return from a subroutine and does not require any operands, taking up just 1 step.
As shown in Figure 1, when X0 is activated, the program jumps to label P10 to execute the subroutine. After executing the SRET instruction, the program returns to the next line after the CALL instruction.

**Figure 1: Subprogram Call and Return Instructions Usage**
**Important Notes When Using Subroutine Call and Return Instructions:**
1. The transfer label must be unique and cannot overlap with jump instruction labels.
2. Subroutines can be nested and called recursively, with a maximum nesting level of 5.
**Note:**
FEND is the main program end instruction, while END marks the end of the entire program. Subprograms and interrupt routines are executed after FEND, provided that they are called or triggered.
**PLC Subroutine Pause Function**
How does the PLC 200 pause the running program until the pause signal is removed, then continue execution?
There's a simple trick to achieve this functionality. You can write your program into a subroutine and add a pause condition when calling the main routine. If you want to pause, simply stop the call; to resume, restart it.
You can add an unused bit address at the beginning of the subroutine. You can force it to 1 or 0 using a computer. Alternatively, use a V address to maintain power-down status. If you don't want to use forced inputs, you can use an external input point like I5.2 to control the pause externally—similar to an emergency stop button.
Divide your program into several stages by using flags (M). For example, M0.0 to M0.7 can represent 8 different stages. These flags can be reset each time the PLC is powered on, allowing you to restore the previous state based on the flag’s status.
If you stop calling a subroutine, its contents will not interfere with the main program. The data inside the subroutine remains unchanged until the next call or until the PLC is restarted.
Protection For Telecommunication
Protection systems
Over voltage and over current protection components that satisfies all safety requirements of modern telecommunication systems. We offer single pair protection plug and protection magazine 10pair for your option.
What's more,we can also provide you the STB module(05 point,03point),3M Single Line Splitter and Bridging Module.Welcom to purchase from us.We will give you the best price.
STB Module, Protection Terminal Block, LSA Protection Plug, 3Pole Magazine For LSA Module, Ericsson Protector Magazine, Integrated Protector, Protection Magazine, Terminal Block, Terminal Block Connector
NINGBO YULIANG TELECOM MUNICATIONS EQUIPMENT CO.,LTD. , https://www.yltelecom.com