📄 driver.pas
字号:
{ ************************************************************************ }
{ Define Transfer Mode }
{ ************************************************************************ }
POLLED_MODE = $0; { software transfer }
DMA_MODE = $1; { DMA transfer }
INTERRUPT_MODE = $2; { Interrupt transfer }
{ ************************************************************************ }
{ Define Acquisition Mode }
{ ************************************************************************ }
FREE_RUN = 0;
PRE_TRIG = 1;
POST_TRIG = 2;
POSITION_TRIG = 3;
{ ************************************************************************ }
{ Define Comparator's Condition }
{ ************************************************************************ }
NOCONDITION = 0;
LESS = 1;
BETWEEN = 2;
GREATER = 3;
OUTSIDE = 4;
{ ************************************************************************ }
{ Define Status Code }
{ ************************************************************************ }
SUCCESS = 0;
DrvErrorCode = 1;
KeErrorCode = 100;
DnetErrorCode = 200;
USBErrorCode = 500;
OPCErrorCode = 1000;
MemoryAllocateFailed = DrvErrorCode + 0;
ConfigDataLost = DrvErrorCode + 1;
InvalidDeviceHandle = DrvErrorCode + 2;
AIConversionFailed = DrvErrorCode + 3;
AIScaleFailed = DrvErrorCode + 4;
SectionNotSupported = DrvErrorCode + 5;
InvalidChannel = DrvErrorCode + 6;
InvalidGain = DrvErrorCode + 7;
DataNotReady = DrvErrorCode + 8;
InvalidInputParam = DrvErrorCode + 9;
NoExpansionBoardConfig= DrvErrorCode + 10;
InvalidAnalogOutValue = DrvErrorCode + 11;
ConfigIoPortFailed = DrvErrorCode + 12;
CommOpenFailed = DrvErrorCode + 13;
CommTransmitFailed = DrvErrorCode + 14;
CommReadFailed = DrvErrorCode + 15;
CommReceiveFailed = DrvErrorCode + 16;
CommConfigFailed = DrvErrorCode + 17;
CommChecksumError = DrvErrorCode + 18;
InitError = DrvErrorCode + 19;
DMABufAllocFailed = DrvErrorCode + 20;
IllegalSpeed = DrvErrorCode + 21;
ChanConflict = DrvErrorCode + 22;
BoardIDNotSupported = DrvErrorCode + 23;
FreqMeasurementFailed = DrvErrorCode + 24;
CreateFileFailed = DrvErrorCode + 25;
FunctionNotSupported = DrvErrorCode + 26;
LoadLibraryFailed = DrvErrorCode + 27;
GetProcAddressFailed = DrvErrorCode + 28;
InvalidDriverHandle = DrvErrorCode + 29;
InvalidModuleType = DrvErrorCode + 30;
InvalidInputRange = DrvErrorCode + 31;
InvalidWindowsHandle = DrvErrorCode + 32;
InvalidCountNumber = DrvErrorCode + 33;
InvalidInterruptCount = DrvErrorCode + 34;
InvalidEventCount = DrvErrorCode + 35;
OpenEventFailed = DrvErrorCode + 36;
InterruptProcessFailed= DrvErrorCode + 37;
InvalidDOSetting = DrvErrorCode + 38;
InvalidEventType = DrvErrorCode + 39;
EventTimeOut = DrvErrorCode + 40;
InvalidDmaChannel = DrvErrorCode + 41;
IntDamChannelBusy = DrvErrorCode + 42;
CheckRunTimeClassFailed= DrvErrorCode + 43;
CreateDllLibFailed = DrvErrorCode + 44;
ExceptionError = DrvErrorCode + 45;
RemoveDeviceFailed = DrvErrorCode + 46;
BuildDeviceListFailed = DrvErrorCode + 47;
NoIOFunctionSupport = DrvErrorCode + 48;
{ ------------------ V2.0b ------------------- }
ResourceConflict = DrvErrorCode + 49;
{ ------------------ V2.0b ------------------- }
{ ------------------ V2.1 ------------------- }
InvalidClockSource = DrvErrorCode + 50;
InvalidPacerRate = DrvErrorCode + 51;
InvalidTriggerMode = DrvErrorCode + 52;
InvalidTriggerEdge = DrvErrorCode + 53;
InvalidTriggerSource = DrvErrorCode + 54;
InvalidTriggerVoltage = DrvErrorCode + 55;
InvalidCyclicMode = DrvErrorCode + 56;
InvalidDelayCount = DrvErrorCode + 57;
InvalidBuffer = DrvErrorCode + 58;
OverloadedPCIBus = DrvErrorCode + 59;
OverloadedInterruptRequest = DrvErrorCode + 60;
{ ------------------ V2.0c ------------------- }
{ ------------------ V2.0c ------------------- }
ParamNameNotSupported = DrvErrorCode + 61;
{ ------------------ V2.0c ------------------- }
{ ------------------ V2.2B ------------------- }
CheckEventFailed = DrvErrorCode + 62;
{ ------------------ V2.2B ------------------- }
{ ------------------ V2.2C ------------------- }
InvalidPort = DrvErrorCode + 63;
DaShiftBusy = DrvErrorCode + 64;
{ ------------------ V2.2C ------------------- }
ThermoCoupleDisconnect = DrvErrorCode + 65;
KeInvalidHandleValue = KeErrorCode + 0;
KeFileNotFound = KeErrorCode + 1;
KeInvalidHandle = KeErrorCode + 2;
KeTooManyCmds = KeErrorCode + 3;
KeInvalidParameter = KeErrorCode + 4;
KeNoAccess = KeErrorCode + 5;
KeUnsuccessful = KeErrorCode + 6;
KeConInterruptFailure = KeErrorCode + 7;
KeCreateNoteFailure = KeErrorCode + 8;
KeInsufficientResources= KeErrorCode + 9;
KeHalGetAdapterFailure = KeErrorCode +10;
KeOpenEventFailure = KeErrorCode +11;
KeAllocCommBufFailure = KeErrorCode +12;
KeAllocMdlFailure = KeErrorCode +13;
KeBufferSizeTooSmall = KeErrorCode +14;
DNInitFailed = DnetErrorCode + 1;
DNSendMsgFailed = DnetErrorCode + 2;
DNRunOutOfMsgID = DnetErrorCode + 3;
DNInvalidInputParam = DnetErrorCode + 4;
DNErrorResponse = DnetErrorCode + 5;
DNNoResponse = DnetErrorCode + 6;
DNBusyOnNetwork = DnetErrorCode + 7;
DNUnknownResponse = DnetErrorCode + 8;
DNNotEnoughBuffer = DnetErrorCode + 9;
DNFragResponseError = DnetErrorCode + 10;
DNTooMuchDataAck = DnetErrorCode + 11;
DNFragRequestError = DnetErrorCode + 12;
DNEnableEventError = DnetErrorCode + 13;
DNCreateOrOpenEventError= DnetErrorCode + 14;
DNIORequestError = DnetErrorCode + 15;
DNGetEventNameError = DnetErrorCode + 16;
DNTimeOutError = DnetErrorCode + 17;
DNOpenFailed = DnetErrorCode + 18;
DNCloseFailed = DnetErrorCode + 19;
DNResetFailed = DnetErrorCode + 20;
USBTransmitFailed = USBErrorCode + 1;
USBInvalidCtrlCode = USBErrorCode + 2;
USBInvalidDataSize = USBErrorCode + 3;
USBAIChannelBusy = USBErrorCode + 4;
USBAIDataNotReady = USBErrorCode + 5;
{ define Windows message }
WM_USER = $400;
{ define user window message }
WM_ATODNOTIFY = WM_USER+200;
WM_DTOANOTIFY = WM_USER+201;
WM_DIGINNOTIFY = WM_USER+202;
WM_DIGOUTNOTIFY = WM_USER+203;
WM_MTNOTIFY = WM_USER+204;
WM_CANTRANSMITCOMPLETE= WM_USER+205;
WM_CANMESSAGE = WM_USER+206;
WM_CANERROR = WM_USER+207;
{ define the wParam in user window message }
AD_NONE = 0; { AD Section }
AD_TERMINATE = 1;
AD_INT = 2;
AD_BUFFERCHANGE = 3;
AD_OVERRUN = 4;
AD_WATCHDOGACT = 5;
AD_TIMEOUT = 6;
DA_TERMINATE = 0; { DA Section }
DA_DMATC = 1;
DA_INT = 2;
DA_BUFFERCHANGE = 3;
DA_OVERRUN = 4;
DI_TERMINATE = 0; { DI Section }
DI_DMATC = 1;
DI_INT = 2;
DI_BUFFERCHANGE = 3;
DI_OVERRUN = 4;
DI_WATCHDOGACT = 5;
DO_TERMINATE = 0; { DO Section }
DO_DMATC = 1;
DO_INT = 2;
DO_BUFFERCHANGE = 3;
DO_OVERRUN = 4;
MT_ATOD = 0; { MT Section }
MT_DIGIN = 1;
CAN_TRANSFER = 0; { CAN Section }
CAN_RECEIVE = 1;
CAN_ERROR = 2;
{ ************************************************************************ }
{ define thermocopule type J, K, S, T, B, R, E }
{ ************************************************************************ }
BTC = 4;
ETC = 6;
JTC = 0;
KTC = 1;
RTC = 5;
STC = 2;
TTC = 3;
{ ************************************************************************ }
{ define temperature scale }
{ ************************************************************************ }
C = 0; { Celsius }
F = 1; { Fahrenheit }
R = 2; { Rankine }
K = 3; { Kelvin }
{ ************************************************************************ }
{ define service type for COMEscape() }
{ ************************************************************************ }
EscapeFlushInput = 1;
EscapeFlushOutput = 2;
EscapeSetBreak = 3;
EscapeClearBreak = 4;
{ ************************************************************************ }
{ define gate mode }
{ ************************************************************************ }
GATE_DISABLED = 0; { no gating }
GATE_HIGHLEVEL = 1; { active high level }
GATE_LOWLEVEL = 2; { active low level }
GATE_HIGHEDGE = 3; { active high edge }
GATE_LOWEDGE = 4; { active low edge }
{ ************************************************************************ }
{ define input mode for PCL-833 }
{ ************************************************************************ }
DISABLE = 0; { disable mode }
ABPHASEX1 = 1; { Quadrature input X1 }
ABPHASEX2 = 2; { Quadrature input X2 }
ABPHASEX4 = 3; { Quadrature input X4 }
TWOPULSEIN = 4; { 2 pulse input }
ONEPULSEIN = 5; { 1 pulse input }
{ ************************************************************************ }
{ define latch source for PCL-833 }
{ ************************************************************************ }
SWLATCH = 0; { S/W read latch data }
INDEXINLATCH = 1; { Index-in latch data }
DI0LATCH = 2; { DI0 latch data }
DI1LATCH = 3; { DI1 latch data }
TIMERLATCH = 4; { Timer latch data }
DI2LATCH = 5; { DI2 latch data }
DI3LATCH = 6; { DI3 latch data }
{ ************************************************************************ }
{ define timer base mode for PCL-833 }
{ ************************************************************************ }
TPOINT1MS = 0; { 0.1 ms timer base }
T1MS = 1; { 1 ms timer base }
T10MS = 2; { 10 ms timer base }
T100MS = 3; { 100 ms timer base }
T1000MS = 4; { 1000 ms timer base }
{ ************************************************************************ }
{ define clock source for PCL-833 }
{ ************************************************************************ }
SYS8MHZ = 0; { 8 MHZ system clock }
SYS4MHZ = 1; { 4 MHZ system clock }
SYS2MHZ = 2; { 2 MHZ system clock }
SYS1MHZ = 3; { 1 MHZ system clock hailing}
{ ************************************************************************ }
{ define timer base mode for PCI 1784 hailing }
{ ************************************************************************ }
T50KHZ = 0; { 50 KHZ system clock }
T5KHZ = 1; { 5 KHZ system clock }
T500HZ = 2; { 500 HZ system clock }
T50HZ = 3; { 50 HZ system clock }
T5HZ = 4; { 5 HZ system clock }
{ ************************************************************************ }
{ define counter lock type for PCI 1784 hailing }
{ ************************************************************************ }
OVERFLOWLOCK = 0; { overflow lock counter }
UNDERFLOWLOCK = 1; { underflow lock counter }
OVERUNDERLOCK = 2; { overflow and underflow lock counter }
{ ************************************************************************ }
{ define counter indicator type for PCI 1784 hailing }
{ ************************************************************************ }
OVERCOMPLEVEL = $1; { over compare level indicator }
OVERCOMPPULSE = $2; { over compare pulse indicator }
UNDERCOMPLEVEL = $4; { under compare level indicator }
UNDERCOMPPULSE = $8; { under compare pulse indicator }
{ ************************************************************************ }
{ define cascade mode for PCL-833 }
{ ************************************************************************ }
NOCASCADE = 0; { 24-bit(no cascade) }
CASCADE = 1; { 48-bit(CH1, CH2 cascade) }
{ --------------------------- V2.0b -------------------------------------- }
{ ************************************************************************ }
{ define parameters for PCI-1780 }
{ ************************************************************************ }
{ define the counter mode register parameter}
PA_MODE_ACT_HIGH_TC_PULSE = $0000;
PA_MODE_ACT_LOW_TC_PULSE = $0001;
PA_MODE_TC_TOGGLE_FROM_LOW = $0002;
PA_MODE_TC_TOGGLE_FROM_HIGH = $0003;
PA_MODE_ENABLE_OUTPUT = $0004;
PA_MODE_DISABLE_OUTPUT = $0000;
PA_MODE_COUNT_DOWN = $0000;
PA_MODE_COUNT_UP = $0008;
PA_MODE_COUNT_RISE_EDGE = $0000;
PA_MODE_COUNT_FALL_EDGE = $0080;
PA_MODE_COUNT_SRC_OUT_N_M1 = $0100; { N_M1 means n minus 1}
PA_MODE_COUNT_SRC_CLK_N = $0200;
PA_MODE_COUNT_SRC_CLK_N_M1 = $0300;
PA_MODE_COUNT_SRC_FOUT_0 = $0400;
PA_MODE_COUNT_SRC_FOUT_1 = $0500;
PA_MODE_COUNT_SRC_FOUT_2 = $0600;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -