Main Content

Import Structured Text Code Automatically

PLC IDEs for Importing Code Automatically

You can generate and automatically import structured text code to the CODESYS Version 2.3 target PLC IDE.

Generate and Automatically Import Structured Text Code

You can generate and automatically import structured text code. Before you start:

  • In the target IDE, save your current project.

  • Close open projects.

  • Close the target IDE and target IDE-related windows.

Note

While the automatic import process is in progress, do not use your mouse or keyboard to avoid disrupting the process. When the process is complete, you can resume normal operations.

You must have already installed your target PLC IDE in a default location. The target IDE must use the CODESYS V2.3 IDE. If you installed the target PLC IDE in a nondefault location, open the Configuration Parameters dialog box. In the PLC Coder node, set the Target IDE Path parameter to the installation folder of your PLC IDE. See Target IDE Path.

  1. If it is not already started, open the Command Window.

  2. Open the plcdemo_simple_subsystem model. To open the model, enter:

    openExample('plcdemo_simple_subsystem');

  3. Select the Subsystem block. Open the PLC Coder app.

  4. Open the PLC Code tab, click Settings > Import Code into IDE.

  5. Open the PLC Code tab and click Generate PLC Code.

  6. The software:

    1. Generates the code.

    2. Starts the target IDE interface.

    3. Creates a project.

    4. Imports the generated code to the target IDE.

If you want to generate, import, and verify the structured text code, see Import and Verify Structured Text Code.

Troubleshoot Automatic Import Issues

Following are guidelines, hints, and tips for questions or issues you might have while using the automatic import capability of the Simulink® PLC Coder™ product.

Supported Target IDEs

The Simulink PLC Coder software supports only the 3S-Smart Software Solutions CODESYS Version 2.3 target IDE for automatic code import and verification.

Note

Some antivirus softwares falsely identifies the executables that implement the automatic import feature as malware. You can ignore this false identification. For more information, see Issues with Anti-Virus Software.

Target IDEs Not Supported For Automatic Import

The following target IDEs do not support automatic import. For these target IDEs, the Import Code into IDE and Verify Code in IDE are disabled.

  • CODESYS Version 3.5

  • B&R Automation Studio® IDE

  • Beckhoff® TwinCAT® 2.11, 3

  • Generic

  • PLCopen

  • Rockwell Automation® Studio 5000 Logix Designer (both routine and AOI constructs)

  • PHOENIX CONTACT (previously KW) Software MULTIPROG® 5.0 or 5.50 (English)

  • Phoenix Contact® PC WORX™ 6.0 (English)

  • Rockwell Automation RSLogix™ 5000 Series Version 17, 18, 19 (English)

    For the Rockwell Automation RSLogix routine format, you must generate test bench code for automatic import and verification.

  • Siemens® SIMATIC® STEP® 7 Version 5.4 (English and German)

Possible Automatic Import Issues

When the Simulink PLC Coder software fails to finish automatically importing the generated code for the target IDE, it reports an issue in a message dialog box. To remedy the issue, try the following actions:

  • Check that the coder supports the target IDE version and language setting combination.

  • Check that you have specified the target IDE path in the subsystem Configuration Parameters dialog box.

  • Close currently open projects in the target IDE, close the target IDE completely, and try again.

  • Some target IDEs can have issues supporting the large data sets the coder test bench generates. In these cases, try to shorten the simulation cycles to reduce the data set size, then try the automatic import again.

  • Other applications can interfere with automatic importing to a target IDE. Close other unrelated applications on the system and try the automatic import again.