What is the FB block of Mitsubishi PLC?
Those who are familiar with Siemens PLC know that there are FBs in Siemens PLC. In fact, Mitsubishi PLC is similar to Siemens, which is the program called in the main program.
1. How to create an FB block and how to call
in the main program and click OK to create an FB block called motor.
From the above figure, we can see that the program body and local labels are both red, because we did not write the program and build the local labels.
first create a local label, double-click the local label, the interface as shown in the figure below appears.
Click the drop-down menu in the class:
VAR: internal temporary variable
VAR_CONSTANT: internal static variable,
VAR_INPUT: input interface variable
VAR_OUTPUT: output interface variable
VAR_IN_OUT is not the same as the output interface variable
VAR_IN_OUT of Siemens.
is an example to illustrate:
controls the start and stop of the motor:
first define a local label, as shown in the following figure
write FB program:
how to call in the main program?
In the above example, the local label is first defined in FB. In fact, ST language is not the most intuitive for logic, but it is used for calculation. For example, we can calculate the area of a triangle,
triangle area S=triangle side length A*triangle side Long B/2,
also first define the local label:
write FB program:
call FB in the main program:
simulation: