Modbus.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace NModbus
  2. {
  3. /// <summary>
  4. /// Defines constants related to the Modbus protocol.
  5. /// </summary>
  6. internal static class Modbus
  7. {
  8. public const int MaximumDiscreteRequestResponseSize = 2040;
  9. public const int MaximumRegisterRequestResponseSize = 127;
  10. // modbus slave exception offset that is added to the function code, to flag an exception
  11. public const byte ExceptionOffset = 128;
  12. // default setting for number of retries for IO operations
  13. public const int DefaultRetries = 3;
  14. // default number of milliseconds to wait after encountering an ACKNOWLEGE or SLAVE DEVIC BUSY slave exception response.
  15. public const int DefaultWaitToRetryMilliseconds = 250;
  16. // default setting for IO timeouts in milliseconds
  17. //public const int DefaultTimeout = 1000;
  18. public const ushort CoilOn = 0xFF00;
  19. public const ushort CoilOff = 0x0000;
  20. // IP slaves should be addressed by IP
  21. public const byte DefaultIpSlaveUnitId = 0;
  22. //// An existing connection was forcibly closed by the remote host
  23. //public const int ConnectionResetByPeer = 10054;
  24. // Existing socket connection is being closed
  25. //public const int WSACancelBlockingCall = 10004;
  26. // used by the ASCII tranport to indicate end of message
  27. public const string NewLine = "\r\n";
  28. }
  29. }