public void startServer() { EasyModbus.ModbusServer modbusServer = new EasyModbus.ModbusServer(); modbusServer.Listen(); modbusServer.HoldingRegistersChanged += new EasyModbus.ModbusServer.HoldingRegistersChangedHandler(holdingRegistersChanged); Console.ReadKey(); modbusServer.StopListening(); }
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(); }
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(); }