Chapter 2 - Introduction To TwinCAT Automation System and PLC Basic Principles
Chapter 2 - Introduction To TwinCAT Automation System and PLC Basic Principles
Introduction to TwinCAT
Automation System and
PLC Basic Principles
2. TheHardware
7 parts of the IEC 61131 Standard IS
3. Programming Languages IS
4. User Guidelines IS
5. Messaging Service Specification IS
7. Fuzzy Logic IS
8. Technical Report
IS = International Standard
Data Types
Type Size Bit Range
Bit 1 (0 or 1)
Byte 8 (0 to 255)
Word 16 (0 to 65,535)
Integer 16 (−32,768 to +32,767)
DWORD 32 (0 to +4,294,967,295)
DINT 32 (−2,147,483,648 to +2,147,483,647)
Real 32 (4 byte floating point)
Time (encoding depends on the PLC)
String (depends on PLC, but typically the max length 255 characters)
Arrays (any of the above types grouped into an array)
Variables Declaration
Configuration
Resource Resource
FB FB FB FB
Access Path
FB Function Block
Configuration : At the highest level, the entire software required to solve a particular control problem can
be formulated as a Configuration. A configuration is specific to a particular type of control system,
including the arrangement of the hardware, i.e. processing resources, memory addresses for I/O channels
and systemcapabilities.
Resource : Within a configuration one can define one or more resources. One can look at a
resource as a processing facility that is able to execute IECprograms.
Tasks : Within a resource, one or more Tasks can be defined. Tasks control the execution of a set of
programs and/or function blocks. These can either be executed periodically or upon the occurrence of a
specified trigger, such as the change of avariable.
Program Organization Units :Within IEC 61131-3, the Programs, Function Blocks and Functions are called
Program Organization Units, POUs.
• Program
Program is a network of Functions and Function Blocks.
• Function & Function Blocks are the basic building blocks, containing a data structure and an algorithm
IEC has defined standard functions and user defined functions. Standard functions are for instance
ADD(addition), ABS (absolute), SQRT, SINus and COSinus. User defined functions, once defined, can be
used over and over again.
• Programming Languages : Within IEC 61131-3, the syntax and semantics are defined for six standard programming
languages, leaving no room fordialects.
• Reuse of ready-made Functions and Function Blocks, Reduced waste of human resources, in training,
debugging, maintenance.
Other Functions
Variable Declaration
Counter Down
Contact Coil
Counter Up
Power Rail
Set Coil
Inverted Contact
ON Timer
Output
Other Functions
Input
ET0802 (AI for Automation) 14
PLC Basic Ladder Diagram (LD) Elements (Series, Parallel)
IEC 61131
Power Rail
Parallel Coils Function Blocks
Series Contacts
General Blocks
Parallel Contacts
Variable Declaration
Check point!