UD70
Issue code: 70nu2
4-10 DPL programming
Key to the diagram
BACKGROUND task giving way to the CLOCK task
1 The BACKGROUND task waits while the CLOCK task runs, and is then
interrupted at the next
CLOCK task.
2 The BACKGROUND task continues running until next interrupted by the
CLOCK task.
3 The BACKGROUND task ends.
BACKGROUND task giving way to the ENCODER and CLOCK tasks
4 ENCODER and CLOCK timing periods begin.
5 The CLOCK task runs until it is interrupted by the next ENCODER task.
The CLOCK task is completed when the ENCODER task has finished.
6 The CLOCK task ends, leaving time for the BACKGROUND task to run
until interrupted by the next
ENCODER task.
7 When the ENCODER task has finished the next CLOCK period has not
arrived. The BACKGROUND task runs until interrupted by the next
CLOCK task.
User-defined sub-routines
User-defined sub-routines are written by the user and are used in
conjunction with the CALL instruction (see CALL in Chapter 7 Reference).
User-defined sub-routines can be given any name and can be inserted
anywhere in a program. (Note that the task name is casecase-sensitive-sensitive.)
The following sub-routine has the same function as the SawtoothSawtooth program
given in Chapter 3 Getting Started. The name given to the sub-routine is
RAMP::.
BACKGROUND{
Loop:
CALL RAMP:
GOTO Loop:
}
RAMP: {
#1.21=0
DO WHILE #1.21<1000
#1.21=#1.21+1
LOOP
}