10.06.2019

Function Block in PLC

As kind of a newbie in plc programing, though I have some experience in PC based automation control, it’s still many thing I learned from plc programming.

I’ll write some articles to record what I’ve learned from plc.

What’s the purpose when using function block ?

Basically, it’s all because we’re lazy, we don’t want to write those similar piece of code again and again.
Or we can say that it is for modularization, componentization, because of the increasingly complex needs.

Example of simple function block

In here, I’ll describe some very simple function block with mitsubishi Fx series plc.

The control of pneumatic cylinder

Pneumatic cylinder acting
Picture from wikipedia.

Originally, to control a pneumatic cylinder, depends on it’s type, we need a control flag, one or more outputs, some timers to make sure it’s state, some parameters to indicate the time, like this:
PLC control pneumatic cylinder

Thankfully we got function block, we can encapsulate the boring part inside the box.

Usage

With Gx Works2:
Gx Works2 FB

With Gx Works3 FBD:
Gx Works3 FB

With ST language:

The control of vibratory bowl feeder

Bowl Feeder
In the simplest situation to feed individual component parts for assembly on industrial production line, it going to combine bowl feeder with linear feeder.
Basically it’ll have a sensor to indicate if the output of bowl feeder is full or not, a sensor to indicate the output of linear feeder, if it’s on, the next station can pick workpiece from here.

I prefer to write with ST language, the additional benefits of it is we can go further for the creation process, like use some template to auto generate those codes, then we just need to focus on the control flow!

Written with StackEdit.