Chapter 5 Applied Instructions Explanation devices and Z devices) If the conditional contact connected to CJN is ON, the next address will be executed. If the conditional contact connected to CJN is not ON, the address to which S points will be executed. If some part of the main program O100 does not need to be executed, users can use CJN or CJNP to shorten the scan time. Besides, if a dual output is used, users can use CJ or CJP. If the program specified by a pointer is prior to the instruction CJN, a watchdog timer error will occur, and the main program O100 will not be executed. Please use the instruction carefully. The instruction CJN can specify the same pointer repeatedly.
The pointer specified by CJN can not be the same as the pointer specified by CALL, otherwise an error will occur. When the instruction CJN/CJNP in a program is executed, the actions of the devices in the program are as follows. • The states of the Y devices, the states of the M devices, and the states of the S devices in the program remain the same as those before the execution of the jump. • The 10 millisecond timers in the program stop counting. • The general counters in the program stop counting, and the general applied instructions in the program are not executed.
• If the instructions which are used to reset the timers in the program are driven before the jump is executed, the timers will still be reset during the execution of the jump. S : Pointer (S is in the rage of P0~P255. A pointer does not support V Example When X0.0 is OFF, the execution of the program jumps from address 0 to address N (P1), and the addresses between address 0 and address N are skipped. When X0.0 is ON, the execution of the program starts from address 0, and the instruction CJN is not executed.
(Negated conditional jump) 0 N 5-123 API Instruction code Operand Function S Negated conditional 256 CJN P jump Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z S Pulse instruction 16-bit instruction (3 steps) 32-bit instruction – CJN P1 X0.1 Y0.1 P1 X0.2 Y0.2 CJN P1