예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config">Configuration structure</param>
 public ModbusLinkRtu(ModbusConfiguration config)
 {
     // Init serial port driver
     PHY = new ModbusSerialPort(config);
     // Init link layer thread
     LinkThread = new Thread(ModbusRtuLinkTask);
     // Configure frame timing and set handler
     ConfigureTiming(config.BaudRate);
     FramingTimer.OnTimeout += FramingTimeoutHandler;
 }
예제 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config">Configuration structure</param>
 public ModbusLinkAscii(ModbusConfiguration config)
 {
     // Init serial port driver
     PHY = new ModbusSerialPort(config);
     // Init link layer thread
     LinkThread = new Thread(ModbusAsciiLinkTask)
     {
         Name     = "Modbus Link Layer Thread",
         Priority = ThreadPriority.Normal
     };
     // Configure timeout timer
     TimeoutCounter.Interval  = 1000;
     TimeoutCounter.AutoReset = false;
     TimeoutCounter.Elapsed  += TimeoutHandler;
 }