MWT925Helper.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Wit.SDK.Modular.Sensor.Utils
  7. {
  8. /// <summary>
  9. /// 9轴倾角传感器帮助类
  10. /// </summary>
  11. public class MWT925Helper
  12. {
  13. /// <summary>
  14. /// 解锁命令
  15. /// </summary>
  16. /// <returns></returns>
  17. public static byte[] Unlock(byte addr)
  18. {
  19. return Modbus16Utils.GetWrite(addr, 0x69, 0xB588);
  20. }
  21. /// <summary>
  22. /// 加计校准
  23. /// </summary>
  24. /// <returns></returns>
  25. public static byte[] AccelerationCalibration(byte addr)
  26. {
  27. return Modbus16Utils.GetWrite(addr, 0x01, 0x01);
  28. }
  29. /// <summary>
  30. /// 开始磁场校准
  31. /// </summary>
  32. /// <returns></returns>
  33. public static byte[] BeginFieldCalibration(byte addr)
  34. {
  35. return Modbus16Utils.GetWrite(addr, 0x01, 0x07);
  36. }
  37. /// <summary>
  38. /// 结束磁场校准
  39. /// </summary>
  40. /// <returns></returns>
  41. public static byte[] EndFieldCalibration(byte addr)
  42. {
  43. return Modbus16Utils.GetWrite(addr, 0x01, 0x00);
  44. }
  45. /// <summary>
  46. /// 波特率调整
  47. /// </summary>
  48. /// <returns></returns>
  49. public static byte[] SetBaudRate(byte addr, ushort value)
  50. {
  51. return Modbus16Utils.GetWrite(addr, 0x04, value);
  52. }
  53. /// <summary>
  54. /// 设置输出内容
  55. /// </summary>
  56. /// <param name="value"></param>
  57. /// <returns></returns>
  58. public static byte[] SetBackContent(byte addr, ushort value)
  59. {
  60. return Modbus16Utils.GetWrite(addr, 0x02, value);
  61. }
  62. // 带宽调整
  63. // 量程调整
  64. // 滤波参数
  65. }
  66. }