0 BEGIN PGM 8125-en MM 1 ;Workpiece counter 2 ;In this program, the number of 3 ;machined workpieces is saved in 4 ;a table in order to save the 5 ;values beyond shutdown of the 6 ;control. 7 ;At program start, the value 1 8 ;has to be entered in row 0 and 9 ;column Q1 of the table. 10 ;At the beginning of the program, 11 ;enter the number of required 12 ;repetitions. When the program is 13 ;started, the number of runs so 14 ;far is displayed on the screen. 15 ;When the number of programmed 16 ;repetitions is reached, this is 17 ;also displayed on the screen and 18 ;subsequently the value in the 19 ;table is reset to one. 20 ;Entry of desired repetitions 21 Q10 = 8 ;NUMBER OF REPETITIONS 22 ; 23 ;Open the table 24 FN 26: TABOPEN TNC:\Database\81251-en.tab 25 ;Read out the current value from the table 26 FN 28: TABREAD Q1 =0 /"Q1" 27 ; 28 FN 0: Q2 =+Q1 ;Copy value 29 Q5 = Q1 - 1 ;Calculate the number so far 30 ; 31 ;Display the number of repetitions so far 32 FN 16: F-PRINT TNC:\Database\81252-en.a / Screen: 33 ; 34 Q1 = Q1 + 1 ;Increment the counter 35 ; 36 ; 37 ;Perform the required machining operation. 38 ;Possible with PGM CALL; the called 39 ;program cannot contain M2 or M30 40 ;in this case 41 CALL PGM TNC:\Database\81254-en.h 42 STOP 43 ; 44 ; 45 ;Compare whether the number of repetitions 46 ;has been reached 47 FN 12: IF +Q2 LT +Q10 GOTO LBL 99 48 ;Display that the number of repetitions 49 ;has been reached. 50 FN 16: F-PRINT TNC:\Database\81253-en.a / Screen: 51 ; 52 Q1 = 1 ;Reset counter 53 ;Write the value of the counter 54 ;into the table 55 FN 27: TABWRITE 0 /"Q1" = Q1 56 ;End of program 57 STOP 58 M30 59 ; 60 ;Jump label in case further 61 ;repetitions are necessary 62 LBL 99 63 ;Write the value of the counter into the table 64 FN 27: TABWRITE 0 /"Q1" = Q1 65 ;End of program 66 M30 67 END PGM 8125-en MM