Modbus read/write (0x17) function

A

Thread Starter

Avijit Paul

I am trying to create a profile header into an unit at a particular
address with C#, but I get the error message: The operation is timed
out. My is as below:-

<b>moderator's note: space below is to make sure ad does not cover code.</b>
<pre>


















ushort[] ustNewData = {0x4350,0x436F,0x6C6F, 0x7374, 0x7275, 0x6D20,
0x4E6F, 0x726D, 0x616C, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001,
0x0004, 0x4561,0x0000, 0x0000, 0x0001 };

SerialPort spPort = new SerialPort();
spPort.BaudRate = 19200;
spPort.ReadTimeout = 2000;
spPort.WriteTimeout = 2000;
spPort.Handshake = Handshake.XOnXOff;

ModbusSerialMaster mb;
mb =
ModbusSerialMaster.CreateRtu(spPort);
if (!spPort.IsOpen) spPort.Open();
try
{
profile_no = mb.ReadWriteMultipleRegisters(1, (ushort)0x2006, (ushort)1, (ushort)0x2006, ustNewData);
}
catch (Exception ex)
{

System.Windows.Forms.MessageBox.Show("Error " + ex.Message);
}</pre>
This also fails for TCP/IP or ASCII cases.
 
L

Lynn August Linse

First things first, most Modbus devices do NOT support read/write function 0x17. So can you confirm that your device does support it?
 
Top