<< Prev        Next >>

Timer

This part automatically triggers action source code for the TIMER event at the interval specified by the property interval.

Timer Example

1

Load the editor and place a timer anywhere on the panel layout in the Layout window. Note, however, that the final result will not appear on the teach pendant screen.

2 Changing Timer Properties

The main properties here are active, which controls (and indicates) timer status, and interval, which controls event frequency.

This example uses buttons to enable and disable a timer which alternately switches a pilot lamp on and off.

Load the editor and place a timer, two buttons, and a pilot lamp on the panel layout in the Layout window.

3 Adding Action Source Code

Open the Source Code Edit window, select Timer1 and TIMER, create the action source code skeleton, and add the following line to switch the lamp ON and OFF.

If PL1.state = 1 then

PL1.state = 0

Else

PL1.state = 1

End if

Add the following lines so that the CLICKED events for PB1 ("Start") and PB2 ("Stop") respectively enable and disable the timer.

Timer1.active = 1

Timer1.active = 0

 

<< Prev        Next >>