[PROYECTO] CPU=CP123 ROM=220 ID=1 TipoArchivoProyecto=1 BudCom2=9600 BudCom3=9600 BudCom4=9600 DEMCOM1=10 DEMCOM2=10 DEMCOM3=10 DEMCOM4=10 ParCOM2=n ParCOM3=n ParCOM4=n StpCOM2=1 StpCOM3=1 StpCOM4=1 SUBs=3 MstEspCOM1=0 MstEspCOM2=0 MstEspCOM3=0 MstEspCOM4=0 PassProg= SubInt1=0 SubInt2=0 SubInt3=0 IntI0=0 IntIN0= IntI1=0 IntIN1= IntI2=0 IntIN2= IntI3=0 IntIN3= IntI4=0 IntIN4= IntI5=0 IntIN5= IntI6=0 IntIN6= IntI7=0 IntIN7= IntEC0=0 IntEN0= IntEV0= IntEC1=0 IntEN1= IntEV1= IntEC2=0 IntEN2= IntEV2= IntEC3=0 IntEN3= IntEV3= IntEN4= [EQU] Variable1 = v0¨int¨ Variable2 = v1¨int¨ variable3 = v2¨int¨ Salida0 = q0.0¨bool¨ Salida1 = q0.1¨bool¨ Salida2 = q0.2¨bool¨ [MENU] 0 0 [BMK] [Principal] ; Main program ; Example of subroutine calls. It's 3 plus the main program. This one the 1 ° in ; Run and always do. Sub_1 and sub_2 are executed from the main program, and ; Sub_3 is executed from sub_2. ; 1° called a subroutine, when the variable1 has a value of 2. This is deleted (value 0) in the ; subroutine preventing it from running permanently LD Variable1 ;Read Variable1 EQ 2 ;Compare read with value 2 CALC sub_1 ;If you gave the same, then jump to run the subroutine ' sub_1 ' ; 2° subroutine call: Runs permanently CAL sub_2 ; 3° subroutine Call: Runs permanently and goes directly to Sub_2_NET_3 (3rd line), ; Skipping sub_2_Net_1 and Sub_2_net_2 CAL sub_2_NET_3 ; Note that each line (or network) of the ladder has a name, but the first one adopts the subroutine. [EXPS] [EXP_P] [EXP_S] [SUBS] [sub_1] {#NET:0} {NAME:sub_1_Net_1} {DESC:Clears the variable that was used to call this subroutine} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000085{1;0;Variable1;:1:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1001{7;0;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000032{9;0;0;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : } {#NET:1} {NAME:sub_1_NET_2} {DESC:Activates output 1 as a signal that the subroutine has been run} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000085{1;0;Salida0;;;;;;;:1:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1001{7;0;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000032{9;0;1;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : } [sub_2] {#NET:0} {NAME:sub_2_Net_1} {DESC:Reverses the state of 1 every second} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000085{1;0;Salida1;:1:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1001{7;0;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000032{9;0;Osc1Hz;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : } {#NET:1} {NAME:sub_2_NET_2} {DESC:Runs subroutine sub_3 every 0.33 Hz} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000009{1;0;sub_3;:0:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1000067{7;0;???;;;;;;;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000032{9;0;Osc0.33Hz;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : } {#NET:2} {NAME:sub_2_NET_3} {DESC:This doesn't do anything!} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000085{1;0;Null;:1:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1001{7;0;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000032{9;0;0;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : } [sub_3] {#NET:0} {NAME:sub_3_Net_1} {DESC:Reverse the state of the SALIDA2} {WITH:11} {HEIG:1} 1006{0;0;;:-1:: : : : } 1000085{1;0;Salida2;:1:: : : : } 1000{2;0;;:-1:: : : : } 1001{3;0;:0:: : : : } 1000{4;0;;:-1:: : : : } 1001{5;0;:0:: : : : } 1000{6;0;;:-1:: : : : } 1001{7;0;:0:: : : : } 1000{8;0;;:-1:: : : : } 1000034{9;0;Salida2;;;;;;;:1:: : : : } 1004{10;0;;:-1:: : : : }