NModbus on Mono

390 views
Skip to first unread message

Arwen

unread,
May 13, 2008, 2:43:59 AM5/13/08
to NModbus
Someone has already tried to run NModbus on Mono ?
Do you think that a port is possible?

Thanks to all ;-)

Arwen

unread,
May 13, 2008, 5:59:43 AM5/13/08
to NModbus
Excuse me but I have only seen now the Victor's post So "NModbus works
with Mono".

http://groups.google.com/group/NModbus-discuss/browse_thread/thread/17c3bad8bc149c82/9b7a8aa7381e576d?lnk=gst&q=mono#9b7a8aa7381e576d

Now I can start playing with mono.
I want to develop with on a Ubuntu 8.04 so which version of mono I
should install?
I can develop using the latest version of NModbus?

Thanks

Arwen

unread,
May 14, 2008, 9:00:51 AM5/14/08
to NModbus
IHELP !

I don't know if it is correct but for install NMODBUS on mono will be
sufficient use the shell command below ??

shell:

gacutil FTD2XX.dll
gacutil FtdAdapter.dll
gacutil log4net.dll
gacutil Modbus.dll

Thanks


>On 13 Mag, 11:59, Arwen <aria.france...@gmail.com> wrote:
> Excuse me but I have only seen now the Victor's post So "NModbus works
> with Mono".
>
> http://groups.google.com/group/NModbus-discuss/browse_thread/thread/1...
>
> Now I can start playing with mono.
> I want to develop with on a Ubuntu 8.04 so which version of mono I
> should install?
> I can develop using the latest version of NModbus?
>
> Thanks
>
> On 13 Mag, 08:43, Arwen <aria.france...@gmail.com> wrote:
>
>
>
> > Someone has already tried to run NModbus on Mono ?
> > Do you think that a port is possible?
>
> > Thanks to all ;-)- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -

Victor Rocha

unread,
May 14, 2008, 9:00:59 PM5/14/08
to NModbus...@googlegroups.com
hello arwen

i think you should try the latest mono release (1.9) as it should be
more stable and complete. There is a binary installer for any linux
distribution in mono's site. I have used NModbus with mono 1.2.6, and
it worked. In fact I used an older version of NMODBUS which was C# 2.0
(now it is C# 3.0).

I think even the latest version should now run in mono, but in case
you have problems, try downloading an older release... or report your
adventures here to the list :-)

by the way, the nmodbus i used here didn't use the FTD drivers. and
there was no need to "gacutil" the log4net and modbus, in fact i just
place them in the same application directory.


wish you success :-)

victor

Arwen

unread,
May 15, 2008, 5:55:13 AM5/15/08
to NModbus
I made some tests and I had no need to use gacutil but I simply
copied the DLL version 1.6 of NModbus in a folder of the
project , then I added the reference in my project and
I can compile all without errors .
I tried to create a C# project for both console that GTK
and both seem to work
(I have not yet had time to test whether applications actually
communicate but do not give strange errors).

I'm using UBUNTU 8.04 and I installed MONO from official
Ubuntu repos so I have :

Mono Develop 1.0
Mono JIT compiler 1.2.6 (mono-V)

Now I'll try to establish a serial communication with a
process instruments that usually I use .

Thank you
I will tell you the result, hopefully positive.

PS.
I did the tests compiling the TESTDRIVER.cs source for the console
version .
For GTK version I used the same source, of course modified to work
with an event button.

On 15 Mag, 03:00, "Victor Rocha" <rocha.pu...@gmail.com> wrote:
> hello arwen
>
> i think you should try the latest mono release (1.9) as it should be
> more stable and complete. There is a binary installer for any linux
> distribution in mono's site. I have used NModbus with mono 1.2.6, and
> it worked. In fact I used an older version of NMODBUS which was C# 2.0
> (now it is C# 3.0).
>
> I think even the latest version should now run in mono, but in case
> you have problems, try downloading an older release... or report your
> adventures here to the list :-)
>
> by the way, the nmodbus i used here didn't use the FTD drivers. and
> there was no need to "gacutil" the log4net and modbus, in fact i just
> place them in the same application directory.
>
> wish you success :-)
>
> victor
>
>
>
> On Tue, May 13, 2008 at 6:59 AM, Arwen <aria.france...@gmail.com> wrote:
>
> >  Excuse me but I have only seen now the Victor's post So "NModbus works
> >  with Mono".
>
> >  http://groups.google.com/group/NModbus-discuss/browse_thread/thread/1...
>
> >  Now I can start playing with mono.
> >  I want to develop with on a Ubuntu 8.04 so which version of mono I
> >  should install?
> >  I can develop using the latest version of NModbus?
>
> >  Thanks
>
> >  On 13 Mag, 08:43, Arwen <aria.france...@gmail.com> wrote:
> >  > Someone has already tried to run NModbus on Mono ?
> >  > Do you think that a port is possible?
>

Arwen

unread,
May 15, 2008, 11:32:53 AM5/15/08
to NModbus
First step OK !!

I can open the serial port but on Linux must do this :

using ( SerialPort port = new SerialPort("/dev/ttyS0")) // for COM1
and ttyS1 for COM2
{
...................
...................

and now I try to contact my slave ;-))
> > - Mostra testo tra virgolette -- Nascondi testo tra virgolette -

Arwen

unread,
May 15, 2008, 12:00:21 PM5/15/08
to NModbus
HEUREKA !!!!!!!! it works fine

I can communicate without any problem with an ASCON J1 type indicator
of temperature
www.ascon.it .
This library is a spectacle.

This is my simple code and for the moment THANKS TO ALL .

// MainWindow.cs created with MonoDevelop
// User: franaria at 11:21 15/05/2008
//
// To change standard headers go to Edit->Preferences->Coding-
>Standard Headers
//
using System;
using System.Diagnostics;
using System.IO.Ports;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Gtk;
using Modbus.Device;

public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
}

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}

protected virtual void Butt1Start (object sender, System.EventArgs e)
{
try
{
using (SerialPort port = new SerialPort("/dev/ttyS0"))
{
Console.WriteLine("I am in the procedure");
//configure serial port
port.BaudRate = 9600;
port.DataBits = 8;
port.Parity = Parity.None;
port.StopBits = StopBits.One;
Console.WriteLine("Port configured");
port.Open();
Console.WriteLine("Port opened");
// create modbus master
IModbusSerialMaster master = ModbusSerialMaster.CreateRtu(port);
byte slaveID = 1;
ushort startAddress = 1;
ushort numRegisters = 5;

// read registers
ushort[] registers =
master.ReadHoldingRegisters(slaveID,startAddress,numRegisters);

Console.WriteLine("==================================================");
Console.WriteLine("Serial test");
Console.WriteLine("==================================================");
for (int i = 0;i < numRegisters;i++)
Console.WriteLine("Register {0}={1}",startAddress +
i,registers[i]);

Console.WriteLine("==================================================");
}
}
catch (Exception ec)
{
Console.WriteLine(ec.Message);
Console.WriteLine("Test by ARWEN");
}
}
}


On 15 Mag, 11:55, Arwen <aria.france...@gmail.com> wrote:
> > - Mostra testo tra virgolette -- Nascondi testo tra virgolette -
Reply all
Reply to author
Forward
0 new messages