Greetings to everyone,
I’m new to this forum and to CodeSys v3.5, and I’m currently working with a WAGO PFC200 PLC.
I need to read the serial number of the PFC200 using Structured Text (ST) in CodeSys v3.5.
I’ve been exploring libraries and functions but haven’t found a clear way to achieve this yet.
I appreciate your suggestion to use the WagoAppConfigtool and the script ./get_coupler_details serial-number.
However, if there’s an alternative way to retrieve the serial number directly in ST without using scripting, I would be very interested to know about it.
Note that it will return a serial number based on MAC-address (i.e 0030DE507951), not the same result as WagoAppConfigtool library (i.e 7SUN31564010260430577+0000000000003772)
PROGRAM POU
VAR
Result: SysTarget.RTS_IEC_RESULT;
psSN: POINTER TO STRING(255);
sSN : STRING(255);
maxLen: DINT := 255;
END_VAR
//Required Libs: SysTarget
IF psSN = 0 THEN
Result := SysTarget.SysTargetGetSerialNumber(ADR(psSN),ADR(maxLen));
END_IF
sSN := psSN^;
I tried calling two methods and they worked.
Question: where did I write the serial number on the PLC itself?
As I understand it, the MAC address is somehow related to the serial number?
0030DE507951 = 7S UN315640102 60430577 + 0000000000003772 ?