Exemplo n.º 1
0
        /// <summary>
        /// Sends a message to slave. Does not wait for any data to be returned.
        /// </summary>
        /// <param name="messageFrame">Contains address and message to send.</param>
        public void SendMessage(MessageFrame messageFrame)
        {
            ushort[] message = messageFrame.GetMessageFrameInShorts();

            _master.WriteMultipleRegisters((byte)messageFrame.TargetSlaveAddress,
                                           (ushort)HoldingRegisterStartAddress, message);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Broadcasts message to all slaves in range.
 /// </summary>
 /// <param name="messageFrame">Message frame containing function code and the data to send.</param>
 public void BroadcastMessage(MessageFrame messageFrame)
 {
     ushort[] message = messageFrame.GetMessageFrameInShorts();
     //0 is the broadcast "address"
     _master.WriteMultipleRegisters(0, (ushort)HoldingRegisterStartAddress, message);
 }