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

📄 visacomm.h

📁 压力控制器通讯源代码
💻 H
字号:
/******************************************************************************/
/* File:        VISACOMM.H                                                    */
/*                                                                            */
/* Class:       cCommunications                                               */
/* Author:      Alaster Jones                                                 */
/* Description: Encapsulate the VISA functionality aimed at comms. protocol   */
/*              more specific to pressure instruments. Hide some of the VISA  */
/*              stuff as it's a bit farty.                                    */
/* Date:        02/03/01                                                      */
/******************************************************************************/
//---------------------------------------------------------------------------
#ifndef VISACommH
#define VISACommH

#include "visa.h"

//---------------------------------------------------------------------------

enum COMMSTYPE
{
    NOCOMMS = -1,
    IEEE488 = 0,
    RS232
};

enum STOPBITS
{
    eNone   =   VI_ASRL_PAR_NONE,
    eOdd    =   VI_ASRL_PAR_ODD,
    eEven   =   VI_ASRL_PAR_EVEN,
    eMark   =   VI_ASRL_PAR_MARK,
    eSpace  =   VI_ASRL_PAR_SPACE
};

enum PARITY
{
    eOneBit         =   VI_ASRL_STOP_ONE,
    eOneandHalfBit  =   VI_ASRL_STOP_ONE5,
    eTwoBit         =   VI_ASRL_STOP_TWO
};

enum FLOWCONTROL
{
    eFlowNone   =   VI_ASRL_FLOW_NONE,
    eXonXoff    =   VI_ASRL_FLOW_XON_XOFF,
    eRTSCTS     =   VI_ASRL_FLOW_RTS_CTS,
    eDTRDSR     =   VI_ASRL_FLOW_DTR_DSR
};

// global definition of the SRQ handler call back
ViStatus    _VI_FUNCH SRQHandler(ViSession vi, ViEventType etype, ViEvent event, ViAddr userHandle);

//---------------------------------------------------------------------------
class cCommunications
{
public:
    cCommunications();
    ~cCommunications();

    long    findResources(void);
    long    openCommsChannel(char * strChannel);
    long    closeCommunications(void);

    virtual long Initialisation(void);

    long    setSerial(ULONG baudRate, USHORT dataBits, STOPBITS stopBits, PARITY parity, FLOWCONTROL flowControl);
    long    setIEEE(void);

    long    setTimeout(long timeout);
    long    setTerminationChar(bool bEnabled);

    short   getnumResources(void){return numResources;};
    char *  getResources(UCHAR resourceNum){return strResources[resourceNum];};

    ULONG   instr;      // instrument connection session

    ViUInt32    rtnCount;
    ViUInt32    wrtCount;

    COMMSTYPE getCommsType(void){return commsType;};
//	ULONG	getInstr(void){return instr);

private:
    // find resources parameters
    char    strResources[10][50]; // resources found list
    char    instrDescriptor[100]; //VI_FIND_BUFLEN];

    short   numResources;

    ViFindList  findList;

    ULONG   defaultRM;  // default resource manager session
//    ULONG   instr;      // instrument connection session

    ViUInt32    numInstrs;
    COMMSTYPE   commsType;
};
#endif

⌨️ 快捷键说明

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