Can you tell me with which software I can include the NModbus
implementation and in what way?
Thanx in advance,
With kind regards,
Caspar
Scott
Caspar
#using "Modbus.dll"
And I have copied the .dll file in the main project directory..
But I always get the message:
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option
I've no idea what I'm doing wrong..
On 21 aug, 16:27, "Scott Alexander" <sja...@gmail.com> wrote:
> http://support.microsoft.com/kb/310674
>
> On 8/21/07, caspar_het_sp...@hotmail.com <caspar_het_sp...@hotmail.com>
It sounds like you're selecting the wrong type of C++ project from
within Visual Studio. I don't know what version of Visual Studio you
have, but in VS 2005 (and 2008 Beta 2) Professional, in the "New
Project" dialog, "Visual C++" is an expandable tree node. If you click
the plus sign (or arrow on Vista) to expand the node, you should see
something like:
- ATL
- CLR
- General
- MFC
- Smart Device
- Win32
To reference NModbus in a C++ project, you want to select from the CLR
group of project types. This will enable the compiler switch (/clr)
required to reference the NModbus assembly.
Hope that helps, and good luck
Jacob.
- .NET
- ATL
- MFC
- Win32
- General
So I think I need a new(er) version of VS.. I hope I can get one and
then getting started :)
Kind regards,
Caspar
On 22 aug, 17:51, "Jacob Carpenter" <jacobcarpen...@gmail.com> wrote:
> caspar--
>
> It sounds like you're selecting the wrong type of C++ project from
> within Visual Studio. I don't know what version of Visual Studio you
> have, but in VS 2005 (and 2008 Beta 2) Professional, in the "New
> Project" dialog, "Visual C++" is an expandable tree node. If you click
> the plus sign (or arrow on Vista) to expand the node, you should see
> something like:
> - ATL
> - CLR
> - General
> - MFC
> - Smart Device
> - Win32
>
> To reference NModbus in a C++ project, you want to select from the CLR
> group of project types. This will enable the compiler switch (/clr)
> required to reference the NModbus assembly.
>
> Hope that helps, and good luck
> Jacob.
>
I always getting the following message:
An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in Unknown Module.
Additional information: Could not load file or assembly 'Modbus,
Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies.
What am I doing wrong this time?
Kind regards,
Caspar
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My code now:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "stdafx.h"
#include <iostream>
#include <string>
#using "Modbus.dll"
#using "log4net.dll"
using namespace std;
using namespace System;
using namespace System::Diagnostics;
using namespace System::IO::Ports;
using namespace System::Threading;
using namespace Modbus;
using namespace Modbus::Device;
void main()
{
SerialPort port("COM2");
// configure serial port
port.BaudRate = 9600;
port.DataBits = 8;
//port.Parity = Even;
//port.StopBits = StopBits.One;
port.Open();
// create modbus master
IModbusSerialMaster^ master;
//IModbusSerialMaster^ CreateRtu(port);
unsigned char slaveID = 10;
unsigned short startAddress = 10;
unsigned short registers = 5;
// write three registers
master->ReadHoldingRegisters(slaveID, startAddress, registers);
cin.get();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kind regards,
Caspar
#using "Modbus.dll"
#using "log4net.dll"
using namespace std;
cin.get();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I think I'm using a lot of function confusedly.. So I can see how it
works and build it to my own requirements..
On 27 aug, 11:36, caspar_het_sp...@hotmail.com wrote: