PLC SW and Programming
Introduction: In the PLCs is usually running 2 Programs: Basic Software: what is the operating system User Program what is the code of instructions written by programators. The PLC SWs are organized into 3 main Modules : 1. Organization Modules (system) 2. Program Modules (user) 3. Data Modules (dates)
Organization Modules : Program Modules : Data Modules : OM1 to OM19 represent the interface between the program and the controller. Organization Modules start the PLC program cyclically, initialize the system area offer a variable program start; process error and interrupt handlers and they are closed with a "EP" Instruction (system instruction). FC0 to FC127 contain the major parts of the PLC program. FC represents a Function Call. Program modules can call data modules and other FCs, contain mainly interrelated functions of program parts, can be called with I/O parameters, are closed with a "EP" instruction. DM0 to DM127 store the fixed and variable values of as well as the text information in the PLC program. Two DMs can be active concurrently in a program block. Data modules are called by FCs or OMs, contain between 1 and 512 bytes of data per DM, must be activated prior to using them, are only active in the calling FC or OM, stay active in the FC or OM until other data modules are called.
Modules and Files of the PLC Program :
The Program Cycle :
PLC Programming Languages: Text Based languages Graphic-symbols Based Languages Structured Programs (ST) (Pascal, C, Basic,..) Ladder Diagram (LD) Sequential Function Block (SFC) - Grafcet Instruction List (IL) Firm Based with Special Instructions Function Block Diagram (FBD) Digital Circuits Symbols
Structured Programming (ST): Characterization: - Similar to Classic Programming -I/O definitions -Cycles (3 type of Cycles), Case, If, - contstructions - Procedures, Subroutines, and Main Program - Structure
Instruction List (IL): An instruction is composed from CODE and OPERAND. CODE OPERAND Operation Extension Operand Extension Parameter This instruction will make an AND operation, with the negation (N) of the input (I) bit (B) of the read from the 34 input address.
Instruction List - example: Boole Function: Instruction List (program):
Ladder Diagram (LD): Basic Sysmbols:
Seal - in circuit in (LD): Two inputs: Two outputs: X500, x501 Y430 (seal-in contact), Y431 (output)
Function Block Diagram (FBD):
SFC - GRAFCET: Sequential Flowchart Az utasítás grafikus jele: A Block: type of instruction: D delaying S storing SD stored delayed NS non stored NSD non stored and delayed SH store and stay stored after switch off T timer ST timer with time limit B block: here usually are written the effect of instruction Inputs: R: Clear the input (reset) F: conditioned input OUTPUTS: RC: 1 if the instruction is ready to execute C block: output connections (usually a number of output)
Example - GRAFCET: Példa: A control osf a mixer Machine with the delayed storing (ST): Az utasítás E1&E2 feltétel teljesülésekor aktív, majd a késleltetési idő leteltével, vagy a KI utasítással, vagy a külső törléssel R, leáll. A kimenet csak E3&E4 feltételek teljesülésekor aktív. Symbol in GRAFCET The instruction execution drawed with sysmbols used in Control Engineering
Input instructions are entered on the left Output instructions are entered on the right The power rails simulate the power supply lines L1 and L2 for AC circuits and +24 V and ground for DC circuits Most PLCs allow more than one output per rung The processor (or controller ) scans ladder rungs from top-to-bottom and from left-to-right. The basic sequence is altered whenever jump or subroutine instructions are executed. Anatomy of a Ladder Program
Logic Functions - AND PLC programming is a logical procedure In a PLC program, things (inputs and rungs) are either TRUE or FALSE If the proper input conditions are TRUE: The rung becomes TRUE and an output action occurs (for example, a motor turns on) If the proper input conditions are NOT TRUE: The rung becomes FALSE and an output action does not occur Ladder logic is based on the following logic functions: AND, OR, Sometimes called inclusive OR, Exclusive OR
Logic Functions - OR
Logic Functions - XOR
Motor START - STOP The pushbutton switch connected to input X1 serves as the "Start" switch, while the switch connected to input X2 serves as the "Stop." Another contact in the program, named Y1, uses the output coil status as a seal-in contact, directly, so that the motor contactor will continue to be energized after the "Start" pushbutton switch is released. You can see the normally-closed contact X2 appear in a colored block, showing that it is in a closed ("electrically conducting") state. If we were to press the "Start" button, input X1 would energize, thus "closing" the X1 contact in the program, sending "power" to the Y1 "coil," energizing the Y1 output and applying 120 volt AC power to the real motor contactor coil. The parallel Y1 contact will also "close," thus latching the "circuit" in an energized state: