Omron C40K Video Game Controller User Manual


 
39
4-3-7 Coding Multiple Right-hand Instructions
If there is more than one right-hand instruction executed with the same exe-
cution condition, they are coded consecutively following the last condition on
the instruction line. In the following example, the last instruction line contains
one more condition that corresponds to an AND.
0000 0003
0001
HR 002
0002
HR 000
HR
001
0106
0107
Address Instruction Operands
0000 LD 0000
0001 OR 0001
0002 OR 0002
0003 OR HR 000
0004 AND 0003
0005 OUT HR 001
0006 OUT 0107
0007 AND HR 002
0008 OUT 0106
4-3-8 Branching Instruction Lines
When an instruction line branches into two or more lines, it is sometimes
necessary to use either interlocks or TR bits to maintain the execution condi-
tion that existed at a branching point. This is because instruction lines are
executed across to a terminal instruction on the right before returning to
branching points to execute instructions on the branch lines. If the execution
condition has changed during this time, the previous execution condition is
lost and proper execution will not be possible without some means of pre-
serving the previous condition. The following diagrams illustrate this. In both
diagrams, instruction 1 is executed before returning to the branching point
and moving on to the branch line leading to instruction 2.
Instruction 1
0002
0000
Instruction 2
Branching
point
Instruction 1
0002
0000
Instruction 2
Branching
point
Diagram B: Needs Correction
Diagram A: OK
0001
Address Instruction Operands
0000 LD 0000
0001 Instruction 1
0002 AND 0002
0003 Instruction 2
Address Instruction Operands
0000 LD 0000
0001 AND 0001
0002 Instruction 1
0003 AND 0002
0004 Instruction 2
If, as shown in diagram A, the execution condition that existed at the branch-
ing point is not changed before returning to the branch line (instructions at
the far right do not change the execution condition), then the branch line will
be executed correctly and no special programming measure is required.
If, as shown in diagram B, a condition exists between the branching point
and the last instruction on the top instruction line, the execution condition at
the branching point and the execution condition at the end of the top line will
sometimes be different, making it impossible to ensure correct execution of
the branch line. The system remembers only the current execution condition
(i.e., the logical sum for an entire line) and does not remember partial logical
sums at points within a line.
The Ladder Diagram Section 4-3