Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • Create a "Standard project" and select CODESYS Control Win V3 as the device.
  • Define the target system by means of the Network scan.




  • Open the Library Manager and add the following libraries:
    CmpCodeMeter
    SysTypes2 interfaces



  • Create a "Structure" named ST_CODEMETER_INFO_EX.
    Adapt the ST_CODEMETER_INFO_EX as follows:


    Section
    Column
    width7

    Declaration

    Column
    width93
    Code Block
    themeConfluence
    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
    width7

    Declaration

    Column
    width93
    Code Block
    themeConfluence
    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
    width7

    Implementation

    Column
    width93
    Code Block
    themeConfluence
    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






  • Start the project and set the xReadInfo variable to TRUE.





    The read container/dongle information is saved in the array.

    For comparing the information from the License Manager.