0 BEGIN PGM 8175_EN MM 1 ;NC program from which a log file is 2 ;generated. 3 ;Because the log also documents the program 4 ;run time, the program begins with the 5 ;automatic export of the current system time 6 ;in seconds. Then the control writes the 7 ;content of a mask file in the log. In this 8 ;example, the log contains the current date, 9 ;the time at program start and the program 10 ;name including the path. The control uses 11 ;the syntax defined in the mask file to 12 ;automatically ascertain this information. 13 ;Machining would now start. In the example 14 ;this is simulated through a dwell time. 15 ;Before program end the control calls a 16 ;subprogram to calculate the program run time. 17 ;In this subprogram it first re-exports the 18 ;current system time in seconds. From this 19 ;time and the the time exported at program 20 ;start, the control calculates the time in 21 ;seconds elapsed during program run. Then 22 ;the control calculates converts this time 23 ;to hours, minutes and seconds. It uses a 24 ;further mask file to write the values found 25 ;in this way into the log. 26 ;You as user simply have to adapt the paths 27 ;of the mask files and the name of the log 28 ;file to be generated. 29 ; 30 ;IMPORTANT INFORMATION! If you start the 31 ;program repeatedly without deleting or 32 ;renaming the log file, the new enteries are 33 ;appended to the existing log. Program runs 34 ;in the Test Run mode are also logged. A 35 ;dwell time, however, is not taken into 36 ;account. 37 ; 38 ; 39 ;Program start 40 FN 18: SYSREAD Q10 = ID320 NR1 IDX0 ;Export current system time in seconds 41 ;Write mask 81751_en.a into the log 42 ;!Here you have to define the mask file path 43 ;and log name! 44 FN 16: F-PRINT 81751_en.a / Protocol_8175.txt 45 ; 46 ;Machining, here simulated with a dwell time 47 CYCL DEF 9.0 DWELL TIME 48 CYCL DEF 9.1 DWELL999 49 ; 50 ;Call subprogram for calculating the program 51 ;run time 52 CALL LBL 1 53 ;Write mask 81752_en.a with the calculated 54 ;program run time to the log. 55 ;!Here you have to define the mask file path 56 ;and the log name! 57 FN 16: F-PRINT 81752_en.a / Protocol_8175.txt 58 ; 59 ;Program end 60 M30 61 ; 62 ;Subprogram for calculating the program 63 ;run time 64 LBL 1 65 FN 18: SYSREAD Q11 = ID320 NR1 IDX0 ;Export current system time in seconds 66 FN 2: Q12 =+Q11 - +Q10 ;Subtract system time at start from the system time at end 67 Q13 = Q12 / 3600 ;Calculation of the hours 68 Q20 = INT Q13 ;Turncate decimal places of the hours 69 Q14 = Q20 * 3600 ;Convert hours into seconds 70 Q15 = Q12 - Q14 ;Calculation of the remaining seconds 71 Q16 = Q15 / 60 ;Calculation of the minutes 72 Q21 = INT Q16 ;Turncate decimal places of the minutes 73 Q17 = Q21 * 60 ;Convert minutes to seconds 74 Q22 = Q15 - Q17 ;Calculation of the remaining seconds 75 LBL 0 76 ; 77 END PGM 8175_EN MM