Estoy usando este método, estoy teniendo dificulta.
int[] ReadWriteMultipleRegisters(int startingAddressRead, int quantityRead, int startingAddressWrite, int[] values)
Read/Write Multiple Registers (Function code 23).
startingAddressRead: First input register to read.
quantityRead: Number of input registers to read.
startingAddressWrite: First input register to write.
values: Values to write.
returns: Int Array which contains the holding registers [0..quantityRead-1].
Estoy teniendo un error al asignarle la variable int[] values
, me podrían ayudar.
Gracias.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EasyModbus;
namespace comunicacion_tcp
{
class Program
{
private string IpAddress = "192.168.178.111";
private int port = 502;
private ushort startAddres = 4352;
private ushort quantity = 1;
private ushort startAddres1 = 4353;
private int writeData;
private ModbusClient modbustcp;
public Program()
{
modbustcp = new ModbusClient(IpAddress, port);
modbustcp.Connect();
int[] response = modbustcp.ReadWriteMultipleRegisters( startAddres,quantity, startAddres1 , writeData);
modbustcp.Disconnect();
Console.WriteLine("value of input register 1" + response[0].ToString());
}
static void Main(string[] args)
{
Program _program = new Program();
Console.ReadKey();
}
}
}
writerData
asi:private int[] writeData;