# 10. Compilation

# 10.1 Select Applications

After the program is written, you can select the application to be compiled in the drop-down boxes of "Device" and "Application" in the upper right corner, click the "Compile" button, and you can see the compilation result in the output bar.

The app in the project tree on the left belongs to the device, and the content in the selection box here is the same as in the project tree: select the target device first, and then select the app to be compiled. Currently, two types of applications are supported: PLC Logic Apps and Other Logic Apps (Python), and only one application can be selected from each type.

# 10.2 View the Call Tree

After the compilation is started, you can see the compilation log in the input bar, drag the scroll on the right, and find the "Call Tree Generated, click View" to view the call tree automatically generated based on the selected application.

# 10.3 Check ST Code

After starting the compilation, you can see the compilation log in the input column, drag the scroll on the right, and find the ST code generated, click to view, and you can view the ST code automatically generated based on the selected application, which meets the IEC61131-3 Version 2 standard.

# 10.4 View C code

After starting the compilation, you can see the compilation log in the output column, drag the scroll bar on the right side, find the "C code has been generated, click to view", you can view the automatically generated C code based on the selected application.

# 10.5 Check Compilation Logs and Error

After the project is edited, the user clicks Compile and can see the message generated by the compilation in the output box at the bottom. There are three types of compilation messages: error messages, warning messages, and compilation process messages, as shown in the following figure:

By default, these three messages are selected, and users can select one or more of them according to their requirements. In the following figure, the corresponding message diagram of the output box with only the warning message selected:

It is suggested that review all warning messages to ensure the program is correct. If there is an error message, it means that the compilation fails, and the user needs to modify the program and then recompile it until the compilation is successful, and the user can perform the download operation. When the compilation fails, under the error option in the output bar, you can see the reason for the error, and the middle bracket at the beginning of the error prompt indicates the error, and you can jump to the corresponding place by clicking the error. If there is an error in the variable declaration area, it will be called to the variable declaration area, if the DUT definition is wrong, it will jump to the corresponding DUT, if there is an error in the POU code area, the line number of the error will be highlighted for the text programming language, and the corresponding grid will be highlighted if it is a graphical programming language. As shown in the following figure, the IF statement is followed by a THEN error message: