Changes for page 01 Program execution
Last modified by Leo Wei on 2024/12/24 22:42
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -676,7 +676,7 @@ 676 676 677 677 == Subroutine == 678 678 679 -During the execution of the scan program, the executed program can be called by the CALL instruction. 679 +During the execution of the scan program, the executed program can be called by the CALL instruction. You can create up to 100 new subprograms. 680 680 681 681 A subroutine is to split a certain module in the main program for the main program to call, which is conducive to the modularization of the program. Such as other high-level language functions, but this function has no parameters and no return value. 682 682 ... ... @@ -683,7 +683,7 @@ 683 683 (% style="text-align:center" %) 684 684 [[image:1652250926997-587.png||class="img-thumbnail"]] 685 685 686 - 1.Instructions for calling subroutines686 +**Instructions for calling subroutines** 687 687 688 688 After a new subroutine is created, the content of the program is not executed. It is executed only when the CALL(P) instruction is used to call the subroutine in the scan, event, and interrupt programs, and the call is executed once. Three new subroutines SUB0, SUB1, SUB2 are created as shown in the figure below. In the main program MAIN, the subprogram can be called by using the CALL(P) subprogram program name. 689 689 ... ... @@ -692,12 +692,15 @@ 692 692 (% style="text-align:center" %) 693 693 [[image:1-28.png||class="img-thumbnail"]] 694 694 695 -**~ 1.✎Note:** 695 +(% class="box infomessage" %) 696 +((( 697 +**✎Note:** 696 696 697 697 1. When using the timer (OUT T), note that the output will not be reset when the subroutine is not called, and a specific subroutine register must be used. 698 698 1. It is not allowed to call recursively between subprograms, that is, call SUB1 in SUB0, and then call SUB0 in SUB1. This is not allowed. 699 699 1. The subroutine can be nested up to 32 levels. If the level exceeds 32 levels, a serious error will be reported and the Circuit program operation will be forcibly stopped. 700 700 1. Unlike the LX3V series mainframe, the subroutine in the LX5V series mainframe ends with the END instruction instead of SRET. 703 +))) 701 701 702 702 == Positioning instructions == 703 703