Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-2712:45 PM
Trouble Getting Data From a Modicon PLC With Unity Developer's Edition
I am writing a .NET 6 console application that uses the Unity Developer's Edition (UDE) COM API to automate some Control Expert features. So far I have successfully used UDE to connect to a Modicon M340 PLC over TCP/IP, transfer the PLC's project to my PC, and save the project to my hard drive as an STU file. Next I am trying to save the PLC's data to my PC with UDE's IProject::SaveDataFromPLC method, but this method consistently returns an error.
The error is a System.Runtime.InteropServices.COMException that contains no information other than a hexadecimal error code: 0xE8A72CED. I could not find any information about this error code online. Microsoft's Error Lookup Tool returns the following:
# No results found for hex 0xe8a72ced / decimal -391697171 # anonymous HRESULT: Severity: FAILURE (1), Facility 0x8a7, Code 0x2ced # for hex 0x2ced / decimal 11501 WSA_PNRP_CLOUD_NOT_FOUND p2p.h # 1 matches found for "0xE8A72CED"
From my googling, WSA_PNRP_CLOUD_NOT_FOUND is related to peer-to-peer networking, but because the Error Lookup Tool says there were no results found for the full hex, I am unsure whether WSA_PNRP_CLOUD_NOT_FOUND is relevant.
My console application is written in C#, and I worry that I am passing invalid arguments to IProject::SaveDataFromPLC. Here is the method I wrote that takes the Control Expert project and a file path as arguments and invokes IProject::SaveDataFromPLC to save the project's data to the file path: