Jump to content

Mitsubishi iQ-F and SFC Programming


Bryon Sol

3,363 views

As yet another example of the amazing flexibility and power that Mitsubishi’s iQ-F Controller, Mitsubishi has now added Sequential Function Chart programming to the FX5U and FX5UC compact, cost effective PLCs.
If you have been a PLC programmer for a long time you have probably programmed in ladder logic, and most likely Function Block Diagram languages (FBD) which has also been called Structured Ladder programming.  You might have even used Structured text (ST) programming.  But have you ever tried SFC? If you have a project where the machine acts very sequentially, SFC can’t be beat for making troubleshooting the sequence easier and faster.  

Let’s explore all of the available languages in the FX5U and FX5UC PLCs.

The first is Ladder programming and it is the classic language for PLC programming which comes from classic relay logic.  Ladder Logic is very easy to read for standard input and output logic if all you need are inputs, outputs, timers and counters.  Once you go beyond simple logic, Ladder programming can start to look and feel kind of clunky.  As you can see below, once we start trying to add Function Blocks into ladder, the classic clean look and feel starts to get broken up. The simple Set/Reset block really feels out of place.


 Ladder.jpg.3bf5410e4a2fac4f0f749c1e635bde70.jpg

That’s where Function Block Diagram (FBD) programming starts to show it’s power.  It is much cleaner and easier to read when we start using larger function blocks.  It also lends itself well to Object Oriented Programming techniques.

FBD.jpg.85d45ebb5826f13081a8051606c2a413.jpg
 

We also have Structured Text programming available to us.  For those who have done extensive PC programming, a text based language may feel much more comfortable, but for PLC programmers there are still significant advantages to this language.  For performing complex math or string manipulation, Structured Text (ST) language makes for a very clean, compact, easy to read language.

ST.jpg.7808a5661b2903a2e6d90127ef0d1bee.jpg
 
So with having 3 languages already, why would we need or want a fourth?  First, let’s examine what SFC programming is.  The name gives it away: Sequential Function Chart.  SFC is represented as a flow chart format with Blocks, Actions, and Decisions (transitions).  

An SFC program starts at an initial step, executes the next step every time the relevant transition becomes TRUE, and ends a series of operations at an end step. 

 SFC1.jpg.d3c9f3294b331debd55735148d5519a8.jpg

 

1. When starting a block, the initial step (1) is activated first and then the action (2) is executed. After execution of the action (2), the program checks whether the next transition (3) has become TRUE. 
2. The program executes only the action (2) until the transition (3) becomes TRUE. When the transition (3) becomes TRUE, the program ends the action (2), deactivates the initial step (1), and activates the next normal step (4). 
3. After execution of the action of the normal step (4), the program checks whether the next transition has become TRUE. If the next transition does not become TRUE, the program repeats the execution of the action of the normal step (4). 
4. When the transition becomes TRUE, the program ends the action, deactivates the step (4), and activates the next step (5). 
5. Every time the transition becomes TRUE, the program activates the next step and ends the block when it finally activates the end step (6).

So where would I use SFC and why?  If you’ve ever written ladder and used STL (Step Ladder) instructions or if you’ve ever written your own State Machine logic, then you’ve basically written SFC programs without knowing it.  However, SFC has some advantages over STL and State Machine Logic in plain ladder.


With SFC, only the ACTIVE block is scanned.  This means that the CPU can scan much faster and is much more efficient.  Not only is your scan time reduced (often by very significant amounts), when monitoring SFC, you can see which step or steps are active very quickly and easily and jump right to a very small section of code to see what is going on.

In previous generations of PLCs, the logic inside SFC had to be written in Ladder programming.  Now with the iQ-R and iQ-F PLCs, the code resides in an Action.  Each Step can have up to 4 Actions tied to it, and each Action can be written in any of the standard three languages. 


 SFC2.png.2c591e4047e4348eb7a412c24865b07b.png

 

With the latest release of GX Works3 Programming software (Version 1.070Y) we now have SFC available to us on the FX5U and FX5UC series PLCs.  If you have a PLC with serial number 1.7X or later, you can update the firmware to version 1.220 and take advantage of this powerful language.

I hope this brief introduction into SFC has piqued your interest.  Now go write some code!

3 Comments


Recommended Comments

This is great new Bryon. We know so many customers that leverage SFC for more efficient programming. Having SFC available on the full range of FX5U PLCs is a powerful combination!

Link to comment
24 minutes ago, Joe Nolan said:

This is great new Bryon. We know so many customers that leverage SFC for more efficient programming. Having SFC available on the full range of FX5U PLCs is a powerful combination!

One thing to be aware of is that the FX5UJ series does not allow SFC.  The FX5U and FX5UC PLCs do, but the FX5UJ does not.

Link to comment

Bryon - Your post on SFC programming is very concise and clear. Nicely done! I will be recommending this post to anyone programming on a new FX5U or FX5UC.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...