Modbus Software, Driver and Libraries
 Login 
Member of Modbus Organization

Want to know more?

Your Email:

Your Enquiry:


We accept VISA, MasterCard, PayPal

30-day Money-Back Guarantee

This Application Note describes how to integrate the FieldTalk Modbus library and driver into a .NET Visual Studio 2005 project.

visualstudio.png
Prerequisites
  • Visual Studio 2005 Standard or Professiona

  • To target Windows CE 5.0 you need the Windows CE: Standard Software Development Kit installed.

  • To target Windows Mobile 5.0 you need the Windows Mobile 5.0 SDK for Pocket PC installed.

  • To target Windows Mobile 6 you need the Windows Mobile 6 Development Kit installed.

  • FieldTalk Modbus Master .NET for Visual Basic & C# version 2.4 or higher

Tip Above mentioned development kits can be downloaded from Microsoft.

Installation

  1. Download and save the zip archive into a project directory.

  2. Uncompress the archive using unzip or another zip tool of your choice:

    unzip FT-MBMP-DLL-ALL.2.4.0.zip

The archive will create the following directory structure in your project directory:

My Projects
   fieldtalk
      doc
      src
      lib
      samples

Library architecture

FieldTalk Modbus Master .NET consists of two components: a .NET Library Assembly and a Modbus Core Driver.

FieldTalk .NET Library Architecture

The .NET Library Assembly implements the FieldTalk Modbus API and it's class libraries for the .NET languages Visual Basic .NET and C#. The .NET Library Assembly is contained in the file mbusmaster.net.dll.

The Modbus functionality is implemented as native code in the Modbus Core Driver and contained in the file libmbusmaster.dll.

Both components are required to execute your Modbus application and must be available in the executable search path. We recommend to deploy both DLLs into the same directory as the application executable file.

Adding the .NET library assembly

Launch Visual Studio 2005. Open an existing .NET project where you want to add Modbus functionality or create a new .NET Modbus project. You can choose any language supported by the .NET and Visual Studio environment but FieldTalk's example code and API documentation is focusing on Visual Basic and C#.

In the Solution Explorer Window, right-click on References and select the Add Reference… sub-menu.

addrefmenu.png

A file selection dialog opens. Click on the Browse tab and traverse to the FieldTalk lib directory. Then double-click on the directory named after the .NET framework version you are writing your Modbus application for.

addref1.png
lib Directory Framework Version
net1.1 .NET Framework Version 1.1
net2.0 .NET Framework Version 2.0 and 3.0
netcf1.0 .NET Compact Framework Version 1.0
netcf2.0 .NET Compact Framework Version 2.0

Descent further in the directory hierarchy by double-clicking on the Release directory and finally select the file mbusmaster.net.dll which contains the .NET Library Assembly.

addref2.png

Click OK to confirm. The .NET Library Assembly has now been added to your project and is shown in the References list in the Solution Explorer Window. You can now start adding Modbus functions from the FieldTalk API to your application.

refadded.png
Important The .NET Library Assembly allows your Modbus application to compile and link, but to execute an additional component is required: To run your Modbus application, you need to make available the file libmbusmaster.dll, which contains the Modbus Core Driver.

Adding the Modbus core driver DLL for automatic deployment

To add the Modbus Core Driver libmbusmaster.dll for automatic deployment, right-click in the Solution Explorer Window on your Application, select the Add sub-menu and then the Existing Item… sub-menu.

addexistingitemmenu.png

A file selection dialog opens. In the Files of type field select Executable Files (*.exe; *.dll; *.ocx) as shown below.

addexistingitem1.png

Traverse to the FieldTalk lib directory. Then double-click on the directory named after the Windows version you are writing your Modbus application for.

Directory Windows Version
windll Windows 32-bit
win64dll Windows 64-bit
wcedll Windows CE, Pocket PC, Windows Mobile
addexistingitem2.png

If you are targetting Windows CE, Pocket PC, Windows Mobile and have chosen wcedll, then you must also select a sub-directory matching your CPU and target platform.

addexistingitem3.png

Decent further in the directory hierarchy by double-clicking on the release directory and select the file libmbusmaster.dll which contains the Modbus Core Driver. This DLL contains native Modbus code compiled specifically for your target CPU and platform. Then click on the drop-down arrow of the Add button and choose Add As Link.

addaslink.png

Right-click on the newly added libmbusmaster.dll entry in your project tree and select the Properties sub-menu.

linkpropertiesmenu.png

The Properties window shows the settings for the newly added item libmbusmaster.dll. Click on Copy to Output Directory and select the Copy always entry in the drop-down box.

linkpropertiesdialog.png

The Modbus Core Driver libmbusmaster.dll has been added as an external reference and will be deployed together with your main application executable file and the .NET Library Assembly DLL file.

finished.png

proconX and FieldTalk are trademarks of proconX Pty Ltd. All other product and brand names mentioned in this document may be trademarks or registered trademarks of their respective owners.

Disclaimer

proconX Pty Ltd makes no warranty for the use of its products, other than those expressly contained in the Company's standard warranty which is detailed in the Terms and Conditions located on the Company's Website. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of proconX are granted by the Company in connection with the sale of proconX products, expressly or by implication. proconX products are not authorized for use as critical components in life support devices or systems.

Support & product feedback

We provide an electronic support and feedback system for our FieldTalk products. It can be accessed through the following web link:

Your feedback and comments are always welcome. It helps improving this product.

Contact

For further information about this document please contact us at:

proconX Pty Ltd PO Box 791 Sumner QLD 4074 Australia Website: http://www.proconx.com