Project 06/2005
Danaher
Motion
50 Rev
E
M-SS-005-03l
A task-variable definition section
The task-variable definition section, where all task variables are declared
with the Dim…Shared command.
The main program
Most programming is done in the main programming section. The main
programming section falls between the Program…End Program keywords.
The main program itself has three sub-sections:
The Start-up section
The start-up section immediately follows the Program keyword. This is
where task execution begins when you start a task.
OnError section
The OnError section responds to errors generated by the task, allowing
your program to automatically respond to error conditions and (where
possible), gracefully recover and restart the machine. There is (at most)
one OnError
section for each task and it is normally written just before
the OnEvent section.
OnEvent section
This section contains optional blocks of code that respond to realtime
changes, such as a motor position changing or an input switch turning
on. The main program can contain code to automatically respond to
events. This reduces the effort required to make tasks respond quickly
and easily to realtime events.
Event handlers begin with the OnEvent and end with End OnEvent
keywords. One OnEvent…End OnEven keyword combination is
required for each realtime event. Event handlers must be contained
wholly within the main program.