We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services.

Introduction to Visualizations

CoDeSys 2.3 allows to build visualizations controlling the PLC.  While writing the main program one can direct bind variables with command coming from the visualization.  It makes the work easier; creating the future control is intuitive.

The visualizations built with CoDeSys can be made available through the webserver of the PLC controller.  To access it enter in the address bar of your browser the IP of your controller in the local network.  It is also possible to use the CoDeSys HMI available in shareware version.  It enforces an application closing after a few minutes of working but it does not limit the functionality.  For house needs the program is run a few minutes at a time anyway…

(before you start to program take a look at the user’s guide available in the web, which describes all the visualization functions.  At the beginning it is absolutely enough).

To create a simple visualization choose the Visulaiozation tab, right-click and choose ‘Add Object’.  After the name is entered (for example “PLC_VISU”) and the OK button is pressed the new object is created.

Tworzenie wizualizacji

Adding emelents to the visualization is as simple as drawing object in a graphical editor.  The list o available shapes is long: rectangles, ellipses, triangles, lines, arches, pictures, buttons, embedded visus, tables, graphs, bars etc.  You can read about the details in the User’s Guide.

For example – creating a button, which controls lights could look as follows:

1.  Adding an rectangle element

2. Configuring the parameters (double click on the object)

  • Text, Content: 1
  • Colors, Alarmcolor, Inside: “RED”,
  • Variables, Change color: “name_of_the_color_changing_variable” (PLC_PRG.LIGHT1.xActuator),
  • Input, Tap variable: “name_of_the_controlling_variable” (PLC_PRG.VIS_LIGHT1)

In the programming part of PLC_PRG, in variable definition:

LIGHT1 : Fb_LatchingRelay; (*from Building_common.lib*)
VIS_LIGHT1 : BOOL;

In the program itself:

LIGHT1(xSwitch:=IN1 OR VIS_LIGHT1);
OUT1:=LIGHT_1.xActuator;

Where:

IN1 – Input connected to the wall-moutned swicth

OUT1 – Output connected to the light’s circuit

Pressing the button “1” will make the variable VIS_LIGHT1 change briefly from FALSE to TRUE, what will be understood as an impulse to change the status of the function block LIGHT1 and will turn the output OUT1 on or off.  When OUT1 is on, the value of the LIGHT1.xActuator is TRUE, what causes the button to change the color.