Illustration of a code editor window with warning icons and a green check mark, representing static analysis in CODESYS.

Do you enable Static Analysis in CODESYS?

One small setting can save hours of troubleshooting.

Many PLC projects fail not because of complex bugs, but because of simple issues that slip through builds. CODESYS Static Analysis Light is a built-in feature that provides extra compile checks to catch problems early, improve code quality, and keep your PLC projects clean and maintainable.

What is Static Analysis Light in CODESYS?

Static Analysis Light runs during compile time and flags issues that are often overlooked but can cause major headaches on the plant floor. It checks for:

  • Unused variables

  • Overlapping memory areas

  • Multiple write access on outputs

  • Write access from several tasks

These may sound minor, but they can prevent costly downtime. For example, detecting overlapping memory or two tasks writing to the same output ensures that your system behaves predictably.

Why enable Static Analysis in CODESYS?

  • Faster commissioning – Fewer surprises during startup.

  • Higher reliability – Eliminates hidden conflicts before runtime.

  • Lower cost – Prevents downtime and troubleshooting caused by subtle mistakes.

  • Cleaner code – Keeps projects maintainable and scalable for the long term.

Recommended Static Analysis settings

If you are starting out, enable at least these checks:

  • Unused variables

  • Overlapping memory areas

  • Conflicting writes to outputs and memory

For multitasking, motion, or complex function block projects, enable all available checks for maximum protection.

Pro tip: Treat compiler warnings as action items. Driving the warning count to zero at each milestone keeps your project predictable and professional.

How to enable Static Analysis in CODESYS

  1. Open your Project Build Settings in CODESYS.

  2. Find the Static Analysis Light options under compiler settings.

  3. Enable the checks you want enforced.

  4. Save these settings into your project template so every new project starts with them enabled.

Team tip: Commit the project with static analysis settings enabled so every engineer compiles with the same rules. This consistency prevents regressions.

CODESYS Project Settings window showing Static Analysis Light with additional compile checks enabled, highlighting unused variables, overlapping memory areas, write access from several tasks, and multiple write access on output.

Example problems caught by Static Analysis

  • Overlapping memory areas: Accidentally mapping two variables into the same memory can cause values to overwrite each other.

  • Multiple writers: When two rungs or tasks drive the same output, behavior becomes unpredictable. Static Analysis flags this conflict.

  • Unused variables: Often a sign of incomplete refactors or typos, these clutter the project and can confuse future maintainers.