How to get the submodule information of a Profinet device in the IEC program?
Motion Control Forum
Schneider Electric forum for Motion Control solutions, including Lexium MC12 & Cobot, Modicon PLC, PacDrive, Ecostruxure Machine, … from design, implementation to troubleshooting and more
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-04-2310:49 PM. Last Modified: 2024-11-2112:52 AM
How to get the submodule information of a Profinet device in the IEC program?
In the following example you can see how to access the submodules of a Profinet device.
The ProfinetCommon library, which has been available since EcoStruxure Machine Expert V2.0, serves as the basis for this.
PROGRAM SR_Main
VAR
deiInfo: DED.DEVICE_INFO;
result: DED.ERROR;
nextResult: BOOL;
submodule: ProfinetCommon.SubmoduleInfo;
submodules: ProfinetCommon.SubmoduleIterator;
END_VAR
// Get the device information of your Profinet device
result := <PN-Device>.GetDeviceInfo(deiInfo := deiInfo);
// Initialize the list of submodules
IF (submodules.InitByID(deiInfo.idSystem)) THEN
// Iterate through the list of submodules
nextResult := submodules.Next(submodule => submodule);
END_IF
The object submodule contains then the information of the first submodule of the ProfiNet device. In order to get the information of all submodules, you can use FOR and the SubmoduleIterator to loop through all submodules.