Timer functionality
The #TIMER functionality is available for realtime cycles. The measured times are saved to the realtime variables V.RTG.TIMER[]. Realtime timers are different from decoder timers.
Programing Example

#TIMER functionality
; Output variables
$FOR P1 = 0, 4, 1
#MSG SAVE EXCLUSIVE ["V.RTG.TIMER[%d] = %f", P1, V.RTG.TIMER[P1]]
$ENDFOR
; Define realtime cycle
#RT CYCLE [ID = 17 SCOPE = PROG]
$IF ONCE 1 < 2
#TIMER START SYN [ID = 0] ; Start Timer 0
#TIMER START SYN [ID = 2] ; Start Timer 2
$ENDIF
#RT CYCLE END
#FLUSH WAIT
; please wait
#TIME 1.5
; Define realtime cycle
#RT CYCLE [ID = 18 SCOPE = PROG]
$IF ONCE 1 < 2
#TIMER STOP SYN [ID = 0] ; Stop Timer 0
#TIMER READ SYN [ID = 0] ; Read Timer 0
#TIMER READ SYN [ID = 2] ; Read Timer 2 without stopping
$ENDIF
#RT CYCLE END
#FLUSH WAIT
; Output variables
$FOR P1 = 0, 4, 1
#MSG SAVE EXCLUSIVE ["V.RTG.TIMER[%d] = %f", P1, V.RTG.TIMER[P1]]
$ENDFOR
; End main program
M30
Attention

Only asynchronous #TIMER commands are permitted. All #TIMER commands in realtime cycles must be marked as synchronous by the keyword SYN.