RS485Config.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using MV485.helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace MV485.model
  8. {
  9. //485参数配置
  10. public class RS485Config
  11. {
  12. //public string DeviceType { get; set; }
  13. //public string DeviceSn { get; set; }
  14. // 波特率设定值对应表
  15. public byte BaudRateType {get; set; }
  16. public int BaudRateName => Tools.GetBaudRate(BaudRateType);
  17. // 校验方式 (40244, F3H)
  18. // 0 - 无校验
  19. // 1 - 奇校验
  20. // 2 - 偶校验 (默认)
  21. // 3 - 校验位为 1
  22. // 4 - 校验位为 0
  23. public byte ParityCheckType { get; set; }
  24. public string ParityCheckName
  25. {
  26. get
  27. {
  28. return Tools.GetParityCheck(ParityCheckType);
  29. }
  30. }
  31. // 停止位设定 (40245, F4H)
  32. // 0 - 1 个停止位 (默认)
  33. // 1 - 2 个停止位
  34. public byte StopBitsType { get; set; }
  35. public string StopBitsName => Tools.GetStopBits(StopBitsType);
  36. }
  37. }