UD70
Issue code: 70nu2
DPL programming 4-11
Important Note
Be careful not to allow a user sub-routine to be started by
two different real-time tasks (a situation termed
re-entry).
For example, a sub-routine is able to be started by a
BACKGROUND task as well as a CLOCK task. If the BACKGROUND
task starts the sub-routine, and the CLOCK task interrupts
the BACKGROUND task while the sub-routine is being
executed, the values of the variable being processed could
become altered. This can occur because the CLOCK task will
also run the sub-routine, but will apply its own values.
CLOCK task
The CLOCK task is used for time-related monitoring of the Drive, and
commands to the Drive (eg. controlled acceleration or deceleration ramp).
The task has the second lowest priority. Only the
BACKGROUND task gives
way to the CLOCK task.
The task is executed on a constant timebase; the actual timebase used
depends on the value of the set-up parameter on the Drive (see also UD70
set-up parameters in Chapter 10 Parameters), which can range from 5ms to
200ms.
Example
This example produces a sine-wave.
CLOCK{
#1.21 = SIN (rad)*1000
rad =rad+0.01
IF rad > 6.283185 THEN ; 6.283185 = 2 * pi
rad = 0
ENDIF
}