CODESYS HMI Interface

Codesys is a platform that has been developed for industrial automation devices and has its own set of frameworks for graphics, screen layout, blocks, instructions, syntax, and other elements.

Any PLC manufacturer that uses Codesys can find this common layout and rules in other PLCs too that use Codesys. Nowadays, devices have come in Codesys which offer PLC programming along with HMI screens in the same hardware and platform. One such device is GOC43 of Mitsubishi Electric, which is a PLC cum HMI controller.

In this post, we will learn how to design a standard Codesys PLC program and link it internally with Codesys HMI visualizations by using this device as a reference. We will create a simple understandable program and not go deeper into the topic by just learning the basics first.

CODESYS HMI Interface

All the Codesys platforms have the following languages supported for PLC programming – continuous flow chart, function block diagram, ladder logic, sequential function chart, and instruction list.

You are provided with two options: create a section (program) or create a user-defined library (function block). It is referred to as POU (program organization unit). That means if you have created 10 sections of the program and function block, it means you have created 10 POU’s in the program.

CODESYS HMI Interface

A variable can be defined in two scopes – local or global, as shown in the figure below. In the section we created, if we define a variable named test in the section itself, then it can be used locally in that section only.

Inversely, if we define this variable in GVL (global variable list), then it can be used in any section of the whole program.

CODESYS HMI Visualization

Now, suppose we define the variables locally in our example. Refer to the below image.

As you can see, the start variable has not been given a memory address, whereas the number variable has been given the memory address as %MW2. This means that the number variable can be accessed by an external device like HMI or other master controllers through this address.

Accordingly, you need to define variables as per your requirement, by either giving them an address or not. You can take the blocks and instructions from the right-hand side toolbox as shown.

CODESYS HMI PLC Implementation

Then, you need to add the section we created in the task configuration as shown below with the black box. This will allow the PLC CPU to execute that logic. Otherwise, it will not be executed in the processor.

Creating an HMI in CODESYS

Now, we head on to the graphics part. As seen in the figure below, you have to add a visualization object, just like you added a POU object for PLC programming. This will create a screen. There, you can place the objects as per your requirements.

As you can see in the below image, on the right-hand side, it shows the properties of a rectangle object that I have placed. There, you can directly link the variables that you defined in the PLC program – like text variables, color variables, and state variables and also configure input action in input configuration.

HMI with CODESYS

So, just create variables with any name in the PLC program and directly link in the objects wherever required.

In this way, we saw how to design a sample project involving PLC and HMI programming using Codesys software.

If you liked this article, then please subscribe to our YouTube Channel for Instrumentation, Electrical, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

1 thought on “CODESYS HMI Interface”

Leave a Comment