Time measurement (#TIMER)
The NC command #TIMER offers the option of time measurement in the NC program. The time recorded is represented in the unit milliseconds (ms).
Attention
Time counters are provided cross-channel (global). For example, this permits the measurement of signal propagation times between channels.
For parallel independent time measurements in different channels, make sure that different counter numbers (IDs) are used. Otherwise, the measurements will influence each other.
Syntax: |
#TIMER <action> [<mode>] [ID=..] |
<action> | Determines the action with the designated counter (ID). START: Starts the designated counter (ID). STOP: Stops the designated counter (ID). READ: Reads out the designated counter (ID). The timer count is latched and saved to the assigned V.G.TIMER[ID] variable in milliseconds (ms). CLEAR: Resets and stops the counter (ID). The assigned V.G.TIMER variable is not deleted but is retained until the next READ action of the related counter. |
Attention
The timer function records a maximum of 1193 hours.
<mode> | Synchronisation mode: ---: Time measurement asynchronous relative to the interpolator at decoding level (initial state). Time measurement starts directly after decoding. SYN: Time measurement at interpolator level. The designated counter is set synchronous to the machining operations of the NC machine. The synchronous read function (<SYN>) in the interpolator interrupts decoding until the timer count at decoder level is adopted in the timer variable. |
Notice
In order to measure program run-times, timers must always use the keyword SYN.
ID=.. | Counter number: 0...127: A maximum of 128 channel global counters can be programmed. However, only one counter (ID) can be programmed per timer command. |
Programing Example
Time measurement
:
#FILE NAME[ MSG="C:\timer.txt" ] Filename for time logging
:
#TIMER START [ID=10] Start timer 10 (decoder level)
#TIMER START SYN[ID11] Start timer 11 (interpolator level)
:
:
#TIMER READ [ID10] Save timer count in V.G.TIMER[10]
#TIMER READ SYN [ID11] Save timer count in V.G.TIMER[11]
#MSG SAVE["T10 = %d",V.G.TIMER[10]] Log timer count to file
#MSG SAVE["T11 = %d",V.G.TIMER[11]] Log timer count to file
#TIMER STOP [ID10] Stop timer 10
#TIMER CLEAR [ID10] Reset timer 10
:
:
#TIMER READ SYN [ID11] Save timer count in V.G.TIMER[11]
#MSG SAVE["T11 = %d",V.G.TIMER[11]] Log timer count to file
:
:
#TIMER READ SYN [ID11] Save timer count in V.G.TIMER[11]
#MSG SAVE["T11 = %d",V.G.TIMER[11]] Log timer count to file
:
:
#TIMER READ SYN [ID11] Save timer count in V.G.TIMER[11]
#MSG SAVE["T11 = %d",V.G.TIMER[11]] Log timer count to file
#TIMER STOP SYN [ID11] Stop timer 11
#TIMER CLEAR SYN [ID11] Reset timer 11
:
:
:
#TIMER START [ID=10, ID11] Error, only one counter per timer
command permissible!
:
: