Particularly in library development, the controller manufacturer must be able to execute the library on his device only.
One could also imagine that it is necessary to access the information of the operating system, processor, or CODESYS version.
- 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 Library Manager and add the SysTarget library.
Adapt the POU PLC_PRG as follows:
Declaration
VAR dwType : DWORD; dwId : DWORD; dwVersion : DWORD; iecResult : SysTypes.RTS_IEC_RESULT; wName : WSTRING; udiNameLength : UDINT := 80; udiOsInfo : UDINT := 80; END_VAR
Implementation
iecResult := SysTarget.SysTargetGetType(ADR(dwType)); iecResult := SysTarget.SysTargetGetId(ADR(dwId)); iecResult := SysTarget.SysTargetGetVendorName(ADR(wName),ADR(udiNameLength)); iecResult := SysTarget.SysTargetGetVersion(ADR(dwVersion)); udiOsInfo := SysTarget.SysTargetGetOperatingSystemId(ADR(udiOsInfo));
- Start the project.
Compare: