AbstractAcquirer_Temperature.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Uestc.Auto6.Dso.Hardware.Driver
  5. {
  6. public class AbstractAcquirer_Temperaturer : AbstractAcquirer
  7. {
  8. internal override void Init()
  9. {
  10. #if !Product_B21_JinHui_PXI
  11. HdIO.WriteReg(PcieBdReg.W.SysMon_Reset, 0);
  12. HdIO.WriteReg(PcieBdReg.W.SysMon_Reset, 1);
  13. HdIO.WriteReg(PcieBdReg.W.SysMon_Reset, 0);
  14. #else
  15. #endif
  16. }
  17. internal override void InitAcq()
  18. {
  19. }
  20. private Int32 readbackData = 0;
  21. internal override bool ReadAcqData()
  22. {
  23. #if !Product_B21_JinHui_PXI
  24. UInt32 data = (HdIO.ReadReg(PcieBdReg.R.SysMon_ReadData) >> 8) & 0xffff;
  25. readbackData = (Int32)data;
  26. #else
  27. #endif
  28. return true;
  29. }
  30. /// <summary>
  31. /// 读取以摄氏度为单位的温度传感器数据。
  32. /// </summary>
  33. /// <param name="whichSensor">第几个传感器,目前只有一个。</param>
  34. /// <returns></returns>
  35. public virtual double ReadByCentigrade(int whichSensor = 0)
  36. {
  37. return readbackData * 1.0 / 10;
  38. }
  39. }
  40. }