![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/c/de/cdec7def-b4a8-4ada-8bb2-177ce8d54e6c/cdec7def-b4a8-4ada-8bb2-177ce8d54e6c-bg47.png)
Danaher Motion 06/2005 Project
M-SS-005-03 Rev E 61
Events can either be controlled from within the task in which they reside, or
from the terminal. The main program or any subroutine can issue EventOn
(to enable the OnEvent command) or EventOff (to disable it). OnEvents
cannot be controlled from other tasks.
3.5.2. EventOn
EventOn enables OnEvent. The syntax of EventOn is:
EventOn [Event Name]
EventOn must come after the definition of the OnEvent.
3.5.3. EventOff
EventOff disables OnEvent. The syntax of EventOff is:
EventOff [Event Name]
Refer to the SERVOSTAR
MC Reference Manual for information additional
information about OnEvent, EventOn, and EventOff.
3.5.4. EventList
EventList provides a complete list of all events in all tasks with their name,
the task name, the priority, whether the event is armed, and current status.
EventList is valid only from the terminal window. For example:
? EventList
the result is something like the following line for each task:
Name = IOEvent Owner=Task1 Edge=1 Status=1 Scan=1 Priority=5
Action = Stop
where:
edge=1 indicates the event is armed (that is, the condition is false
so that the condition becoming true will fire the OnEvent)
status=1 means the event is enabled
3.5.5. EventDelete
Deletes the specified event. The event does not respond to the specified
condition until the task is executed again and the event is enabled.
EventDelete EVENT1
3.5.6. Events at Start-up
Events are normally triggered by the OnEvent condition changing from false
to true. So a single transition in the condition is required to run OnEvent.
One exception to this is start-up. At start-up, if the condition is true, OnEvent
executes once, even if there has not been a transition.
3.5.7. Program Flow and OnEvent
You can use GoTo commands within an OnEvent block of code. However,
because OnEvent interrupts the main program, you cannot use GoTo to
branch out of the event handler or into the event handler. You cannot place
OnEvent…End OnEvent in the middle of program flow commands (e.g.,
For…Next, If…Then, etc.). You cannot declare or use local variables inside
an OnEvent block.