DVP- ES2/ EX2/ SS2/ SA2/ SX2/ SE&TP O pe r a t i on Ma nua l - Pr ogr am m i ng3- 46API Mnemonic Function ControllersES2/EX2 SS2 SA2SE SX202 SRET Subroutine ReturnOP Descriptions Program StepsN/ANo contact to drive the instruction is requiredAutomatically returns program execution to the addressafter CALL instruction in O100.SRET: 1 stepPULSE 16-bit 32-bitES2/EX2 SS2 SA2SE SX2 ES2/EX2 SS2 SA2SE SX2 ES2/EX2 SS2 SA2SE SX2Explanations:SRET indicates the end of subroutine program. The subroutine will return to main program andbegin execution with the instruction after the CALL instruction.Program example 1:When X0 = ON, the CALL instruction will jump to P2 and run the subroutine. With the execution ofthe SRET instruction, it will jump back to address 24 and continue the execution.2024P2SubroutineSubroutine returnCall subroutine P2CALL P2X0X1SRETFENDY0M1Y1M2Y2Program example 2:1. When the rising-edge of X20 is triggered, CALL P10 instruction will transfer execution tosubroutine P10.2. When X21 is ON, execute CALL P11, jump to and run subroutine P11.3. When X22 is ON, execute CALL P12, jump to and run subroutine P12.4. When X23 is ON, execute CALL P13, jump to and run subroutine P13.5. When X24 is ON, execute CALL P14, jump to and run subroutine P14. When the SRETinstruction is reached, jump back to the last P subroutine to finish the remaining instructions.6. The execution of subroutines will go backwards to the subroutine of upper level until SRETinstruction in P10 subroutine is executed. After this program execution will return to the mainprogram.