C#

VisualStudio.NET C# (Visual Studio 2010/2012/2013)

Programming of the sample programs is explained based on Visual Studio 2012. The procedure for Visual Studio 2010/2013 is similar.

The programs require the library MdpNetApi.dll., which can be found in the respective installation directory of the IPC diagnostics.

C# 1:

64-bit Windows

Prerequisites for creating 64-bit application programs with the library MdpNetApi.dll:

MDP from v1.0.7.06 and Beckhoff Automation Device Driver from v1.22.1.0

If older versions of MDP or the Beckhoff Automation Device Driver are used, the application program must be compiled for 32 bits, since these library and driver versions are only designed for 32-bit programs. (An application program compiled for 32 bits can be used on a 64-bit system.)

The implementation of the sample code in user programs is explained below. The description is based on the simplest option in Visual Studio, i.e. configuration of a console application.

Creating a new console application in Visual Studio

1. Under File > New, select the command Project to create a new console application.
The New Project dialog opens.
2. In the overview on the left, select Templates > Other Languages > Visual C#, then select Console Application in the overview on the right. Enter a name for the project.
C# 2:
TwinCAT creates a new console application.
3. Right-click References and select the command Add References from the context menu that opens.
C# 3:
The Reference Manager dialog opens.
4. Enter the file name MdpNetApi.dll and confirm with OK.
C# 4:
The library MdpNetApi.dll can be found in the IPC diagnostics installation directory (default: C:\Program Files (x86)\Beckhoff\IPC-Diagnostics).
The file is entered as a new reference.
C# 5:
5. Right-click on the project (here: SampleDocumentation) and select Properties from the context menu that opens to select the target platform.
C# 6:
A configuration window opens.
6. Select the Build category and select "x86" or "x64" from the Platform target drop-down list, depending on the target platform. Select "x86" (= 32-bit) as target platform, if the requirements for 64-bit (see above) are not met.
C# 7:
7. Incorporate the program code of the example. To do this, copy the code from the sample program to the default file Program.cs. Replace the whole default program code highlighted below with the sample code.
C# 8:
The program can now be compiled and tested.