End Main Routine Program Conditionally
End Main Routine Program Conditionally: CEND, CENDP
Instruction | Device address | No. of Steps | Flag | ||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. | Error | Zero | Carry | ||
CEND (P) | - | - | - | - | - | - | - | - | - | - | - | - | - | 1 | - | - | - |
Functions
If the command execution condition is turned ON, the CEND(P) instruction will end the main routine program.
The difference with END instruction is that CEND (P) must have a condition to get activated.
At the end of the Main Routine Program must be an END instruction.
Example)
When the input condition for CEND (M05) is turned ON, a main routine program will end.
Notice how Y31 is OFF due to the CEND instruction, which has ended the main routine program, even though M11 is turned ON.
When the input condition for CEND (M05) is turned OFF, it will jump and will not execute CEND instruction. Now that the main routine program is not ended, Y31 gets turned ON.