Display project filename on HMI

nz-dave
2023-04-30
2023-04-30
  • nz-dave - 2023-04-30

    Hi

    Is there a way to display the project file name (string) so i can have it displayed on the HMI/PLC.
    So i know what version of the program has been uploaded.

    Cheers

     
  • nz-dave - 2023-04-30

    just Stumbled over this after days of searching

    Declaration
    VAR
    sAppName : STRING := 'Application'; // must identic to the name in the device tree
    iecResult : RTS_IEC_RESULT;
    xInit : BOOL := TRUE;
    pApp : POINTER TO CmpApp.APPLICATION;
    stAppInfo : CmpApp.APPLICATION_INFO;
    pstAppInfo : POINTER TO CmpApp.APPLICATION_INFO := ADR(stAppInfo);
    sProjectName: STRING;
    sAuthor : STRING;
    sVersion : STRING;
    sDesc : STRING;
    sLastChange : STRING;
    END_VAR

    Implementation
    IF xInit THEN
    pApp := CmpApp.AppFindApplicationByName(pszString := sAppName, pResult := ADR(iecResult));
    pstAppInfo := CmpApp.AppGetApplicationInfo(pApp := pApp, pResult := ADR(iecResult));
    IF iecResult = 0 THEN
    sProjectName := pstAppInfo^.pstProjectName^;
    sAuthor := pstAppInfo^.pstAuthor^;
    sVersion := pstAppInfo^.pstVersion^;
    sDesc := pstAppInfo^.pstDescription^;
    sLastChange := DT_TO_STRING(pstAppInfo^.dtLastChanges);
    END_IF
    xInit := False;
    END_IF

     

Log in to post a comment.