Migration CIFX Application to netHOST [EN]

Introduction

When changing from CIFX to netHost, the excisting application can be reused.

Nevertheless, a few adjustments need be de done to migrate a CIFX application to netHOST.

Those will be described below


Requirement

For this guide, you need Visual Studio.

Migration step by step

  1. Download the latest netX Diagnostic and Remote Access, you can download the latest version here.

  2. Unzip the netX Diagnostic and Remote Access 20xx-xx-xx file to the location that you chose.

  3. Open the netXTransport.sln in Visual Studio. You can find the solution under ..\netX Diagnostic and Remote Access 20xx-xx-xx\20xx-xx-xx\netXTransport\Sources\Host\netXTransportDLL\DLLProject\


    Figure 1: netXTransport.sln in Visual Studio 2022

  4. If compilation fails, and the following error appears: 
    netXTransport_x32.rc(10): fatal error RC1015: cannot open include file 'afxres.h'.

    For this case, please check if you have installed vc++ feature, especially the MFC support with your Visual Studio version.

    Open your Visual Studio Installer → click on Modify → select C++ MFC for latest build tools (x86 & x64)

    Figure 2: VS installer click on Modify


    Figure 3: Select C++ MFC for latest <your version> build tools (x86 & x64) and click on Modify.

  5. Restart the netXTransport.sln project and make sure your build platform is Win32. Build the project.

    Figure 4: Select Win32 platform.
     
    When the compiling is done, you can find in the current path of the project a dist file. Under ..\dist\Win32\Debug 2 files are needed netXTransport.dll and netXTransport.lib also the plugins folder is needed.

    Figure 5: Generated DLL and LIB.

  6. Copy the netXTransport.dll and netXTransport.lib into your application folder or in that location where your cifX32DLL.lib is linked.
    Rename the netXTransport.lib to cifX32DLL.lib and replace the old cifX32DLL.dll with it.

    Please find more information about the netXTransport.dll here: https://hilscher.atlassian.net/wiki/display/CIFXDRV/netX+Diagnostic+and+Remote+Access

  7. Add the plugins folder into your application folder. There are all the needed connectors for USB and TCP connection.

  8. The board name of the netHOST is different in your application. 
    Now in your application code, rename "cifX0" to "TCP0_cifX0". The name has to be changed in every function that needs it, e.g "xChannelOpen()".

  9. A netHOST is occupying a communication channel for the TCP/IP LAN interface, one for the Real-Time Ethernet or fieldbus network depending on the model and one for administrative purposes.

    The most relevant channel number to continue accessing a netHOST are the following:

    For netHOST PROFIBUS Master, CANopen Master and DeviceNet Master the fieldbus communication channel number is : 1

    For netHOST PROFINET Controller, EtherCAT Master and EtherNet/IP Scanner the Real-Time Ethernet communication channel number is : 0

  10. Initialize the driver and configure the connectors. (netX Diagnostic and Remote Access - Host Device PR 03 EN.pdf).

  11. The application has to be newly compiled.