Kaiyi — 5.2 Basic Instructions

Chapter 5 Basic Instructions Explanation: 1. The instruction MPS is used to store the data in the accumulative register in the stack (the value of the stack pointer increases by one). 2. The instruction MRD is used to read the data from the stack and store it in the accumulative register (the value of the stack pointer remains the same). 3. The instruction MPP is used to pop the previous logical operation result from the stack, and store it in the accumulative register (the value of the stack pointer decreases by one). Example: 1. Contact A of X0 is loaded, and the data in the accumulative register is stored in the stack. 2.

Contact A of X1 is connected in series, the coil Y1 is driven, and the data is read from the stack (the value of the stack pointer remains the same). 3. Contact A of X2 is connected in series, the coil M0 is driven, and the previous logical operation result is popped from the stack. Instruction: Operation: LD X0 Contact A of X0 is loaded. MPS The data in the accumulative register is stored in the stack. AND X1 Contact A of X1 is connected in series. OUT Y1 The coil Y1 is driven. MRD The data is read from the stack. AND X2 Contact A of X2 is connected in series. OUT M0 The coil M0 is driven. MPP The previous logical operation result is popped from the stack. OUT Y2 The coil Y2 is driven.

END The program ends. Note: 1. The number of MPS instructions must be equal to that of MPP instructions. 2. The instruction MPS can be used at most 31 times. 5-7 Instruction code Operand Function MPS/MRD/MPP - Storing the data in the stack/Reading the data from the stack/Popping the data from the stack