Пример #1
0
 // ------------------------------------------------------------------------
 /// <summary>Read holding registers from slave asynchronous. The result is given in the response function.</summary>
 /// <param name="id">Unique id that marks the transaction. In asynchonous mode this id is given to the callback function.</param>
 /// <param name="startAddress">Address from where the data read begins.</param>
 /// <param name="numInputs">Length of data.</param>
 public void ReadHoldingRegister(UInt16 myInvocationId, UInt16 startAddress, UInt16 numInputs)
 {
     WriteAsyncData(ModbusProtocol.CreateReadHeader(myInvocationId, startAddress, numInputs, FunctionCode.ReadHoldingRegister), myInvocationId);
 }
Пример #2
0
 // ------------------------------------------------------------------------
 /// <summary>Read coils from slave synchronous.</summary>
 /// <param name="myInvocationId">Unique id that marks the transaction. In asynchonous mode this id is given to the callback function.</param>
 /// <param name="myStartAddress">Address from where the data read begins.</param>
 /// <param name="myNumberOfCoils">Length of data.</param>
 /// <param name="values">Contains the result of function.</param>
 public void ReadCoils(UInt16 myInvocationId, UInt16 myStartAddress, UInt16 myNumberOfCoils, ref Byte[] values)
 {
     values = WriteSyncData(ModbusProtocol.CreateReadHeader(myInvocationId, myStartAddress, myNumberOfCoils, FunctionCode.ReadCoils), myInvocationId);
 }
Пример #3
0
 // ------------------------------------------------------------------------
 /// <summary>Read discrete inputs from slave synchronous.</summary>
 /// <param name="id">Unique id that marks the transaction. In asynchonous mode this id is given to the callback function.</param>
 /// <param name="startAddress">Address from where the data read begins.</param>
 /// <param name="numInputs">Length of data.</param>
 /// <param name="values">Contains the result of function.</param>
 public void ReadDiscreteInputs(UInt16 myInvocationId, UInt16 startAddress, UInt16 numInputs, ref Byte[] values)
 {
     values = WriteSyncData(ModbusProtocol.CreateReadHeader(myInvocationId, startAddress, numInputs, FunctionCode.ReadDiscreteInputs), myInvocationId);
 }
Пример #4
0
 // ------------------------------------------------------------------------
 /// <summary>Read input registers from slave asynchronous. The result is given in the response function.</summary>
 /// <param name="id">Unique id that marks the transaction. In asynchonous mode this id is given to the callback function.</param>
 /// <param name="startAddress">Address from where the data read begins.</param>
 /// <param name="numInputs">Length of data.</param>
 public void ReadInputRegister(UInt16 myReqestNumber, UInt16 myStartAddress, UInt16 myNumberOfInputs)
 {
     WriteAsyncData(ModbusProtocol.CreateReadHeader(myReqestNumber, myStartAddress, myNumberOfInputs, FunctionCode.ReadInputRegister),
                    myReqestNumber);
 }