QT5串口读取宇电温控器温度

分享到:
admin • 2020-03-20 15:26 来源:原创 EG0

  宇电温控器AI5.X系列

  类库运转情况:win10+qt5+vs2017

  类说明:TempControl,供给获得以后温控器温度值,PV,SV,MV等值,调用私有函数接口,取得前去值。

  附带测试用例

  #ifndef _TEMPCONTROL_H_

  #define _TEMPCONTROL_H_

  #pragma execution_character_set("utf-8")

  #include

  #include

  #include

  #include

  #include

  #include

  #include

  #include

  using namespace std;

  class TempControl : public QObject

  {

  Q_OBJECT

  public:

  TempControl(QString portName,

  QIODevice::OpenModeFlag mode,

  qint32 baudRate,

  QSerialPort::DataBits dataBits,

  QSerialPort::Parity parity,

  QSerialPort::FlowControl flowControl,

  QSerialPort::StopBits stopBits);

  ~TempControl();

  int Init();

  void deinit();

  void printHex(QByteArray cmd);

  float getCrtTemp();

  float getTemp();//获得以后温度

  float getProNum();

  float getSc();

  float getCrtTempTime();

  float getSpr();

  float getStepNum();

  float getPonp();

  float getPaf();

  float getStepState();

  float getPonTime();

  float getAt(); //自整定

  void setTemp( float Val, float CrtVal, int Proid=0 , int AddressIde=1 );

  void setSc(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setProNum(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setCrtTempTime(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setSPr(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setStepNum(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setPonP(float Val, float CrtVal, int Proid=0, int AddressIde=1);// 上电控制参数 Cont,

  void setPaf(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void setStepState(float Val, float CrtVal, int Proid=0, int AddressIde=1);

  void SetAt(int AtVal, int Proid , int AddressIde );

  private:

  QString portName;

  QIODevice::OpenModeFlag mode;

  qint32 baudRate;

  QSerialPort::DataBits dataBits;

  QSerialPort::Parity parity;

  QSerialPort::FlowControl flowControl;

  QSerialPort::StopBits stopBits;

  QSerialPort *m_serialport;

  void delayMs(int value);

  int send(QByteArray &cmd);

本文来源前瞻网,转载请注明来源!(图片来源互联网,版权归原作者所有)

p23q0

分享:
标签:
J

意见
反馈

×