⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ofxplcdev.h

📁  ?  plc 与上位机通信接口 帮助有需要的人
💻 H
字号:
// OFxPLCDev.h: interface for the COFxPLCDev class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OFXPLCDEV_H__D81DB75C_00BA_4975_9E03_35F428FDF70F__INCLUDED_)
#define AFX_OFXPLCDEV_H__D81DB75C_00BA_4975_9E03_35F428FDF70F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Comm.h"

#ifndef STX
#define STX   0x02
#endif

#ifndef ETX
#define ETX   0x03
#endif

#ifndef ENQ
#define ENQ   0x05
#endif

#ifndef ACK
#define ACK   0x06
#endif

#ifndef NAK
#define NAK   0x15
#endif
#ifndef S_retstruct
#define S_retstruct
struct  _retstruct
{
	int		code;
	CString discription;
	CTime   time;
};
#endif

class AFX_EXT_CLASS COFxPLCDev : public CComm  
{
public:
	COFxPLCDev();
	virtual ~COFxPLCDev();

public:

	int InitDev(CString  strReg, _retstruct *_ret);



//
public:
	int read_one(_retstruct* _ret, int istation, char &value);
	int force_off(_retstruct *_ret, int istation);
	int force_on(_retstruct* _ret, int istation);
	int SetSpeed(_retstruct *_ret, int iStation, int Speed);
	int GetSpeed(_retstruct *_ret, int istation, int &Speed);
	int SendENQ(_retstruct *_ret);

//
protected:

	int get_response(BYTE *ibuf, int ilen, BYTE *rbuf, int &rlen, _retstruct *_ret);

	int check_sum(BYTE *buf, int& buflen, BYTE &chSum);
};
#endif // !defined(AFX_OFXPLCDEV_H__D81DB75C_00BA_4975_9E03_35F428FDF70F__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -