Skip to content
PDF

First Steps with CODESYS and the MFN 100#

This chapter will give you an introduction on how to start working with the integrated soft PLC in the MFN 100. First, some configuration and installation of files and libraries are required.

Note

  • Please download the CODESYS Development System V3 from store.codesys.com for this chapter.
    We recommend version 3.5 SP14 (32 bit) or newer.
  • Please connect your workstation to the console port (P1) of the MFN 100.

Installing the Device Descriptions#

After you have downloaded and installed the CODESYS Development System on your workstation, you have to install the device descriptions of the MFN 100 and the SIMATIC ET200 SP I/O module in the CODESYS Development System. The device descriptions have the following filenames:

MFN 100 Nerve_MFN_100_V3.5.XX.X.devdesc.xml
SIMATIC ET200 SP GSDML-V2.34-Siemens-ET200SP-20180926.xml

XX.X stands for the current version of the CODESYS Development System. The device descriptions of the MFN 100 and the SIMATIC ET200 SP I/O module have been sent as part of the delivery.

Please remember where you have saved the device description for the following steps.

  1. Start the CODESYS Development System.
  2. Go to Tools > Device Repository.

    !Device repository

  3. Click Install.

    !Install device description

  4. Go to the directory of the previously downloaded device description.

  5. Select the device description of the MFN 100.
  6. Click Open.
  7. Repeat steps 3 to 6 to install the device description SIMATIC ET200 SP I/O module.

When the installation was successful, the MFN 100 and the SIMATIC ET200 SP I/O module will appear in the list of device descriptions in the middle of the window and you can close the window.

!Device description installed

After installing the device description you can start working with the CODESYS Development System. However, libraries and device descriptions of generic devices might be missing so that the CODESYS Development System can work properly. The following chapters will walk you through the download process.

Downloading Missing Libraries#

The error message for missing libraries might appear when you open or create a CODESYS project. The CODESYS Development System identifies the missing libraries automatically but you may have to repeat the following process a few times.

!Missing libraries error message

  1. Open or create a CODESYS project.
  2. If the error message about missing libraries appears, click OK.
  3. Double-click Library Manager in the tree view on the left.
  4. Click Download missing libraries.

    !Library Manager

  5. Click Download in the new window.

    !Downloading libraries

  6. Click Close when the download is finished.

  7. Repeat steps 3 to 5 until no more libraries appear in the download window.

Downloading Missing Device Descriptions#

Apart from the device description for the MFN 100 that you have installed manually before, device descriptions of generic devices may be missing for the CODESYS Development System to function as intended. The CODESYS Development System will identify the missing device descriptions automatically but this time it will not generate an error message unless you try to load a CODESYS application into the MFN 100.

  1. Click Tools > Device Repository.
  2. Click Download missing descriptions.

    !Missing device descriptions

    Note

    If no device descriptions of generic devices are missing, the button for downloading missing descriptions will not appear.

  3. Click Download in the new window.

  4. Click Close when the download is finished.

Creating a New CODESYS Project#

This example shows how to create a new project in the CODESYS Development System. The easiest way to get started is to create a Standard project.

  1. Start CODESYS
  2. Go to File > New Project.
  3. Click Standard project on the right side among the templates.
  4. Enter a name for the project.
  5. Choose a Location where the project will be saved.
  6. Click OK to save the project.

    !New Project

  7. Select Nerve_MFN_100 (TTTech) as the device.

    !MFN 100

  8. Click OK.

The result is an empty project that is open in the main view of CODESYS.

!Empty Project

Working with the Default Applications#

If you wish to work with existing applications first, you can modify the default applications app1.project and app2.project. They have been sent as part of the delivery.

  1. Start CODESYS.
  2. Go to File > Open Project.
  3. Select the location where you have downloaded the default applications.
  4. Select the application you want to work with.

    !Default Applications

  5. Click Open.

If you are opening the default applications for the first time, some libraries and device descriptions will be missing. Follow the instructions above to see how to download the missing files. 

Connecting to the MFN 100#

Before you can download CODESYS applications to the MFN 100, please make sure that the device description of the MFN 100 is installed in the CODESYS Development System.

  1. Open or create a CODESYS project.
  2. Double-click Device (Nerve_MFN_100) in the tree view on the left.
  3. Go to Communication Settings > Scan network....

    !Scan network

  4. Select the MFN 100 (here nerve-rtvm [XXXX.XXXX]) in this window.

    !nerve-rtvm

    Note

    When more than one network is active on your workstation, it sometimes happens that the MFN 100 cannot be found. Please continue reading if the MFN 100 does not appear in this window.

  5. Click OK.

Typically the MFN 100 will be found automatically. If the MFN 100 cannot be found, you have to enter the IP address and port of the CODESYS runtime manually.

  1. Double-click Device (Nerve_MFN_100) in the tree view on the left.
  2. Go to Communication Settings in the middle of the window.
  3. Enter 172.20.2.2:11740 in the text box under the device on the right.

    !Connecting manually

  4. Press Enter.

The CODESYS Development System is now connected to the MFN 100 and you can download applications into the CODESYS runtime.

Downloading an Application to the MFN 100#

You can load CODESYS applications directly into the MFN 100. However, before you can download an application into the MFN 100 it needs to be free of errors.

The process of downloading an application is slightly different if you are downloading an entirely new application into the MFN 100 or if you are updating an application that has already been downloaded into the MFN 100. If you are updating an application that you have downloaded to the MFN 100 before, please continue with Downloading an Updated Application to the MFN 100 further down below.

Downloading a New Application to the MFN 100#

Once you have created a project and you are finished with programming, you can download the CODESYS application to the MFN 100 directly.

  1. Open the CODESYS project you want to load into the MFN 100.
  2. Click the Login symbol in the CODESYS menu bar.

    !Login symbol

  3. Click Yes in the pop-up window.

    !Confirm application download

  4. The application is stopped now. Click the Play symbol in the CODESYS menu bar.

    !Play symbol

The application is now loaded to the MFN 100.

Downloading an Updated Application to the MFN 100#

If you update an application after you have loaded it into the MFN 100, you need to download it into the MFN 100 again. The download process is slightly different from downloading a new application into the MFN 100.

  1. Stop the CODESYS application that you have loaded into the MFN 100 through the local UI.
  2. Click the Logout button in the CODESYS toolbar.

    !Logout button

  3. Expand Device (Nerve_MFN_100) > PLC Logic > Application.

  4. Double-click PLC_Program (PRG).
  5. Perform your changes.
  6. Click the Login symbol in the CODESYS menu bar.

    !Login symbol

  7. In the pop-up window, select one of the options.

    !Pop-up window options

    Item Description
    Login with online change. The updated application will be loaded into the MFN 100. Variable values will not be reset. If the application was running before, it will be running after the download.
    Login with download. The updated application will be loaded into the MFN 100. Variable values will be reset. The application is stopped.
    Login without any change. The updated application will not be loaded into the MFN 100 but the code will keep your changes.
  8. Click OK.

The application is now loaded to the MFN 100.

Note

For more help with programming PLC applications in the CODESYS Development System go to help.codesys.com.

Allocating Variables to Inputs or Outputs#

After connecting new sensors and actuators, you need to assign variables to the I/O channel in CODESYS.

  1. Open a CODESYS project.
  2. Expand Device (Nerve_MFN_100) > PLC Logic > Ethernet_1 > PN_Controller > siemenset200 (IM 155-6 PN ST V4.1) in the tree structure on the left.
  3. Double-click DI_8x24VDC_ST_V0_0_QI (...) for digital inputs.
    Double-click DQ_8x24VDC_0_5A_ST_V0_0_QI (...) for digital outputs.
  4. Select PNIO Module I/O Mapping.

    !Variable Allocation

  5. Fully expand the tree view.

  6. Double-click the variable slot you would like to assign.

    Note

    The inputs in this view do not match the physical inputs of the I/O module on the kit. The inputs here go from 0 to 7. The physical inputs go from 1 to 8. Therefore input 0 in this view represents the physical input 1 on the I/O module. This also applies to outputs.

  7. Click the three dots next to the variable slot.

    !Ellipsis menu

  8. Expand Application > GVL in the new window.

    !Global Variables

  9. Select the variable you would like to assign.

    Note

    Please make sure to select a variable of the same type as the input, i.e., a BOOL variable for a BOOL input or output.

  10. Click OK.

You can use the assigned variables to read data from connected sensors or to control actuator functionality.

Note

For more help with programming PLC applications in the CODESYS Development System go to help.codesys.com.