Advanced Instructions II

Continuous control (PID Instruction)

 Continuous control of some variable can be achieved by comparing the actual value of the variable with the desired set value and then giving an output depending on the control law required. Many PLCs provide the PID calculation to determine the controller output as a standard routine. All that is then necessary is to pass the desired parameters, i.e. the values of Kp, Ki, and KD, and input/output locations to the routine via the PLC program.

 Control instructions are used to enable or disable a block of logic program or to move execution of a program from one place to another place.
 The control instructions include:
 Master Control instruction (MC/MCR)
 Jump to label instruction (JMP)
 Label instruction (LBL)
 Jump to Subroutine instruction (JSR)
 Subroutine instruction (SBR)
 Return from Subroutine instruction (RET)
 Shift Registers

Master Control/ Master Control Reset (MC/MCR)

 When large numbers of outputs have to be controlled, it is sometimes necessary for whole sections of program to be turned on or off when certain criteria are realized. This could be achieved by including a MCR instruction. A MCR instruction is an output instruction.

The master control instruction typically is used in pairs with a master control reset. Different formats are used by different manufacturers:
 MC/MCR (master control/master control reset),
 MCS/MCR (master control set/master control reset) or
 MCR (master control reset).

 The zone being controlled begins with a rung that has the first MC instruction, which status depends on its rung condition. This zone ends with a rung that has the second MCR instruction only.
 
 When the rung with the first MCR instruction is true, the first MCR instruction is high and the outputs of the rung in the controlled zone can be energized or denergized acording to their rung conditions. When the this rung is false, all the outputs in the zone are denrgized, regardless their rung conditions.

 Timers should not be used inside the MC/MCR block because some manufacturers will reset them to zero when the block is false whereas other manufacturers will have them retain the current time state. Counters typically retain their current counted value.

Jump Instructions

 The JUMP instructions allow to break the rung sequence and move tthe program execution from one
rung to another or to a subroutine. The Jump is a controlled output instruction.
 You can jump forward or backward.
 You can use multiple jump to the same label.
 Jumps within jumps are possible
 There are: 
    1. Jump to Label.  2.Jump to subroutine

RETURN / END

 A Return from Subroutine instruction marks the end of Subroutine instruction. When the rung condition of this instruction is true, it causes the PLC to resume execution in the calling program file at the rung following the Jump to Subroutine instruction in the calling program.

 When a Return from Subroutine instruction is not programmed in a subroutine file, the END instruction automatically causes the PLC to move execution back to the rung following the Jump to Subroutine instruction. A Jump to Subroutine instruction can be used either in a main application program or a subroutine program to call another subroutine program.

Shift Registers

 The shift register is a number of internal relays grouped together (normally 8, 16, or 32) which allow stored bits to be shifted from one relay to another. The grouping together of internal relays to form a shift register is done automatically by a PLC when the shift register function is selected. This is done by using the programming code against the internal relay number that is to be the first in the register array.

 Shift registers can be used where a sequence of operations is required or to keep track of particular items in a production system. The shift register is most commonly used in conveyor systems, labeling or bottling applications, etc.