Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Over time we have converged to a reliable way to download code to Beckhoff PLC (local or remote runtimes). The key steps are listed below:

Beckhoff code development Beckhoff code development and modification happens on two applications:

  • TwinCAT PLC Control
    This is the IDE for code development. Code projects are opened as *.pro file and editing is allowed in any of the standard IEC-61131 languages (Structured Text, Ladder Logic etc.). Compiling and downloading to PLC runtime is also done from here.

  • TwinCAT System Manager
    This is the tool for configuring hardware and linking code variables to I/O terminals.

Over time we have converged to a reliable way to download code to Beckhoff PLC (local or remote runtimes). The key steps are listed below:

  1. Clean Project
    After performing necessary modifications to project in TwinCAT PLC Control click Project → Clean All. This command executes the cleanup process which deletes the compile information (compile log) that enables online change. After cleanup online change is not possible without a full rebuild and download. The command pops up a series of dialog boxes to lead through the process

    Image Added


    Image Added


    It’s always a good idea to perform a clean rebuild and download after code modification. On the second popup asking to leave Configuration unchanged press ‘Yes’ if no variables are to be linked to hardware. This is the most common case. Pressing ‘No’ breaks the hardware configuration and requires code rescan in System Manager.

  2. Compile Project
    Click Project → Rebuild All. This command compiles all the components of the project including the new changes. The results window shows the compile results (shown below for the case where we pressed ‘Yes’). If you pressed ‘No’ on the previous step proceed straight to the ‘Download’ operation in Step 6.

    Image Added


    Notice the warning indicating missing VAR_CONFIG. This indicates the need to rescan and reactivate project on the PLC using System Manager.

  3. Rescan Project
    The rescan operation happens in the System Manager. Launch System Manager and open the file currently linked to the project in question. Navigate to the project under ‘PLC - Configuration’ in the explorer window and click the ‘Rescan’ button. This operation inducts the newly added “addressed” variables into the System Manager configuration so that they could be attached to hardware I/O terminals.

    Image Added


    At this point it’s a good idea to confirm that the rescan didn’t disturb your existing hardware links. In the figure below the hardware links are indicated by the small arrows next to the hardware I/O terminal.

    Image Added

  4. Activate Configuration

    1. The rescanned configuration is now saved and the next step is to activate it on the PLC. Click on the ‘Activate’ button in the menu bar.

      Image Added


    2. Restart to ‘Run’ mode when prompted. Hard stops will move.

      Image Added


    3. The target PLC cycles through ‘TimeOut’ and then back to ‘Run’ mode. Check the PLC status in the status bar.

      Image Added


      Image Added


  5. Recompile Project
    Return to PLC Control and repeat the compile project. Click Project → Rebuild All. This time the project should compile without the VAR_CONFIG errors.

  6. Download Project

    1. Go to Online → Choose Runtime and select the target PLC.

      Image Added


    2. Then click Online → Login. You’ll be prompted to download project to the target runtime. Hard stops will move.

      Image Added


    3. After successful download, click Online → Reset All.

      Image Added


    4. After reset go back to ‘Run’ mode by clicking Online → Run. Hard stops will move.

  7. Create Boot Project and Restart
    At this point the PLC is up and running with the modified code.

    1. Proceed to create bootproject via Online → Login followed by Online → Create Bootproject. This creates a bootable copy of the running project (bootproject) on the Target PLC. This is necessary for the PLC to be able to boot up to the right project after a power-cycle.

    2. Finally, restart the target PLC via System Manager as shown below. Ensure that the PLC comes back up in ‘Run’ mode in the status bar.

      Image Added