You are on page 1of 13

STARDOM Technical Assistance

Overview of
IEC Programming

Ng Chye Wee
Yokogawa Engineering Asia Pte Ltd

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Contents

 FCN/FCJ Programing
 I/O Interface
 IEC Programming Language
 Software Architecture of FCN/FCJ
 Function and Function Block
 Elementary data types, Literals

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.2
Development/Maintenance Tool

Logic Designer
Logic Designer is a tool for creating/debugging control applications
that run on a FCN/FCJ.

Resource Configurator - all hardware configuration of the FCX is carried


out through the Resource Configurator. Resource configurator is a tool
for performing the basic settings.

Web browser for Maintenance Page – Viewing of Log file and some
system setting are carried out on the Maintenance page through
Internet Explore. Maintenance Page is used to perform the advanced
settings and operation.

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.3
I/O Interface
Logic Designer

Device label
variables

Resource Configurator Device labels

Each device label variable is connected to the


device label with the same name when the
control application is executed.

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.4
IEC Programming Language
IEC61131-3 Programming
 5 Programming language for each purpose. They are used in combination.

 IL (Instruction List ) : high speed, compact( EQ. Assembly Language)


 LD (Ladder Diagram) : Sequence program (EQ. Relay Circuit)
 FBD (Function Block Diagram) : Process Control (PID,PVI….) in FCN/FCJ
 ST (Structured Text) : Calculation, Handling String (EQ. High-level language)
 SFC (Sequential Function Chart) Step processing (EQ. Flow Chart)

LD
ST
M13
M23 LD FBD SFC
LD X0
NOT
ST IL_1
LD X1
NOT
AND IL_1

IL FLG := FALSE;
FOR I := 1 TO 100 DO
IF DATA[I] <> OLD_DATA[I] THEN
DIF_DATA[I] := DATA[I];
FLG := TRUE;

ST
END_IF;
END_FOR;
Sample Project (Zipped Project Files):
ASET_IECLANG.zwt
| Document Number | March 23, 2016 |
© Yokogawa Electric Corporation
Page.5
Software Architecture of FCN/FCJ
Configuration
Function
FCN/FCJ
Block
Function
Block
Resource

Function
Task Task
Function

Local Variables
Program Program
Logical POUs Program Multiple
FCJ/FCN
(Local) Variables
Sheet Global Variables

Resource

Task
Program Instance
POU is Program
Global Variables Organization Unit.
Sheet

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.6
Software Architecture of FCN/FCJ
Local Variable Logical POUs Program
– A local variable can only be used within a
logical POU (program, function block or (Local) Variables
Sheet
function) where it is defined.
Global Variable
– A global variable is accessible by all Resource

executing POUs within the same resource.


Task
Resource
– A resource means a program that is to be Program Instance
run on a single FCN or FCJ.
Global Variables
Sheet
 Task
 A task is a unit for scheduling execution of control applications.
 Logical POU
 Logic POUs are functional components composing a control application. There are three
types of logical POUs:
 Program, Function block, Function
 Program
 A program POU is a logical POU located at the top position in the hierarchical
composition of logical POUs.
| Document Number | March 23, 2016 |
© Yokogawa Electric Corporation
Page.7
Function and Function Block
Function and Function Block are the language elements to return the result according
to the input value.
 Function
 Functions are POUs with multiple input parameters and exactly one output parameter.
 Calling a function with the same values returns always the same result because it doesn’t have
internal memory.
 Function Block
 Function blocks are POUs with multiple input/output parameters and internal memory. The value a
function block returns, depends on the value of its internal memory. The abbreviation for function
blocks is FB.

Function Function Block


EN・・・Enable/Disable Internal Memory.
(Default is True) Instance name is
ENO・・・Enable Output needed.

Output Parameters
Output Parameters
Input Input
Parameters Parameters
Icon Icon

For more details, see online help, [Help on standard FB/FU]


| Document Number | March 23, 2016 |
© Yokogawa Electric Corporation
Page.8
Function and Function Block
 A lot of functions and function blocks are provided with Logic
Designer.

For more details, see online-help


| Document Number | March 23, 2016 |
© Yokogawa Electric Corporation
Page.9
Elementary data types

Data type Description


BOOL Boolean
SINT Short integer
INT Integer
DINT Double integer
USINT Unsigned short integer
UINT Unsigned integer
UDINT Unsigned double integer
REAL Real numbers
LREAL Long real numbers
TIME Duration
BYTE Bit string of length 8
WORD Bit string of length 16
DWORD Bit string of length 32
STRING Character string

For more details, see online help,


[IEC 61131 basics] - [Data types in IEC 611310-3] – [Elementary data types]

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.10
Literals in IEC 61131-3
Numeric literals Character string literals
Type Examples Type Examples
Integer literals -12 0 123_456 +986 Empty string ''
-12.0 0.0 0.4560 String with a blank ''
Real literals
3.14159_26 Not empty string 'this is a text'
-1.34E-12 -1.34e-12
Real literals with exponent
1.0E+6
Long Real literals LREAL#-12.0
Long Real literals with
exponent
LREAL#2.3E-89 Duration literals
Base 2 literals INT#2#1111_1111 Type Examples
Base 8 literals INT#8#377 T#14ms t#14ms t#12m18s3.5ms
16#FF Short prefix
T#25h_15m t#25h_15m
Base 16 literals INT#16#FF (*1) TIME#15s time#14ms TIME#25h_15m
SINT#16#ff Long prefix
time#25h_15m
Boolean FALSE and TRUE FALSE TRUE
Boolean 0 and 1 0,1
(*1) For INT#16#ff you can use 16#ff.
INT and BOOL literals can be used without keyword.

For more details, see online help,


[IEC 61131 basics] - [Data types in IEC 611310-3] ? [Literals in IEC 63313-3]

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.11
User Function Block
 FBD created can be used as a user function block.
 It can be utilized within the project.
User function blocks
‘FBD_SAMPLE’ uses TLC can be listed in Edit
Example: ASET_IECLANG.mwt in Wizard by selecting
CONTAINER_ISCONTROL
the project name.
LED Sheet. ‘FBD_SAMPLE’
is a program.

User FBD

VAR_INPUT is a input terminal.


VAR_OUTPUT is a output
terminal.

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.12
Summary
 Development/Maintenance Tool
 Logic Designer
 Resource Configurator
 Web Browser for Maintenance Page
 I/O interface
 Device Label
 FCN/FCJ Programming
 5 Languages / IEC 61131-3
 Software Architecture of FCN/FCJ
 Program, Task, Resource, Local Variable, Global Variable
 Function and Function Block
 Elementary data types, Literals

| Document Number | March 23, 2016 |


© Yokogawa Electric Corporation
Page.13

You might also like