GX Works3 MC/MCR instruction

GX Works3 MC/MCR instruction

The article describes the impact of the MC/MCR parameter (master control instruction) in the function block on the output signals and compares the influence of this parameter depending on the selected language (FBD/ST).

FB Type

Using FB as a Macro Type, it is possible to use MC/MCR to control EN. The tests presented below were performed for 2 FB (1 - Use MC/MCR to control EN; YES and 2 - Use MC/MCR to control EN; NO) implemented as FBD/LD, as well as for the next 2 FBs implemented in ST language.

The program of a macro type function block is loaded by a calling source program along the execution flow. At the time of program execution, the loaded program is executed in the same way as the main program.



MC/MCR Instruction


The tables show the impact of the MC parameter on the signal outputs. All signals are presented in the order they were activated, following the direction of the arrow.

Briefly, for an FB implemented in FBD with MC/MCR - ON, the activation of the M100 output is only possible when both the M1 contact and the block input are in a high state. If either M1 or M10 is in a low state, the M100 output will also be in a low state.

When this function is disabled (MC/MCR - OFF), the M200 output will be high when the block input (M20) and the M2 contact are both on. Once the block is on, switching the M2 contact will change the state of the M200 output. However, if M20 is turned off after M200 is activated, the M200 output will turn off the next time the M2 contact is off, and we turn on the block input at bit M20.


Importantly, there is no difference in the result of the output signals when the FB is written in the ST language. This is because the compiler converts the bit-setting instruction into a MOV instruction.