Skip to content

IEC Type "xxx" is inaccessible

edited March 2020 in PLCnext Engineer

Dear all,

 

I am currently trying to program a function block in VS (C#). The function block has a self defined data type. This data type is defined in PLCNext Engineer as well as in Visual Studio, using Structs.
Connecting this function block to variables in PLCNext of the same (self defined) data type works as well. But the general error SEM1190 : The specified IEC Type 'xxx' is inaccessible.

Is it possible to work with self defined data type, which i've made in PLCNext engineer, in Visual studio? If so, why is this error showing up?

 

Kind regards,

 

Coen van der Grinten

Comments

  • Hi Coen,

    There is an example in Github showing user-defined structs in C#:

    https://github.com/PLCnext/CSharpExamples/blob/master/PLCnext_CSharpExamples/03_UserStruct/UserStruct.md

    Your code seems to be missing the [Structure] attribute on the AI struct?

    ~ Martin.

  • Hi Martin,

     

    Indeed the [Structure] attribute was missing. Is it however possible to create a library in C# with all DataTypes, similar to how you would create all Data Types in PLCNext engineer?
    Can PLCNext Engineer recognize all of these data types?

     

    Kind Regards,

     

    Coen van der Grinten

  • I seem to have found my own solution, i should have looked around more before submitting my second question.

    For anyone curious:

    Within your C# project, you can create a separate C# code file. Within this code you can declare all the Data Types you want, and within the C# project, these types are recognized.
    As well for the PLCNext engineer project, if you include the project in the PLCNext Engineer library. Now you can keep a library of all data types you want to define, in C#.
    All these data types are available in PLCNext Engineer, so you can work with them in C# and PLCNext Engineer.

     

Sign In or Register to comment.