fisothemes / LabVIEW-TwinCAT-ADS

Easy to use unofficial LabVIEW TwinCAT ADS API for communicating with Beckhoff PLCs via ADS. Features include Invoking Rpc Methods, Reading/Writing of PLC variables (including all Standard, Time, Strings, WStrings, Structs composed of the aforementioned, Nested STRUCTs and Multi-dimensional Arrays of the aforementioned datatypes) and more!
MIT License
10 stars 2 forks source link

Connection to other Ports #4

Open AustinLukery opened 1 month ago

AustinLukery commented 1 month ago

Hi, I've just been starting to use this library and for me it works great when connecting to port 851 over ADS. However, I have used TwinCAT to create a specific Task with an image which I intend to use as the interface to labVIEW on Port 301. I've found that the "Register Event Callbacks.vi" within "Connect.vi" throws an error when trying to connect to port 301, but If I remove the Register Event Callbacks from the connect vi, I am able to connect to port 301 and read Symbol information as expected.

Currently I am looking to use this "bodged" modification myself, but it would be great if a more thorough fix could be implemented in a release

fisothemes commented 1 month ago

Hi @AustinLukery

Thanks for raising the issue, I did some debugging and it turns out the AdsStateChange event isn't supported on ports that don't have a runtime.

Your quick fix should be fine. The only thing I see you losing is event reading. Your solution will have to include some polling I'm afraid.

I'll sit down and investigate come up with a solution. Please note that I've only tested the library on ports that include a run time. Thing like the AMS Logger on port 100 may not work.

Ads State Change Test Results