Skip to main content

Opening a V2.3 Project

Tip

A CoDeSys V2.3 project can be converted only with a 32-bit version of CODESYS V3. To do this, the CODESYS V2.3 Converter package has to be installed in CODESYS V3. The package is available in the CODESYS Store International.

If you are working with a 64-bit version of CODESYSV3, then you also need to install the 32-bit version for the conversion. After the conversion, you can open the project in CODESYS 64-bit.

Requirement: You have installed and started CODESYS V3. The CODESYS V2.3 Converter add-on is installed.

  1. Click File → Open Project.

  2. In the Open Project dialog, click any CoDeSys V2.3 project or project archive in the file system. For searching, you can set the file filter on the bottom right corner of the dialog.

    If another project is still open, CODESYS instructs you to close it accordingly. After that the CoDeSys V2.3 converter starts automatically.

  3. The V2.3 converter checks that the project can be compiled without errors. If so, then it processes the project automatically.

  4. NOTE:

    If the project contains visualization objects with placeholder variables that the converter cannot resolve, the respective visualizations are shown as a group in place of the visualization references.

  5. Device conversion: When a device (target system) is referenced in the project to be opened and no conversion rules are defined for the device, then the Device Conversion dialog opens. Specify here whether and how the converter should replace the previous device reference with a current one.

    For replacement, the converter added the new device in the place of the old one in the device tree of the converted project.

  6. Library conversion: if a library, for which no conversion rule has so far been defined, is referenced in the project to be opened, then the Conversion of Library Reference dialog opens. Specify here whether and how the converter should replace the existing library reference with a current one.

    If you select a library for which the project information is missing, then the Enter Project Information dialog opens in order to specify this information.

    The converter loads the adapted project. Note: The recently defined library references can be found in the Global Library Manager located in the POUs view.

Restrictions when reusing a CoDeSys V2.3 project in CODESYS

Compilation

The project has to be compilable without errors in CoDeSys V2.3. Note: CODESYS stills issues warnings in V3 when compiling. These are caused by implicit conversions, which can lead to a loss of information (for example through sign changes).

CODESYS V3 checks "case" statements against the switch variable: CASE USINT OF INT is not checked in CoDeSys V2.3, but it issues an error message when imported into V3.

Controller configuration

The Controller Configuration of a CoDeSys V2.3 project cannot be imported into V3. You need to create the device configuration again and declare the variables used in the controller configuration again.

Network Variables

For network variables, CODESYS creates V3 GVL objects and imports the variable declarations. However, the network properties are not imported. See the description of the network variable exchange for this.

Libraries

All variables and constants that are used in a library also have to be declared in the library. It has to be possible to compile the library in CoDeSys V2.3 without errors.

Syntactic and semantic restrictions since CoDeSys V2.3

  • FUNCTIONBLOCK is not a valid keyword instead of FUNCTION_BLOCK.

  • TYPE (declaration of a structure) must be followed by a ":".

  • ARRAY initialization** must have parentheses.

  • INI is no longer supported (you need to replace this in the code by the Init method).

  • In function calls it is no longer possible to mix explicit with implicit parameter assignments. Therefore the order of the parameter input assignments can be changed:

    fun(formal1 := actual1, actual2); // -> error message

    fun(formal2 := actual2, formal1 := actual1); // same semantics as the following line:

    fun(formal1 := actual1, formal2 := actual2);

  • CoDeSys V2.3 pragmas are not converted. They produce an warning in V3.

  • The TRUNC operator now converts to the data type DINT instead of INT. CODESYS automatically adds a corresponding type conversion for a CoDeSys V2.3 import.

Visualization

Placeholders and their replacement

  • Placeholder: PLC_PRG.$LocalVar$.aArr[0]

    VAR_INPUT: localVar: MyStruct;

    Usage: localVar.aArr[0]

    Substitution: localVar := PLC_PRG.myStructVar

  • Placeholder: $Var$.aArr[0]

    VAR_INPUT: Var : MyStruct;

    Usage: Var.aArr[0]

    Substitution: Var := PLC_PRG.myStructVar

  • Placeholder: PLC_PRG.myStructVar.aArr[$Index$]

    VAR_INPUT: Index : INT;

    Usage: PLC_PRG.myStructVar.aArr[Index]

    Substitution: Index := 0

Problematic placeholders

  • Placeholders within a text

    Text: $axle$-Axis

    Correction:

    localVar : STRING;

    Text: %s-Axis

    Text variable: localVar

  • Placeholder describes only one part of a variable name

    axis$axis$spur$spur$.fActPosition

    Correction:

    Define only one placeholder for the axis$axis$spur$spur$ placeholder.

    axis_spur : MyFunctionBlock;

    Then directly transfer the corresponding instance of the function block.

    axis_spur := PLC_PRG.axis1spur2;

  • Placeholder is replaced by an expression

    $Expression$ -> PLC_PRG.var1 + PLC_PRG.var2

    Correction:

    You need to transfer the expression to an auxiliary variable and then transfer this auxiliary variable as an instance.

  • Placeholder describes a program name: $Program$.bToggle - PLC_PRG.bToggle D

    The converter cannot transfer this form of setting placeholders in V3. However, you will rarely use it in practice.

  • Placeholder is replaced by different types:

    $Var$

    -> Replacement 1 : PLC_PRG.n (INT)

    -> Replacement 2 : PLC_PRG.st (STRING)

    Correction:

    Define two different placeholders in the interface for this.

  • The visualization is located in a library. You replace the placeholder later from any desired project when you use the visualization there.

    Correction:

    Here you need to replace the TYPE_NONE data types manually. However, there is also the possibility for you to integrate the library in a project and the placeholder is correctly replaced. If you now import this project, the data type is also determined correctly in the library.

Non-importable elements

Trend, ActiveX: Importing is not possible because the implementation differs considerably. In V3, a corresponding warning is issued and a corresponding manual reproduction is required.

Programming languages: ST, IL, FBD

No restrictions

Programming language: LD

CODESYS imports function blocks with parallel branches in such a way that the part before the branch is repeated for each branch. This corresponds to the generated code which CoDeSys V2.3 creates for parallel branches.

_cds_img_v23import_ld_example.png

Programming language: SFC

  • Step variables explicitly declared by the user must be declared locally in the SFC editor. You may not declare them as VAR_INPUT, VAR_OUTPUT or VAR_INOUT, because CODESYS cannot automatically adapt the calls. Explanation: Steps no longer use Boolean variables for the management of the internal states in V3, but also structures of the type SFCStepType.

  • Identifier: the following identifiers may not begin with an underscore character:

    • Names of IEC actions in the tree

    • Variables that are called in an IEC association list

    • Names of transitions that have been programmed out

Explanation: In V3, the implicit variables which CODESYS creates for actions are given an underscore character as prefix. An invalid identifier with a double underscore character would result.

Programming language: CFC

  • Large boxes: The layout of large boxes can lose quality due to an import. The boxes may overlap one another too much. (Correction planned.)

  • Macros: Macros cannot be imported. (Correction planned.)