Search

Premium Membership ♕

Limited Time Offer: Save 15% on PRO Plan with discount code: LRN15 and study specialized LV/MV/HV technical articles and studies.

Home / Technical Articles / Let’s start learning the PLC programming

Introduction to PLCs

For managing and control of the electrical systems there once were used electromechanical relays. In time as technology advanced came and PLC devices (Programable Logics Controllers). 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.

Let's start learning the PLC programming
Let’s start learning the PLC programming

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)

Premium Membership

Get access to premium HV/MV/LV technical articles, electrical engineering guides, research studies and much more! It helps you to shape up your technical skills in your everyday life as an electrical engineer.
More Information
author-pic

Vlada Markovic

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

21 Comments


  1. Leonard Mahao
    May 26, 2021

    very curious about EEP


  2. Edgar Chisepo
    Jul 06, 2019

    I am looking for help in wiring IC 4049 for inverter purposes


  3. Thomas Hoffpauir Jr
    Jul 05, 2019

    Suggested edit… “There are tree sizes…”


  4. KAMALKANAN
    Jul 05, 2019

    Good


  5. Sameeullah
    May 08, 2017

    Very nice


  6. Christopher Morris
    Jul 09, 2015

    A few of my employees as extreamly interested in learning about PLC’s, the problem is they have been on the Mechanical Side of repairs their whole career. PLC’s can be complicated and overwhelming if not trained properly. Where could they start is my question. I really want them to get a good foundation before starting in siemens training, where would/could they start?

    If you could please reply to [email protected]. Thanks for all the support.


  7. James Murau Kiburi
    Jun 28, 2015

    Thanks a lot for that productive information. Please keep it up.


  8. waseem
    Jan 20, 2015

    how can v apply the ladder program to the plc.


  9. kalappa
    Dec 02, 2014

    plz upload presentetion


  10. walter
    Nov 16, 2014

    Nice starting point.


  11. sumit maiti
    Aug 11, 2014

    The description is easy and clear


  12. 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)


  13. engr
    Jun 23, 2014

    very nice post.


  14. sasikumar
    Mar 27, 2014

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


  15. 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.


  16. Edvard
    Mar 18, 2014

    Nice tutorial, thanks!


    • Vlada Markovic
      Mar 20, 2014

      Tnx Edvard


  17. 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.


  18. Petru
    Mar 17, 2014

    ))) let’s try to learn something new

Leave a Reply to Edvard

Tell us what you're thinking. We care about your opinion! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a professional and meaningful conversation instead. Thanks for dropping by!

eighty one  −    =  71

Learn How to Design Power Systems

Learn to design LV/MV/HV power systems through professional video courses. Lifetime access. Enjoy learning!

Subscribe to Weekly Newsletter

Subscribe to our Weekly Digest newsletter and receive free updates on new technical articles, video courses and guides (PDF).
EEP Academy Courses - A hand crafted cutting-edge electrical engineering knowledge