Integrate Generated Code with Siemens IDE Project
You can integrate generated code with an existing Siemens® SIMATIC® STEP® 7 or Siemens TIA Portal project. For more information on:
How to generate code, see Generate and Examine Structured Text Code.
The location of generated code, see Files Generated by Simulink PLC Coder.
Integrate Generated Code with Siemens SIMATIC STEP 7 Projects
In the Siemens SIMATIC STEP 7 project, right-click the Sources node and select Insert New Object > External Source.
Navigate to the folder containing the generated code and open the file.
The custom file name unless assigned differently, is the
. After you open the file, a new entry calledmodel_name.sclappears under the Sources node.model_name.sclDouble-click the new entry. The generated code is listed in the SCL editor window.
In the SCL editor window, select Options > Customize.
In the customize window, select Create block numbers automatically, and click OK.
Symbol addresses are automatically generated for Subsystem blocks.
In the SCL editor window, compile the
file for the Subsystem block.model_name.scl
The new Function Block is now integrated and available for use with the existing Siemens SIMATIC STEP 7 project.
Integrate Generated Code with Siemens TIA Portal Projects
In the Project tree pane, on the Devices tab, under the External source files node in your project, select Add new external file.
Navigate to the folder containing the generated code and open the file.
The custom file name unless assigned differently, is the
. After you open the file, a new entry calledmodel_name.sclappears under the External source files node.model_name.sclRight-click the new entry and select Generate blocks from source.
The Siemens TIA Portal IDE compiles the new file and generates TIA Portal program blocks from the code. The program blocks appear under the Program blocks node. They are available for use with the existing Siemens TIA Portal project.