0 BEGIN PGM 82251_EN MM 1 ;NC program to increase the counter, read out 2 ;the current time and to compare it with the 3 ;time you have defined in program 8220_en.h. 4 ;If the time defined by you has been reached 5 ;exceeded, the control automatically resets 6 ;the counter to zero. 7 ; 8 ;Increase the value in the counter by one QR1 = QR1 + 1 9 ; 10 ;Read out the current time and save it in QS1 QS1 = SYSSTR( ID321 NR13 ) 11 ; 12 ;Separate the hours from QS1 and save them in QS20 QS20 = SUBSTR( SRC_QS1 BEG0 LEN2 ) 13 ; 14 ;Separate the minutes from QS1 and save them in QS21 QS21 = SUBSTR( SRC_QS1 BEG3 LEN2 ) 15 ; 16 ;Convert string in QS20 to number and save it in QL20 (hours) QL20 = TONUMB( SRC_QS20 ) 17 ; 18 ;Convert string in QS21 to number and save it in QL21 (minutes) QL21 = TONUMB( SRC_QS21 ) 19 ; 20 ;Check whether hours for reset have been reached 21 FN 11: IF +QL20 GT +QR10 GOTO LBL "RESET" 22 FN 12: IF +QL20 LT +QR10 GOTO LBL "NOT_RESET" 23 ; 24 ;Check whether minutes for reset have been reached 25 FN 12: IF +QL21 LT +QR11 GOTO LBL "NOT_RESET" 26 ; 27 LBL "RESET" 28 ;Reset counter QR1 = 0 29 ; 30 STOP 31 LBL "NOT_RESET" 32 END PGM 82251_EN MM