Lecture 1-4 PDF
Lecture 1-4 PDF
Lecture 1-4 PDF
Automation
Lecture One
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.
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.