KNOWARE  

Software for Education and Industry


   Home   Order Form    Reviews   

PLC Ladder Logic

and Function Blocks

with

CODESYS V3.5

Want to learn how to program a PLC in Ladder Logic and Function Block Diagrams, make HMIs (Human Machine Interfaces) and be able to run your programs on a simulated PLC?  PLC Ladder Logic and Function Blocks with CODESYS V3.5  shows you step-by-step how to program a PLC using free CODESYS software.

Simply download the free CODESYS software at http://store.codesys.com/codesys.html?___store=en&___from_store=default then follow the exercises in PLC Ladder Logic and Function Blocks with CODESYS V3.5 to learn how to program in Ladder Logic and Function Block Diagrams, build HMIs, and run your programs on a simulated PLC. You do not need an actual PLC to use PLC Ladder Logic and Function Blocks with CODESYS V3.5.

PLC Ladder Logic and Function Blocks with CODESYS V3.5 is written in everyday, easy to understand language that shows you step-by-step what to do.  PLC Ladder Logic and Function Blocks with CODESYS V3.5 is written in .html format so you can use your favorite internet browser with hyperlinks, bookmarks, and word searches.  PLC Ladder Logic and Function Blocks with CODESYS V3.5 requires no software installation on your computer.  Just double click on the Table of Contents.html, and your Internet browser launches the program.

What is CODESYS?
CODESYS is a program written by the German company 3S-Smart Software Solutions to program various PLCs. It is written to conform to IEC 61131-3, an open international standard for PLC programming languages.  Another program similar to CODESYS called TwinCAT 3 was developed by the German company Beckhoff.  CODESYS has a built-in simulation PLC, built-in HMI capability (Human Machine Interface or Visualization), and can be programmed in various PLC languages, including:
Who uses CODESYS?
CODESYS is used by companies such as Bosch, ABB, Moeller, Wago, Eaton, Festo and others to program their PLCs.

What
PLC Ladder Logic and Function Blocks with CODESYS V3.5 does:
This tutorial will show you step-by-step:

What PLC Ladder Logic and Function Blocks with CODESYS V3.5 does NOT do:
This tutorial does not address:

No prior knowledge of PLCs is necessary.

This tutorial is written by a Professional Engineer with 14 years industrial experience and 20 years experience teaching electrical engineering technology at the college level.

If you want to learn how to use CODESYS to program PLC Structured Text programs, you can purchase my PLC Structured Text with CODESYS V3.5 tutorial at http://www.knoware-online.com/st_codesys.html.

Or if you want to learn how to use CODESYS to program PLC Instruction List, you can purchase my PLC Instruction List with CODESYS V3.5 tutorial at http://www.knoware-online.com/il_codesys.html.

If you want to run and solve Ladder Logic programs without using CODESYS you can purchase my PLC Simulator 10 at http://www.knoware-online.com/pc-plc.html. This simulator turns your PC into a PLC, has the "look and feel" of Allen-Bradley RSLogix Micro software (though not exact), runs and solves Ladder Logic programs that you write, and allows you to build machines with limit switches, pilot lights, selector switches, solenoids, and conveyors that move in response to the ladder programs you write.   

How to use this tutorial:
To use this tutorial, download a free copy of CODESYS at http://store.codesys.com/codesys.html?___store=en&___from_store=default, then perform the exercises in Chapters 1 through 13 of this tutorial.   This tutorial can be used without downloading CODESYS, but the benefit of hands-on programming experience will be lost.

Chapters 1 though 5 of this tutorial explain how to download CODESYS, install it, program a rung, build an HMI, and run the program.

Chapters 6 thru 13 move at a little faster pace and explain many of the more advanced function blocks of CODESYS.



PLC Ladder Logic
and Function Blocks
 with
CODESYS V3.5

Table of Contents

Chapter

1.  Introduction
What is a PLC?           
History of PLCs
What is CODESYS?
Who uses CODESYS?
What this program does
How to use this program
What you need to use this program                     

2.  Launching CODESYS
Download CODESYS
Start CODESYS
Start a New Project
Save the Project
Summary                        
                    
3.  Programming Your First Rung
Open the Project Created in Chapter 2
Open PLC_PRG
Insert a Contact
Insert a Coil
Insert a Rung Comment
View as a FBD
Save the Project
Summary                                   

