Download QCPU(Q Mode)/QnACPU Programming Manual(Common
Transcript
5 SEQUENCE INSTRUCTIONS MELSEC-Q/QnA QCPU PLC CPU Basic High Performance Process CPU QnA Q4AR 5.6 Termination Instructions 5.6.1 End main routine program (FEND) Set Data Internal Devices (System, User) Bit Usable Devices Special MELSECNET/10(H) Function Direct J \ Module Bit Word U \G File Register Word Index Register Zn Constant Other [Instruction Symbol] [Execution Condition] FEND FEND [Functions] (1) The FEND instruction is used in cases where the CJ instruction or other instructions are used to cause a branch in the sequence program operations, and in cases where the main routine program is to be split from a subroutine program or an interrupt program. (2) Execution of the FEND instruction will cause the CPU module to terminate the program it was executing. (3) Even sequence programs following the FEND instruction can be displayed in ladder display at a peripheral devices. (Peripheral devices continue to display ladders until encountering an END instruction.) 0 program CJ Operations when the CJ instruction is not executed P Main routine program FEND P CALL P Main routine Main routine Jump caused by the CJ instruction program Operation performed when P the CJ instruction was executed FEND Subroutine program I Main routine Interrupt program program FEND END END (a) When using the CJ instruction (b) When there is a subroutine or interrupt program [Operation Errors] (1) In the following cases an operation error occurs, the error flag (SM0) turns ON, and an error code is stored at SD0. • A FEND instruction is executed after the execution of a CALL, FCALL, ECALL, or EFCALL instruction, and before the execution of the RET instruction. (Error code: 4211) • A FEND instruction is executed after the execution of a FOR instruction, and before the execution of a NEXT instruction. (Error code: 4200) 5 - 46 5 - 46