Checking Syntax

When you enter the code, the TwinCAT precompiler performs some basic checks. Any errors are highlighted with a squiggly red line in the editor.

Once the programming is complete, you have to compile the PLC project. This is done with the Build command in the Project menu. The compiler checks the program and lists any errors in the Error List.

TwinCAT automatically generates the program code from the source code written in the development system before downloading the PLC project to the controller. Before the program code is generated, the system checks the assignments, data types and availability of libraries. In addition, the memory addresses are allocated when the program code is generated.

A check can also be started explicitly via the command Check all objects in the Build menu. This also detects errors in objects, which are not used in the current PLC project.

TwinCAT lists all errors and warnings in the Error List. Double-clicking an error message to open the affected POU. The faulty position is highlighted. Alternatively, you can navigate to the faulty position via the context menu for the error message.

Please also refer to the settings in the TwinCAT options under Smart Coding.

See also: