/// <summary>
        /// 实例化一个Modbus Tcp的服务器,支持数据读写操作
        /// </summary>
        public ModbusTcpServer( )
        {
            Coils                = new bool[65536];
            Register             = new byte[65536 * 2];
            hybirdLockCoil       = new SimpleHybirdLock( );
            hybirdLockRegister   = new SimpleHybirdLock( );
            lock_trusted_clients = new SimpleHybirdLock( );

            subscriptions         = new List <ModBusMonitorAddress>( );
            subcriptionHybirdLock = new SimpleHybirdLock( );
            byteTransform         = new ReverseWordTransform( );
        }
        /// <summary>
        /// 实例化一个Modbus Tcp的服务器,支持数据读写操作
        /// </summary>
        public ModbusTcpServer( )
        {
            // 四个数据池初始化,线圈,输入线圈,寄存器,只读寄存器
            coilBuffer          = new SoftBuffer(DataPoolLength);
            inputBuffer         = new SoftBuffer(DataPoolLength);
            registerBuffer      = new SoftBuffer(DataPoolLength * 2);
            inputRegisterBuffer = new SoftBuffer(DataPoolLength * 2);

            subscriptions         = new List <ModBusMonitorAddress>( );
            subcriptionHybirdLock = new SimpleHybirdLock( );
            ByteTransform         = new ReverseWordTransform( );
            WordLength            = 1;

            serialPort = new SerialPort( );
        }
Beispiel #3
0
 /// <summary>
 /// 指定服务器地址,端口号,客户端自己的站号来初始化
 /// </summary>
 /// <param name="station">客户端自身的站号</param>
 public ModbusRtu(byte station = 0x01)
 {
     ByteTransform = new ReverseWordTransform( );
     this.station  = station;
 }
Beispiel #4
0
 /// <summary>
 /// 实例化一个MOdbus-Tcp协议的客户端对象
 /// </summary>
 public ModbusRtu( )
 {
     ByteTransform = new ReverseWordTransform( );
 }
 public ReverseWordTransformTest( )
 {
     byteTransform = new ReverseWordTransform( );
 }