Visual studio C # and a PLC

0

How would you send the information to a specific PLC record from C # and how to identify that Registry?

I am using the EASYbodbus library

You are giving me an error I would like you to help me refer you:

EasyModbus.Exceptions.FunctionCodeNotSupportedException:
'Function code not supported by master'
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 = 0;
        private ushort quantity = 2;
        private ModbusClient modbustcp;
        public Program()
        {
            modbustcp = new ModbusClient(IpAddress, port);
            modbustcp.Connect();
            int[] response = modbustcp.ReadInputRegisters(startAddres, quantity);
            modbustcp.Disconnect();
            Console.WriteLine("value of input register 1" + response[0].ToString());
            Console.WriteLine("value of input register 2" + response[1].ToString());
        }
        static void Main(string[] args)
        {
            Program _program = new Program();
            Console.ReadKey();
        }
    }
}
    
asked by Geraldo Montas 14.08.2018 в 20:19
source

0 answers