CoDeSys 3.5 - POU Types and Languages

Updated on September 3, 2018

What Is A CoDeSys POU?

A POU is an object of a specified type and language, it houses code that is called by a Task or another POU.

You can create a POU by right clicking on the “Application” object from the Device Navigation Pane and selecting Add Object >> POU

The “Add POU” window will open, from here you can create a new POU to add to your application. (Pictured above)

Name: The name of your POU

Type: The type of POU (this is covered on the next page)

Implementation Language: The language of the POU object. There are 6 options available that cover 5 different languages. The different languages have pro’s and con’s depending on what you are trying to achieve.

We will cover more on Implementation Languages later in this lesson pack.

Clicking Add will add the new POU to your Application object.

CoDeSys POU Types

There are 3 types of POU:

  1. Program
    1. The main POU type, if you’re not trying to create a re-usable code module, this is the correct POU type to use. A program type can be called by another program type or a Task and can call other programs, function blocks or functions.
  2. Function Block
    1. A function block POU is the most versatile POU type. It enables you to write a function and use it multiple times in another POU. Function blocks are declared at design time, they are given an instance in the application. This means that if a function block is used more than once, it is named, allocated memory and all instances of that function block remain separate to each other.
    2. A function block can be declared as a variable type
    3. Full object orientated programming is supported with Function Blocks using the “Extends” and “Implements” functions. These are not covered in this Lesson Pack, for now, simply ensure they are left blank. If your CoDeSys has check boxes for “Final” and “Abstract”, these should also be left unchecked.
  3. Function
    1. A POU that has a single output, declared at creation. A function is NOT created as an instance like a function block is. It can be used many times in your application, but the result is not retained in memory once executed. Your application must make use of the function and move the result to memory if it is to be retained. Functions such as timers are not suited well to functions as their elapsed time is lost every time the function completes.

CoDeSys 3.5 Languages

POUs can be written in 5 different languages, each have different strengths and weaknesses depending on the application that is being designed.

  1. Ladder Logic Diagram
    1. The most commonly used language, Ladder Logic excels at basic logic such as input / output control, timing and basic functions.
    2. Ladder reads from left to right, top to bottom. Each row (called a network) consists of conditions to check on the left and outputs to set on the right. Function blocks can appear either to the left or right depending on what the function block is doing.
    3. Complex statements such as IF, WHILE, CASE are not available in Ladder Logic, although they can be replicated if required
  2. Structured Text
    1. Commonly used for complex control, algorithms and repetitive functions.
    2. Structured Text is a written language and has no graphical properties. This can make it hard to read and follow, especially if proper notation is not followed
    3. Structured Text is harder to learn than other languages
    4. Complex statements are all supported
  3. Function Block Diagram
    1. Very similar to Ladder Logic
    2. Functions only are used to build the POU, there are not contacts / coils available
    3. Used often to build a sequence of calls to other POUs
  4. Instruction List
    1. Instruction list has recently been deprecated but remains for now in the CoDeSys system. The reason for its depreciation is it is difficult to write, read and follow and offers very little in value over other languages.
  5. Sequential Function Chart
    1. Commonly used for State Machine architecture, Sequential Function Chart reads like a flow diagram. Using Transitions and Steps, the program flows downwards with sequential and parallel code steps executing until either the flow finishes or jumps to the beginning again.
    2. It is easy to induce errors with SFC by not ensuring the flow is configured correctly
    3. SFC allows each step be assigned actions, these actions can be based on events such as “entry”, “exit”, “executing”. When an action is assigned, a POU is created and the option to choose a language is provided.
    4. Advanced users can create very complex architectures with relative ease
  6. Continuous Function Chart
    1. Similar by nature to Function Block Diagram, the POU consists of mainly calls to functions.
    2. The design is 100% graphical, with wires connecting inputs and outputs between functions
    3. Used mainly for small functions
    4. Is not an official IEC supported language


    0 of 8192 characters used
    Post Comment

    No comments yet.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)