Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

How to get the name of POU

faili
2013-06-27
2013-06-27
  • faili - 2013-06-27

    Can I get the POU name or any other application, task information in IEC application or in C? just like FUNC in C.
    It will be very helpful to locate the exceptions or bugs of my applications.

     
  • TimvH

    TimvH - 2013-06-27

    Search in the help for: "Attribute Instance-path"
    This will explain what you are looking for.

     
  • jzhvymetal - 2013-06-27

    This is how to get the application information in runtime

    FUNCTION GetAppInfo : BOOL
    (*'******************************************************************************
    '* This Function gets the application information.
    '*
    '* Function requires the system library CmpApp
    '* 
    '*******************************************************************************
    *)
    VAR_OUTPUT
       strProjectName: STRING(255);
       strDescription: STRING(255);
       strProfile: STRING(255);
       strVersion: STRING(255);
       strLastChanges: STRING(255);
    END_VAR
    VAR
       tResult: DWORD;
       tFirstApp: POINTER TO APPLICATION;
       pAppInfo: POINTER TO APPLICATION_INFO;
       pString : POINTER TO STRING;
    END_VAR
    
    tFirstApp := AppGetFirstApp(pResult := tResult);
    IF tFirstApp <> 0 THEN
       pAppInfo :=AppGetApplicationInfo(tFirstApp, tResult);
       strProjectName :=pAppInfo^.pstProjectName^;
       strDescription:=pAppInfo^.pstDescription^;
       strProfile:=pAppInfo^.pstProfile^;
       strVersion:=pAppInfo^.pstVersion^;
       strLastChanges:=DT_TO_STRING(pAppInfo^.dtLastChanges);
    END_IF
    
     

Log in to post a comment.