-

Creating a C# function block library

With Visual Studio®, you can program functions, function blocks, function containers and programs in C# which you can subsequently import using the iCube Engineer Toolchain, iCUbe Engineer and use on a iCube Control device.

Creating a iCube Engineer C# library project

  1. Create a new project

    On the Visual Studio select Create a new project
    Type in search iCube Engineer and double-click theiCube Engineer C# library project

    Image

    Type in your Project Name, select a storage location and click Create.

    Image
  2. Enable the System namespace

    See the System namespace topic for this step.

  3. Add new code sheets

    With the extension, different code sheet templates are available. All templates are very basic but working examples. They can be compiled and tested right away.

    • To add a new template right click in the Solution Explorer on your desired project.
    • Select Add New Item….

      Image

    • Select in the left tree C# Items →iCube Engineer and then one of the following templates:

      Image

    • Function
      Template for a C# function to be used in IEC 61131-3 code.

      Select a return value in the popped-up dialog:

      Image

      Return Type:
      For information on the data types in C# programming and their correlations to data types in IEC 61131 or C++ programming, you can pop up the table of supported data types in an overlay window.

      Kind of Return Value:
      By Reference is recommended for complex data types and is mandatory for strings, arrays and structures.

    • Function Block
      Template for a C# function block to be used in IEC 61131-3 code.

    • Function Container
      Template for a C# function container to define several IEC functions in on class.

    • Program
      Template for a C# program to be used like an IEC 61131-3 program.
      ↪ A default code sheet for the selected type of element is created.

  4. Create the code

    In the template code sheet, create the code for the function, function block, or function container

    Image

    Create the entire project by pressing F6.
    ↪ A *.pcwlx library is being stored in either the Release or the Debug directory of the project.

Proceed with importing the library into iCube Engineer to use your C# function or function block in an automation project.

 


This help information is valid for iCube Engineer Online Help 2025.6

Copyright © 2025 YASKAWA EUROPE GmbH and © 2025 YASKAWA America, Inc.