Lecture 1-4 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Industrial

Automation
Lecture One

Advanced PLC Programming Topics

This lecture consists The


of some of advanced PLC programming topics such as:
Programmable Logic Controller abbreviated by PLC is a special
microprocessor based controlled system. Also, it is a special type of computer
capable of withstanding vibration, high temperature, and high humidity and
optimized for control tasks in the industrial environment rather than the
1. User defined function and function blocks
calculations and display tasks assigned to the normal computer.

2. Task based programming


3. P2P Communication
Function Block Diagram (FBD)
 As with ladder logic and structure text, function block diagrams or FBD is described in the
standard IEC 61131-3.
 Most PLC programs are written with some amount of FBD. Because, even though you might
write your functions The
in Programmable Logic Controller abbreviated by PLC is a special
structured
microprocessor text. You
based controlled system.still,
Also, itmost oftype
is a special theof computer
times, have to connect those
functions. capable of withstanding vibration, high temperature, and high humidity and
optimized for control tasks in the industrial environment rather than the
calculations and display tasks assigned to the normal computer.

IEC 61131-3 Function Blocks

 Function blocks (FB) are the main building blocks for structuring PLC programs.
 Function Block or a Function (FUN) are user made subroutines, instead of writing the same
program code several times, it can be written once and performed as a block with new in-/out
parameters.
 In FBD all functions are put into function blocks. They all have one or more inputs and
outputs.
 The function of the block is the relation between the state of its inputs and outputs. Here’s
how a simple function block could look like:
User Defined Function Block Steps

1. Using the right mouse button, click “ User Function / Function Block”.
2. Select Add Item and then Function Block.
3. Fill the Program text box with the required name (as an example Star Delta).
4. Select the programming language.
5. Double click the function block name under User Function/ Function Block.
6. Double click the Local Variables.
7. Fill the local variable table with the Input variable and Output variable of the user
defined function block under design.
8. Click the program segment name (Star_Delta[Program]).
9. Write the program.
10. Return back to the scan program and use the user function block as if it were an original
one.
Task Programming Steps

Task program does not repeat scanning unlike a scan program and instead, executes
only when its execution condition occurs. If several tasks are waiting, a higher priority
task program is processed first. Among tasks of equal priority, the processing happens
by the order of occurrence. There are fixed cycle tasks and internal contact tasks.

1. Create at least one scan program.


2. Right click on the PLC type line or the scan type program.
3. From the Add item select Task.
4. With the task menu do:

 Define the Task name.


 Select the priority number (2 to 7).
 Assign number for the task number depending upon the task type.
 Select the execution condition.
5. Right click the created task name and from Add item, select program.
6. With the Program popup menu do:

 Define the Program name.


 Select the programming language.
 Assign password for the program (optional).

7. Deal with this task program as if it were scan program.


8. Repeat the steps above to create new task program (if required).
Example: Create a task based programming to do 2-to- 4 decoder.
P2P Communication

The following steps for connecting the PLC with other devices
Step1: Doble click the internal Cnet and select P2P.
Step 2: Right click internal Cnet and from add item select P2P communication.
Step3: Click OK for the selected P2P popup menu.
Step 4: click the arrow preceding the added P2P and then doble click the P2P channel and
select the p2p driver.
Step5: Double click P2P clock to display the read write screen
Step 6:
 Select the communication channel .
 Select P2P function (Read / Write).
 Select the read or write flag (bit switch).
 Select the command type (for one variable
select single for more than one variable select
continues).
 Select the data type (bit or word).
 Select the data size (number of variable in
case of continuous).
 Select the station number (the ID of the device
the PLC is going to communicate with).
 In case of read operation define the
communication address of the variable (s) and
also where to store them in the PLC memory.
In case of write operation define the communication address of the variable (s) to be
modified by the selected PLC memory .
Sample of setting for P2P communication between the PLC and S100 AC Drive Unit whose
station number is 2.

You might also like