Let's start learning the PLC programming

Let’s start learning the PLC programming

Introduction

For managing and control of the electrical systems there once were used electromechanical relays. In time as tehnology advanced came and PLC devices (Programable Logics Controlers).

Advantage of an PLC devices over relays is that they can be used for a different problems with the same hardware, while relays must be again rewired to do some other function.

Also there is the finance aspect since now PLC are cheaper then relays.


PLC Components

Every PLC is consists from a couple components. Each manufacturer gives his combination but we can disassemble an PLC on his key elements:

  1. Power source
  2. CPU
  3. Input modul
  4. Output modul

There are tree sizes of a PLCs: Mini, medium or rack.

Each of above mentioned parts of PLC must be supplied with power (the common beginners mistake is that they connect only one modul of a PLC to power source and then only that modul works).

We can supply moduls with AC or DC current variously of our needs. In most of cases on module we have a COM conector which is wired to a “-“ end if DC or a “0” end if AC and each connector of that modul must be supplied with a “+” end of power source (if we are using AC the correct term is “hot” wire).

An example of wiring power supply and module is showed in Figure 1:

Figure 1 - PLC power supply and module wiring

Figure 1 – PLC power supply and module wiring


Input modules are important because they convert monitored value into a electrical signal (namely into bits). Output moduls turn electrical bits into signals that acts on actuator.


Programming of a PLC

Programing is done in a ladder programming environment ,this way is adopted from anology with relays because with this there were less time needed to retrain technicians and engineers who has already worked with relays.

After understanding the problem and before beginning programming we need to “collect” all Input/Output(I/O) signals. Beetwen I/O moduls is CPU.

Before we begin programming we need to define some basic terms:

Bitbox – as the name says it is a box containing a bit (it can hold only two bits:0 or 1) from whose value depends behavior of instruction (it is very important to remember that this box is virtual)

Instruction – action inside program that needs to check hers bitbox in order to execute .

Enviroment in which is programming being done varies from manufacturer of an PLC device but symbols are the same so we can work in different programs without big differences. On next pictures we can see RSLogix program.

Figure 2 - Ladder programming

Figure 2 – Ladder programming


From Figure 2 we can see why it is called ladder programming (we have two vertical lines between which is horizontal lines with instructions-rangs)

We will explain some of symbols that can be seen while programming :

Adresa 1

This is XIC instruction. The most important thing is to understand what this instruction does and how she does it. There are numerous interpretation of this instruction but in mine opinion the easiest for beginner is : “Go look for 1”.

Basically program tells instruction “go look for 1”,someone would ask where to look? Above instruction there is address of bitbox that need to be checked. If in bitbox, with address in this example “ADRESA_1”,contains 0 then instruction is FALSE,while it gets 1 and then instruction is TRUE.

XIC instr. Video

Adresa 2

This is XIO instruction. This instruction can be interpreted as “Go look for 0”,which it seeks inside bitbox with a address “ADRESA_2” .

XIO instr. Video

Adresa 3

OTE instruction represent excecutive command. It can be interpreted as “Go write 1” in bitbox with “ADRESA_3”. In order that this instruction gets TRUE value and therefore “write 1”in bitbox it need to have continues line of TRUE from left to the right side in a rang. Respectivelly if we have FALSE coming the instruction interprets this as “Go write 0”.

OTE instr. Video

Let us take a look at an example in Figure 2. In order to excecutive command “writes 1” we need to have next values inside bitboxes:

ADRESA_11
ADRESA_20

Explanation:

Program starts with XIC instruction and “looks for 1” if there is inside bitbox with adress “ADRESA_1” value 1 then this instruction is TRUE,next we have XIO instruction that “looks for 0” on address “ADRESA_2” and if bitbox has value 0 then this instruction is also TRUE. Since we have continuos TRUE from left to right executable instruction “goes and writes 1” inside bitbox “ADRESA_3”.

After that we can see that program ends and process start again.

Instruction LATCH

Instruction “LATCH” that is excecutable, has characteristic that if TRUE comes to it it “Write 1” same as OTE instruction but if we have FALSE coming then this instruction has command “do nothing”.

Instruction UNLATCH

Opposite of instruction latch we have instructionUNLATCH” that if has TRUE coming to it it interprets as “Go write 0” but if it has FALSE coming to her she inreprets as “do nothing”.


Timers

One more instruction we have are timers. There are four basic types of timers which are illustrated in the following table:

 On-delayOff-delay
With memoryRTORTF
Without memoryTONTOF

Timer with On-delay without memory (RTO) works in the following way: When TRUE comes timer starts counting time inside accumulator (which has 0 value in the example below) and counts time until preset(which is set to value 4000 in example,that is 4s) after what it excecutes instruction DN.

Timer with On-delay without memory (RTO)

Timer with On-delay without memory (RTO)


author-pic

Vlada Markovic - Bachelor degree in electrical engineering,looking to gain masters degree. Interested in power systems,plc,HV and LV equipment.



11 Comments


  1. sumit maiti
    Aug 11, 2014

    The description is easy and clear


  2. AKSHAY
    Jul 11, 2014

    I WANT AUTOCAD DRAWING …..FOR DELTA DVP16SN11TS

    * DELTA DVP16SN11TS (O/P MODULE,DIGITAL,16 POINTS,24VDC)
    * DELTA DVPO8SM11N (I/P MODULE DIGITAL,8 POINTS,24V DC)


  3. engr
    Jun 23, 2014

    very nice post.


  4. sasikumar
    Mar 27, 2014

    Dear Vlada Markovic,
    Great. Very nice Explanation. Thanks.


  5. dodikawa
    Mar 21, 2014

    How to get free PLC Simulator? Please help


    • Vlada Markovic
      Mar 21, 2014

      Dodikawa there is a lot of simulators and programing differs from manufacturer of PLC device. If you know what PLC device you need(have) then try to download software from internet.


  6. Edvard
    Mar 18, 2014

    Nice tutorial, thanks!


    • Vlada Markovic
      Mar 20, 2014

      Tnx Edvard


  7. Muck Deck Hermit
    Mar 18, 2014

    Just the thing I need to start programming my Siemens S7 PLC for a school project tomorrow. I am very interested in the webserver capability of the PLC, maybe something for a next article? PLC + noip.com is a very powerfull and helpfull combination for companies.


    • Vlada Markovic
      Mar 18, 2014

      Thanks Muck,at first I will stick to PLC devices for industrial usage and after that who knows.
      Cheers.


  8. Petru
    Mar 17, 2014

    ))) let’s try to learn something new

Leave a Comment

Tell us what you're thinking... we care about your opinion!
and oh, not to forget - if you want a picture to show with your comment, go get a free Gravatar!


five + = 14

FOLLOW EEP!

Subscribe to Weekly Download Updates: (free electrical software, spreadsheets and EE guides)

EEP's Android Application
Electrical Engineering Daily Dose
Daily dose of knowledge and news from
Electrical Engineering World

Advertisement

Get
PDF