Include C# EasyModbus lib in FirmwareLibrary
Hello,
I would like to know if it is possible to include a library like EasyModbusTCP in a FunctionBlock to use it in PLCNextEngineer (yes I know there is a ModbusTCP library made by Phoenix Contact)? I tried it but was not able to execute any of the FunctionBlocks that I imported in my PLCNextEnginner Project.
Comments
I would like to know if it is possible to include a library like EasyModbusTCP in a FunctionBlock to use it in PLCNextEngineer
No, that's not possible.
Code that targets the Embedded Common Language Runtime (eCLR) can only use the classes that are provided with the eCLR. The complete list of available eCLR classes is shown in the documentation when you create a new PLCnext C# project in Visual Studio.
You could write a C# application that targets .NET Core, like these three examples demonstrate:
... but these applications do not have a tight integration with PLCnext Engineer, so you would need to exchange data with the PLCnext Engineer project via Global Data Space (GDS) variables using (for example) gRPC, REST or OPC UA.
In case it helps, according to the PLCnext Runtime System roadmap, an integrated Modbus/TCP client should be available in an upcoming PLCnext Engineer release, which will be handier to use than the Modbus/TCP library for many cases.