...
Create a "Structure" named ST_CODEMETER_INFO_EX.
Adapt the ST_CODEMETER_INFO_EX as follows:Section Column width 7 Declaration
Column width 93 Code Block theme Confluence TYPE ST_CODEMETER_INFO_EX :
STRUCT
stRTS_CODEMETER_INFO : CmpCodeMeter.RTS_CODEMETER_INFO;
wsContainerName : WSTRING;
END_STRUCT
END_TYPE
Adapt the POU PLC_PRG as follows:
Section Column width 7 Declaration
Column width 93 Code Block theme Confluence VAR CONSTANT cw_MaxInfos : WORD := 3; END_VAR VAR xReadInfo : BOOL; iecResult : SysTypes.RTS_IEC_RESULT; iecHandle : SysTypes.RTS_IEC_HANDLE; iecPrevHandle : SysTypes.RTS_IEC_HANDLE; wIndex : WORD; aInfo : ARRAY [0..cw_MaxInfos] OF ST_CODEMETER_INFO_EX; END_VAR
Section Column width 7 Implementation
Column width 93 Code Block theme Confluence IF xReadInfo THEN xReadInfo := FALSE; iecHandle := CmpCodeMeter.CodeMGetFirst(iecResult); iecPrevHandle := SYSTYPES.RTS_INVALID_HANDLE; wIndex := 0; WHILE iecHandle <> SYSTYPES.RTS_INVALID_HANDLE DO IF wIndex = 0 THEN CmpCodeMeter.CodeMGetInfo(hCodeMeter := iecHandle, info := aInfo[wIndex].stRTS_CODEMETER_INFO); CmpCodeMeter.CodeMGetName(hCodeMeter := iecHandle, wstName := aInfo[wIndex].wsContainerName, nLenBytes := SIZEOF(aInfo[wIndex].wsContainerName)); ELSE iecPrevHandle := iecHandle; iecHandle := CmpCodeMeter.CodeMGetNext(hPrevCodeMeter := iecPrevHandle, Result := iecResult); IF iecHandle <> RTS_INVALID_HANDLE THEN CmpCodeMeter.CodeMGetInfo(hCodeMeter := iecHandle, info := aInfo[wIndex].stRTS_CODEMETER_INFO); CmpCodeMeter.CodeMGetName(hCodeMeter := iecHandle, wstName := aInfo[wIndex].wsContainerName, nLenBytes := SIZEOF(aInfo[wIndex].wsContainerName)); END_IF END_IF wIndex := wIndex + 1; END_WHILE END_IF
...