KUKA Robot Programming – Using Timer $TIMER[]

Item Description
Function A system variable used to measure time progress, typically in milliseconds (ms).
Quantity The KSS 8.3 system typically provides 32 (<span><span>$TIMER[1]</span></span><span><span>$TIMER[32]</span></span>), while the KSS 8.6 system usually provides 64 (<span><span>$TIMER[1]</span></span><span><span>$TIMER[64]</span></span>).
Start Timer <span><span>$TIMER_STOP[Number] = FALSE</span></span> This command starts the specified timer by stopping its closure.
Stop Timer <span><span>$TIMER_STOP[Number] = TRUE</span></span> This command stops the specified timer.
Reset Timer <span><span>$TIMER[Number] = 0</span></span> Resets the current value of the specified timer to 0.
Read Value Directly reads the value of <span><span>$TIMER[Number]</span></span>, in milliseconds.
Associated Flag <span><span>$TIMER_FLAG[Number]</span></span> is TRUE when the timer value is greater than 0, and FALSE when it is less than 0. This can be used to trigger conditions or interrupts.

🧭 Number of Timers in Different KSS Versions It is important to note that the number of available <span><span>$TIMER[]</span></span> may vary depending on the version of the KUKA Robot System Software (KSS):

  • For KSS 8.3 System: Typically provides 32 system variables<span><span>$TIMER[1]</span></span><span><span>$TIMER[32]</span></span>.

  • For KSS 8.6 System: Provides 64,<span><span>$TIMER[1]</span></span><span><span>$TIMER[64]</span></span>.

  • All these timers are measured in milliseconds (ms)..

🛠️ Basic Usage Example<span><span> The following example uses $TIMER[1] to implement a timer for 5 seconds:</span></span>

DEF test()  // Implement a timer for 5000 milliseconds (5 seconds)       INT TIMER  // Declare an integer variable TIMER to store the timing value        TIMER = -5000  // Initialize TIMER variable to -5000   $TIMER[1] = 0  // Reset the current value of timer 1 to zero$TIMER[1] = TIMER  // Assign the value of TIMER to timer 1$TIMER_STOP[1] = FALSE  // Start timer 1    WAIT FOR $TIMER_FLAG[1] == TRUE  // When TIMER[1] reaches 5 seconds, timer flag 1 will be set, satisfying the condition and proceeding  $TIMER_STOP[1] = TRUE  // Stop timer 1     $TIMER[1] = 0  // Reset the current value of timer 1 to zeroEND

KUKA Robot Programming - Using Timer $TIMER[]

🎛️ <span><span>$TIMER_FLAG[]</span></span> Usage<span><span>$TIMER_FLAG[Number]</span></span> is a flag variable associated with <span><span>$TIMER[Number]</span></span>.

  • When the timer value is greater than 0, <span><span>$TIMER_FLAG[Number]</span></span> is <span><span>TRUE</span></span>.

  • When the timer value is less than 0, <span><span>$TIMER_FLAG[Number]</span></span> is <span><span>FALSE</span></span>.

Usage Notes

  • Unit Consistency<span><span>$TIMER[]</span></span> values are in milliseconds (ms) not seconds (s), and whenever possible, convert to the same unit.

  • Timely Reset:Always reset the timer (set to 0) before starting to avoid logical confusion.

  • System Status:When the system starts, <span><span>$TIMER[]</span></span> variables are usually preset to 0, <span><span>$TIMER_STOP[]</span></span> variables are preset to <span><span>TRUE</span></span> (i.e., stopped), and <span><span>$TIMER_FLAG[]</span></span> is preset to <span><span>FALSE</span></span>.

  • Monitor Timer:

    Main Menu -> Display -> Variables -> Individual, enter <span><span>$TIMER[Number]</span></span> to view.

    Main Menu -> Display -> Variables -> Timers, enter $TIMER[Number] to view.

📊 Application Scenarios<span><span>$TIMER[]</span></span> has a wide range of applications in robot programming, such as:

  • Timeout Monitoring:Detecting whether an operation is completed within the expected time.

  • Delay Processing: WAIT SEC maximum wait time is 30 seconds, while the timer can last for 24 days.

  • Cycle Time Measurement:Measuring the time required for the robot to complete a full cycle, used for efficiency optimization.

  • Conditional Waiting:Implementing non-blocking delay waiting in the program, such as waiting for a signal to become true within a specific time.

Leave a Comment