-
Notifications
You must be signed in to change notification settings - Fork 0
Home
With TwinCAT, the ADS system is used to read and write information between the PLC runtime (running inside the kernel memory space) and your application (running inside the user memory space). Beckhoff created a nice set of NuGet packages for doing this, but left some big deficiencies in its implementation.
Some of the deficiencies in the current version of the Beckhoff created NuGet packages are:
- Unable to differentiate between a struct, program, or function block when inspecting the data type
- Unable to use appsettings.json file to load the PLC address information, enabling easy dependency injection of the ADS communication
- A notification of change of a PLC variable is limited to 1 time (e.g. every 100 ms)
- Unable to write a complex variable containing data types the user memory space shouldn't be overriding (e.g. pointers, references, function block address, etc)
- Unable to read/write arrays of strings
This is where the ADS Simplified Interface comes into play. ADS Simplified Interface is designed to be used via a simple dependency injection Services.AddSington<AdsSimplifiedInterface>() or directly, where the parameters can be past to the constructor directly.
Unfortunately, there is no solution for the issue with telling the difference between a program, function block, or struct when inspecting the data type. The work-around is to use a pragma to mark the program or function block as not block writable, preventing the interface from attempting to write the entire block in a single command. This would of course overwrite the function block or program pointer stored at the beginning of the data block. With the function block or program marked that it must not be written as a block, the interface will automatically break it down and write the members instead. A member marked as read only will be skipped and marked as not block writable will be automatically broken down.