Skip to main content

Free PLC course outline

  1. Lesson #1: What Is It and Why Should Every PLC Programmer Know It? Part #1
  2. Lesson #2: How to install Codesys? Part #2
  3. Lesson #3: Write your first program in Codesys: Structured Text – Part #3
  4. Lesson #4: How to Create a Codesys Visualization in an Application? – Part #4
  5. Lesson #5: Introduction to Variables in CODESYS – Part #5
  6. Lesson #6: Data Structures in CODESYS: Practical Use of Arrays and Structures – Part #6

Creating a Codesys Visualization in an application might seem complex, but with this step-by-step guide, it will become simple. In this post, we will show you how to add a visualization manager, create a screen, and connect variables to interface elements.

Adding the Visualization Manager

  1. In the Project Tree, right-click on Applications.
  2. Select Add Object.
  3. Choose Visualization Manager.
  4. In the Visualization Manager window, you will find various options – you can choose a visualization style.
  5. Click the ADD button to add the visualization manager.
Visualization Manager
VisuSymbols

Creating the First Screen

  1. Go back to the Project Tree and right-click again on Applications.
  2. Select Add Object and add a new Visualization.
  3. Name the screen, e.g., Screen_01, and confirm.
  4. Now you have a view of the newly created screen.
Visualization Codesys
Codesys Visualization Object

Adding Interface Elements

  1. Go to the Visualization tab.
  2. Select the Lamp and Switches section.
  3. Drag and drop a Dip Switch on to the screen.
  4. Return to the Visualization Toolbox.
  5. Choose Push Switch and drag it onto the screen.
  6. Add a lamp by dragging and dropping it onto the screen.
Codesys DipSwitch
Codesys Visualization

Connecting Variables to Interface Elements

  1. Click on the first button (Push Switch), go to Properties.
  2. In the Variable field, double-click and select the three dots (…).
  3. Expand Application, go to PLC_PRG, and select the xPB_Button1 variable.
  4. Press Enter to confirm.
  5. Repeat this process for the next button, selecting the xPB_Button2 variable.
  6. Connect the lamp to the appropriate variable (xLamp) and confirm by pressing Enter.
Codesys properties
Codesys properties

Testing the Program

  1. Close the Visualization Manager.
  2. Make sure you have two screens open – PLC_PRG and Screen_01.
  3. Go to Window and set them as New Horizontal Tab Group.
  4. Navigate to Online and select Download Program to Simulation.
  5. Ensure that you have checked the Simulation option.
  6. Click Login, confirm by clicking Yes, and start the program.
Codesys Visualization Testing
Codesys Visualization Testing
Codesys Visualization Testing
Codesys Visualization Testing

Checking the Buttons and Lamp Functionality

  1. Turn on the first button – the xPB_Button1 variable will change to True.
  2. To turn on the lamp, press the next button – the lamp should light up.
Codesys Visualization Testing
Codesys Visualization Testing

Conclusion

Congratulations! You have successfully created a simple Codesys Visualization and connected interface elements to variables. If you want to enhance your automation programming skills, remember the basics of variables – we will explore this topic in future posts.

Free PLC course outline

  1. Lesson #1: What Is It and Why Should Every PLC Programmer Know It? Part #1
  2. Lesson #2: How to install Codesys? Part #2
  3. Lesson #3: Write your first program in Codesys: Structured Text – Part #3
  4. Lesson #4: How to Create a Codesys Visualization in an Application? – Part #4
  5. Lesson #5: Introduction to Variables in CODESYS – Part #5
  6. Lesson #6: Data Structures in CODESYS: Practical Use of Arrays and Structures – Part #6

Author

Matthew Kurantowicz

Author Matthew Kurantowicz

More posts by Matthew Kurantowicz