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

📄 driver.h

📁 研华工控卡PCL836的一些例程序
💻 H
字号:
//--------------------------------------------------------------------------d
//
//     PCL-836 Header Define
//
//--------------------------------------------------------------------------

#define ULONG  unsigned long  // Range of Values 0 to 4294967295
#define USHORT unsigned short // Range of Values 0 to 65535
#define DWORD  unsigned long  // Range of Values 0 to 4294967295
#define FLOAT  float          // Range of Values 3.4E +/- 38 (7 digits)

#define MaxCounterNumber  5    // The PCL-836 have six counters.
#define MaxBoardNumber    9    // Supports 10 pieces PCL-836 at the same time
#define MaxDioNumber      1    // The PCL-836 have two digin in/out port
#define MaxPWMNumber      2    // The PCL-836 have three PWM numbers

#define MAX1_65K          0    // its range is from   1HZ  to 65KHZ
#define MAX10K_650K       1    // its range is from 10KHZ  to 650KHZ
#define MAX100K_6500K     2    // its range is from 100KHZ to 6500KHZ

#define F100HZ            100
#define F10HZ             10
#define F1HZ              1
#define F0_1HZ            0.1

/**************************************************************************
    Define Error Code
***************************************************************************/
#define MaxErrorCode             9
#define SUCCESS                  0
#define DrvErrorCode             0
#define InvalidDeviceNumber      (DrvErrorCode + 1)
#define InvalidBaseAddr          (DrvErrorCode + 2)
#define DeviceIsBusy             (DrvErrorCode + 3)
#define LostBaseAddr             (DrvErrorCode + 4)
#define InvalidCounterChannel    (DrvErrorCode + 5)
#define InvalidInputParam        (DrvErrorCode + 6)
#define FreqMeasurementFailed    (DrvErrorCode + 7)
#define InvalidFreqRange         (DrvErrorCode + 8)
#define InvalidPortChannel       (DrvErrorCode + 9)

extern ULONG DeviceOpen(USHORT DeviceNumber, USHORT BaseAddr);
extern ULONG DeviceClose(USHORT DeviceNumber);

extern ULONG CounterConfig(USHORT DeviceNumber, USHORT counter,
                           USHORT CounterEdge, FLOAT MaxInFreq);
extern ULONG CounterPulseStart(USHORT DeviceNumber, USHORT Counter,
                              FLOAT Period, FLOAT UpCycle);
extern ULONG CounterEventStart(USHORT DeviceNumber, USHORT counter);
extern ULONG CounterEventRead(USHORT DeviceNumber, USHORT counter,
                              USHORT *Overflow, ULONG *Count);
extern ULONG CounterFreqStart(USHORT DeviceNumber, USHORT counter);
extern ULONG CounterFreqRead(USHORT DeviceNumber, USHORT counter,
                             USHORT FreqLevel, FLOAT *Freq);
extern ULONG CounterReset(USHORT DeviceNumber, USHORT counter);
extern ULONG FreqOutStart(USHORT DeviceNumber, USHORT counter, FLOAT FOUT);
extern ULONG FreqOutReset(USHORT DeviceNumber, USHORT counter);
extern ULONG DioReadPortByte(USHORT DeviceNumber, USHORT Port, USHORT *Value);
extern ULONG DioWritePortByte(USHORT DeviceNumber, USHORT Port,
                              USHORT Mask, USHORT State);
extern ULONG DioReadBit(USHORT DeviceNumber, USHORT Port,
                        USHORT Bit, USHORT *State);
extern ULONG DioWriteBit(USHORT DeviceNumber, USHORT Port,
                         USHORT Bit, USHORT State);
extern ULONG DioGetCurrentDOByte(USHORT DeviceNumber, USHORT Port,
                                 USHORT *Value);
extern ULONG DioGetCurrentDOBit(USHORT DeviceNumber, USHORT Port,
                                USHORT Bit, USHORT *State);

// Error Code Listing
// InvalidDeviceNumber   "DeviceNumber is out of range ,its range is
//                        from 0 to 9."
// InvalidBaseAddr       "Invalid Base Address."
// DeviceIsBusy          "This DeviceNumber is in use !"
// LostBaseAddr          "Invalid Base Address, DeviceOpen must be called
//                        before any other functions. "
// InvalidCounterChannel "Illegal Channel"
// InvalidInputParam     "Illegal Input Param"
// FreqMeasurementFailed "The freqence of calling the function is too high."
// InvalidFreqRange      "FOUT frequency is out of range "
// InvalidPortChannel    "Invalid Port Channel"



⌨️ 快捷键说明

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