Read codesys version in the codesys application

sigurdrb
12 hours ago
10 hours ago
  • sigurdrb - 12 hours ago

    Hi! I want to read the codesys version into the project, so I can highlight it in the SCADA system.

    VAR
        dwVersion : DWORD;
    END_VAR
    
    SysTarget.SysTargetGetVersion(pulVersion := ADR(dwVersion));
    

    This gives me the value 100859909.

    I tried to search ths up and found som older post (https://forge.codesys.com/forge/talk/Runtime/thread/a55981ff4d/) that said each 4 bytes reads a number in the version.
    Example is 50662666 = 16#03050D0A which reads to V3.5.13.10

    When I run this code I get the value 100859909, which I cant translate to anything meaningful.

    I am running it on Codesys V3.5.19.70.

    Help appreciated!

     
  • TimvH

    TimvH - 10 hours ago

    VAR
    RuntimeVersion: VERSION;
    END_VAR

    RuntimeVersion := __SYSTEM.Constants.RuntimeVersion;

    PS, when I call the SysTargetGetVersion on a Control Win, I get the value 50664488 = 16#03051428
    equals version 3.5.20.40

     
  • gatto

    gatto - 10 hours ago

    hi, i used another way

    declaration:
    pApp : POINTER TO APPLICATION;
    pAppInfo : POINTER TO APPLICATION_INFO;
    ProjectName : STRING (24) ;
    CodesysVersion : STRING (15) ;

    code:
    //library :
    // CmpApp
    // IoDrvEthernet
    //
    // Get Pointer to current application
    pApp := CmpApp.AppGetCurrent( pResult:= 0 );
    // Get Pointer to Application information
    pAppInfo := CmpApp.AppGetApplicationInfo(pApp:= pApp, pResult:= 0 );
    ProjectName := pAppInfo^.pstProjectName^ ;
    //convert codesys version to string
    CodesysVersion := IoDrvEthernet.UDINT_TO_IPSTRING ( udiIPAddress := pApp^.udiPSVersion ) ;


    so i think you need to convert your dwVersion in a UDINT and after convert UDINT_TO_IPSTRING

     

Log in to post a comment.