5 Understanding Programming
5-30
CJ2 CPU Unit Software User’s Manual
Task design is important to build a system with a high degree of reliability and easy maintenance. Pay
attention to the following points.
• Divide programming into tasks based on the following.
• Consider specific conditions for execution and non-execution with an understanding of status tran-
sitions.
• Consider the presence or absence of external I/O.
• Consider functions and personnel in charge.
• Consider execution in order of priority. Separate processing into cyclic and interrupt tasks. Assign
the lowest number to the task with the highest priority.
Example 1: Designing Tasks by Function and Personnel in Charge.
Example 2: Designing Tasks by Execution Priority
Allocate lower numbers to control tasks than to processing tasks.
• Break down and design programs to ensure autonomy. Keep the amount of data exchanged between
tasks to an absolute minimum.
Organize the I/O memory used by all tasks and the I/O memory used only in individual tasks. Orga-
nize and allocate a range of I/O memory for use only by each task.
5-2-4 Designing Tasks
Guidelines
Break down
by function
Break down
by process
Main processing
Initial processing
Communications
MMI
Error processing
Materials supply
Machining
Assembly
Inspection
Conveying
Break down by
personnel in charge
Person A
Person D
Person C
Person B part 2
Person B part 1
Break down by execution and non-execution conditions
External inputs
Order of priority
Input
process-
ing
Overall
control
(may
include
error
processing
in some
cases)
Break down by function
Interrupts
Error processing
Sequence control
Analog control
Man-machine interfacing
Output
processing
External outputs