Hi,
When i I run the simple code below, I got an error as per attached screen shot.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using EasyModbus;
namespace EasyModbus { class Program { static void Main(string[] args) { ModbusClient modbusClient = new ModbusClient("192.168.254.128", 502); //Ip-Address and Port of Modbus-TCP-Server modbusClient.Connect(); //Connect to Server //modbusClient.WriteMultipleCoils(4, new bool[] { true, true, true, true, true, true, true, true, true, true }); //Write Coils starting with Address 5 //bool[] readCoils = modbusClient.ReadCoils(9, 10); //Read 10 Coils from Server, starting with address 10 int[] readHoldingRegisters = modbusClient.ReadHoldingRegisters(3500, 10); //Read 10 Holding Registers from Server, starting with Address 1
// Console Output //for (int i = 0; i < readCoils.Length; i++) // Console.WriteLine("Value of Coil " + (9 + i + 1) + " " + readCoils[i].ToString()); for (int i = 0; i < readHoldingRegisters.Length; i++) Console.WriteLine("Value of HoldingRegister " + (i + 1) + " " + readHoldingRegisters[i].ToString()); modbusClient.Disconnect(); //Disconnect from Server Console.Write("Press any key to continue . . . "); Console.ReadKey(true); } }
}
I can't figure out what that means. Please assist.
https://www.dropbox.com/s/lgv9w4xwrkpkd6h/easymodbus%20error.jpg.pdf?dl=0
Anonymous
You seem to have CSS turned off. Please don't fill out this field.
Hi,
When i I run the simple code below, I got an error as per attached screen shot.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EasyModbus;
namespace EasyModbus
{
class Program
{
static void Main(string[] args)
{
ModbusClient modbusClient = new ModbusClient("192.168.254.128", 502); //Ip-Address and Port of Modbus-TCP-Server
modbusClient.Connect(); //Connect to Server
//modbusClient.WriteMultipleCoils(4, new bool[] { true, true, true, true, true, true, true, true, true, true }); //Write Coils starting with Address 5
//bool[] readCoils = modbusClient.ReadCoils(9, 10); //Read 10 Coils from Server, starting with address 10
int[] readHoldingRegisters = modbusClient.ReadHoldingRegisters(3500, 10); //Read 10 Holding Registers from Server, starting with Address 1
}
I can't figure out what that means. Please assist.
https://www.dropbox.com/s/lgv9w4xwrkpkd6h/easymodbus%20error.jpg.pdf?dl=0