4.  Creating an HMI
Open the Project Saved in Chapter 3
Create an HMI
Program a Dip Switch
Program a Lamp
Save the Project
Summary

5.  Running Your Program
Open the Project Saved in Chapter 4
Choose the Simulation PLC
Build (compile) the Program
Login to the Simulation PLC
Start the PLC
Close the Switch from the HMI
Close the Switch by Forcing It
Stop the PLC
Logout from the PLC
Save the Project
Summary              

6Latch and Unlatch Relays (Set, Reset)
Start a New Project
Program a Set Coil             
Program a Reset Coil
Create an HMI
Run the Program
Program an SR and RS Function Block
View as a FBD
Save the Project
Summary

7.  Timers (TON, TOF, TP)
Start a New Project
Program a TON Timer
Program PT and ET
Program TON Timer Contacts
Run the TON Program
Program a TOF Timer
Run the TOF Program
Program a TP Timer
Run the TP Program
View as a FBD
Save the Project
Summary
              
8.  Counters (CTU, CTD, CTUD)
Start a New Project
Program a CTU Counter
Program a CTU HMI
Run the CTU Program
Program a CTD Counter
Program a CTD HMI
Run the CTD Program
Program a CTUD Counter
Program a CTUD HMI
Run the CTUD Program
View as a FBD
Save the Project
Summary
             
9.  Jumps and Subroutines
Start a New Project
Program a Jump and Label
Run the Jump and Label Program
Create a new POU
Program the new POU
Program a Visualization
Run the Jump to Subroutine Program
Change the Main Task
View as a FBD
Save the Project
Summary
            
10. Boolean Operators (AND, OR, XOR, MOVE)
Start a New Project
Program an AND Condition
What if the Inputs are Numbers?
AND two Decimal Numbers
AND two Binary Numbers
AND two Hex Numbers
AND two Octal Numbers
AND two Variables
Program an OR Condition
Program an XOR Condition
Save the Project
Summary

11.  Math Operators (ADD, SUB, MUL, DIV, MOD)
Start a New Project
Program an ADD Function
Program an SUB Function
Program an MUL Function
Program an DIV Function
Program an MOD Function
Change the Variables to Type REAL
Save the Project
Summary 
          
12.  Compare Operators (EQ, NE, LT, LE, GT, GE)
 Start a New Project
Program a EQ Function
Program a NE Function
Program a LT Function
Program a LE Function
Program a GT Function
Program a GE Function
Save the Project
Summary

13  Selection Operators (SEL, MUX, MIN, MAX, LIMIT)
Start a New Project
Program an SEL Function
Program a MUX Function
Program a MIN Function
Program a MAX Function
Program a LIMIT Function
Save the Project
Summary

Index

 

Sample excerpt from... 

 Chapter 13.  Selection Operators (SEL, MUX, MIN, MAX, LIMIT)

 

Step 3)  Program a MUX Function

Insert a rung after rung 3 and Assign the value of 4 to Input4 as shown in Figure 3 below.  Make Input4 be Type REAL.

Figure 3  Adding an Input 4

Adding Input 4

Add new rungs 6 and 7 as shown in Figure 4 below.  Program an up counter (CTU) in rung 6 and a multiplexer  (MUX) in rung 7.  We will use the counter to step the multiplexer. Enter 3 at the PV value of the counter. Add two additional inputs to the MUX by right clicking it then choosing Append Input (do this twice). Program CTR1.CV at the K input of the MUX, and Input1 thru Input4 at the other inputs.  Program Result1 as the output variable for the MUX and make it Type REAL.  All inputs, except K, and the output must be of the same data Type for the MUX. Your screen should look like Figure 4 below.

Figure 4  Adding a CTU and MUX

Add a CTU and MUX

A MUX function is like a selector switch with multiple positions.  The K input determines which Input will get through to the output.  When K = 0, the top Input gets through to the output of the MUX, when K = 1, the next Input gets through, and so forth.  Figure 5 below shows the MUX function as a selector switch.

Figure 5  MUX as a Selector Switch

MUX as a selector switch

Run the program.  See Chapter 5 if you need a refresher on running a program. The CV (current count) of  counter CTR1 should be 0 starting out.  If it is not 0, click on Online>>Reset Cold, then start the PLC again. Notice that K is 0 on the MUX because the K input is CTR1.CV, so Input1 is getting through to the MUX output.

Hardware/Software Requirements: