Want to create interactive content? It’s easy in Genially!

Get started free

How to write simple program or network in PLC

Sophia Stephanie Almazan

Created on January 6, 2023

Start designing with a free template

Discover more than 1500 professional designs like these:

Transcript

<

>

<How to write a simple Program or Network in PLC>

start >

>

>

<Programming Languages>

Instruction Lists (IL)

Structured Text (ST)

Function Block Diagram (FBD)

Sequential Function Chart (SFC)

Ladder Diagram (LD)

>

>

01

02

<

>

<

>

IL

ST

03

04

05

>

<

<

>

>

<

SFC

FBD

LD

<01>

Instructions Lists

start >

>

>

An instruction list gives programs as a series of instructions, with each instruction on a new line. Each instruction consists of an operator followed by one or more operands, that is, the subjects of the operator. Using the Instruction List Programming Language, you can call function blocks and functions conditionally or unconditionally, perform assignments and make jumps conditionally or unconditionally within a section.

Each instruction begins on a new line and consists of: - An OPERATOR - If necessary with a MODIFIER - And if necessary one or more OPERANDS

LD A to indicate that the operand A is to be loaded, LD being the operator used to indicate loading. In terms of ladder diagrams, an operator may be regarded as a ladder element, and LD is equivalent to starting a rung with open contacts for input A. Another instruction might be: OUT Q to indicate that there is to be an output to Q. Another example: LD X001 AND X002 OUT Y001 This means that if both input X001 and X002 are true, the output Y001 will become true(or high) also. Output Y001 is false(or low) otherwise.

>

>

//example

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Basic instructions used in instruction lists

>

>

//Advantages

//disadvantages

  • Less visual than ladder
  • Struggle to enter complex functions such as PID in Instruction List
  • Does not lend itself well to any form of structured programming
  • Program Execution Speed
  • ILs also tend to take up less memory
  • Programs written in this language are easier to display and edit on a handheld programming unit, with no software or laptop required

<02>

Structured Text

start >

>

>

Structured Text (ST) is a text-based PLC language, in contrast to other known PLC languages such as the ladder diagram or Function Block Diagram which are a graphic-based programming language. The syntax of Structured Text is developed to look like the syntax of a high-level programming language with loops, variables, conditions, and operators. ST borrows its syntax from PASCAL, enforces data typing and support structured programming. The structured text consists of a series of instructions which, as determined in higher level language, (“IF..THEN..ELSE”) or in loops (WHILE..DO) can be executed.

>

>

//example

IF value<7 THEN WHILE value <8 DO Value:=value+1; END_WHILE; END_IF

>

>

//basic rules of instructured text syntax

The syntax of Structured Text follows some basic rules. 1. All statements in Structured Text will end with a semicolon. 2. A routine will close out with an END_IF statement. 3. Spaces and tabs are not required, but still best to use for readability. 4. Also, Structured Text is not case sensitive, but if you are assigning a variable, known as a tag or a symbol such as control valve 1, then using camelCase ControlValve1 is a good practice to get into.

<03>

Function Block Diagram

start >

>

>

//Functional block diagram

  • A graphical language which shows signal and data flows through graphical blocks.
  • A program instruction unit that when executed, provide one or more output values.

>

>

sample function block

>

>

//fbd graphical objects

connections

>

>

//fbd graphical objects

Graphical Element for Execution Control

>

>

//examples

A signal lamp is required to switched on if a pump is running and the pressure is satisfactory, or if the lamp test switch is closed. Lamp=Pump&Pressure+Test

>

>

<04>

Sequential Funtion Chart

start >

>

>

Sequential Function Chart (SFC) can be used to structure the internal organization of a program consisting of sub-programs and are also written in other languages of the standard.

>

>

//how do sfc programming languages work?

Sequential controls include processing sequential and parallel operations that are discrete in terms of time or events, mainly to control complex process sequences.

SFC program is consists of: - Steps (States) - Transitions - Actions

>

>

//steps

  • Each steps indicates the state of the process. A step can be active or inactive.
  • Each stage is identified with a number that must be unique and not it must necessarily keep an order consistent with the sequence of the process.

>

>

//transitions

Transition are steps represented by a horizontal line across a vertical line and can be found in between two steps. It is containing the logic condition allowing the transfer from one step to another. Transitions are associated with a condition, these can be a logical function of variables of input and internal system.

>

>

//branching & convergence

Selective Branching - allows for different states to be realized, depending on the transfer condition that occurs.

>

>

//branching & convergence

Parallel Branching - represented by a pair of horizontal lines, allows for two or more different states to be realized and proceed simultaneously.

>

>

//branching & convergence

Simultaneous Convergence

General Convergence

>

>

//actions & qualifiers

The actions associated with the stages are represented by a rectangle sidebox where the type of action to be carried out is indicated (only the active ones). A stage can have one or more actions associated with it. Qualifier indicates what to do with the variable name or the action.

>

>

//example

>

>

//advantages

  • Similar to a flow chart.
  • Useful for sequential control operations.
  • Shows the main states of a system.
  • SFC shows all possible status changes.
  • SFC programming’s advantage is its ability to help the engineer break down large and complex processes into smaller pieces that are easy to understand.

>

>

<05>

Ladder Diagram

start >

>

>

Ladder logic (also known as ladder diagram or LD) is a programming language used to program a PLC (Programmable Logic Controller). It is a graphical PLC programming language which expresses logic operations with symbolic notation. Ladder logic is made out of rungs of logic, forming what looks like a ladder – hence the name ‘Ladder Logic’. The ladder diagram is basically a symbolic set of instructions used to create the controller program. This ladder instruction symbols are arranged to obtain the desired logic.

>

>

//basic ladder instruction symbols

Normally Open Instruction (Examine If Closed)

It is the same as the normally open relay contact. For this instruction, the PLC examines if the contact is closed (ON). If PLC detects ON (1) condition, the instruction is TRUE. It represents any input such as a normally open push button or a switch.

It is the same as the normally closed relay contact. For this instruction, the PLC examines if the contact is open (OFF). If PLC detects OFF (0) condition, the instruction is TRUE. It represents any input such as a normally closed push button or switch.

It is the same as a relay coil. The PLC makes this instruction TRUE if logical continuity exists on a rung. It represents any output that is controlled by some combination of input logic. It can be a connected device or an internal relay.

>

>

//ladder logic basics

A ladder logic is consisting of two vertical lines. It is in between these two lines your ladder logic goes. When you draw ladder logic, you will draw vertical connections between these two lines. Each of those is called a ladder rung.

>

>

//ladder rung

A ladder rung is a set of input instructions (usually at the left portion) and an output energize instruction (usually at the right). Normally, input instructions are located at the left side while output instructions are placed at the right side. Power flows from left to right of rung 1, then left to right of rung 2 and so on up to the end of the program. See example below.

>

>

//sample plc ladder progrAMMING

Suppose we will be using a Mitsubishi PLC with Model FX1s-30MT (Fixed type) in which the picture is shown below.

Figure 92. Mitsubishi Model FX1s-30MT PLC

>

>

//sample plc ladder progrAMMING

Then we connect I/Os as shown below.

Figure 93. Connections of PLC and I/O Devices

>

>

//sample plc ladder progrAMMING

Then create a ladder program that will have the following results: a. Lamp Y0, Y2 and Y4 will be energized if Switch X0 is ON. b. Lamp Y1, Y3 and Y5 will be energized if Switch X1 and Switch X2 are booth ON. Using the GX Developer Software, the ladder program is shown below.

Figure 94. PLC Ladder Program for Example 1

>

>

//programmable logic controllers

  • Are the major components in industrial automation and control systems. The PLC programming is an important task of designing and implementing control application depending on customers need.
  • A PLC program consists of a set of instructions either in textual or graphical form, which represents the logic to be implemented for specific industrial real time applications.

>

>

//programmable logic controllers

The procedure for programming a PLC for a certain application depends on the type of standard manufacturer software tool and the type of control application.

>

>

//Step 1: Analyze and Get the Idea of Control Application

  • The primary step to program the PLC is to get the idea for which you are going to develop an application-based program.
  • This status must be displayed by the LED light when the motor gets turn on. The motor is also attached with a sensor, that detects obstacles, so when this turned on, the motor should be turned off. And correspondingly, if the motor switched off, the buzzer should be turned on.

>

>

//Step 2: List All the Conditions and Get the Design using Flowchart

The variables of the above project are• M: Motor,• A: Input Switch 1,• B: Input Switch 2,• L: LED and• Bu: Buzzer, and the designing of the logic is easy with the implementation of flow chart

>

>

//Step3: Open and Configure the PLC Programming Software

Open the programming software installed in the PC that comes with PLC hardware.

  • Select the hardware model of the PLC in the software and configure it with appropriate input and output modules.
  • Select the ladder language (LD) from the list of the programming languages, and choose the hardware processor and give a name for the program.

>

>

//Step 4: Add the Required Rungs and Address Them

Add the required rungs based on the control application logic and give the address to the each and every input and outputs.

Ladder Logic Program

>

>

//Step 5: Check the Errors and Simulate It

  • Locate the Online section in the menu bar and select Online.
  • Check for the errors and make necessary changes after selecting Offline. Again, go online and select the Run option to simulate it.

//Step6: Download the Program to PLC CPU Memory

  • After the successful simulation of the program, download the program to CPU by selecting the Download option through a network or communication cable.

Completed!

>

<