示例#1
0
        public void startServer()
        {
            EasyModbus.ModbusServer modbusServer = new EasyModbus.ModbusServer();
            modbusServer.Listen();
            modbusServer.HoldingRegistersChanged += new EasyModbus.ModbusServer.HoldingRegistersChangedHandler(holdingRegistersChanged);
            Console.ReadKey();

            modbusServer.StopListening();
        }
示例#2
0
        public void startServer()
        {
            EasyModbus.ModbusServer modbusServer = new EasyModbus.ModbusServer();
            modbusServer.MqttRootTopic     = "examplemodbusserver";
            modbusServer.MqttBrokerAddress = "www.mqtt-dashboard.com";
            modbusServer.Listen();
            modbusServer.HoldingRegistersChanged += new EasyModbus.ModbusServer.HoldingRegistersChangedHandler(holdingRegistersChanged);
            Console.ReadKey();

            modbusServer.StopListening();
        }
示例#3
0
        public void startServer()
        {
            EasyModbus.ModbusServer modbusServer = new EasyModbus.ModbusServer();
            modbusServer.SerialPort     = "COM3";
            modbusServer.UnitIdentifier = 1;
            modbusServer.Baudrate       = 9600;

            modbusServer.Listen();
            modbusServer.holdingRegistersChanged += new EasyModbus.ModbusServer.HoldingRegistersChanged(holdingRegistersChanged);
            Console.ReadKey();
            modbusServer.StopListening();
        }