- 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 Project/Project information dialog and fill in the following fields:
- Open the Library Manager and add the following libraries:
- CmpApp
- SysTypes2 Interfaces
Adapt the POU PLC_PRG as follows:
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
- Start the project.