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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
https://faq.codesys.com/pages/viewpage.action?pageId=21135402