United Kingdom:One Omega Drive, River Bend Technology Centre
ISO 9002 CertifiedNorthbank, Irlam, Manchester
M44 5BD United Kingdom
TEL: +44 (0)161 777 6611FAX: +44 (0)161 777 6622
Toll Free in United Kingdom: 0800-488-488
e-mail: sales@omega.co.uk
OMEGAnet®Online Service Internet e-mail
www.omega.com info@omega.com
It is the policy of OMEGA to comply with all worldwide safety and EMC/EMI regulations that
apply. OMEGA is constantly pursuing certification of its products to the European New Approach
Directives. OMEGA will add the CE mark to every appropriate device upon certification.
The information contained in this document is believed to be correct, but OMEGA Engineering, Inc. accepts
no liability for any errors it contains, and reserves the right to alter specifications without notice.
WARNING: These products are not designed for use in, and should not be used for, patient-connected applications.
The driver is a collection of DLLs for Windows 95/98/NT/2000/XP applications.
These DLLs are standard Win32 DLLs (32 bits) and can be called from Visual C/C++,
BC++, Visual BASIC, Delphi, BCB and LabVIEW.
These DLLs can perform a variety of data acquisition operations including:
z Get software version
z Initialization
z Digital Input/Output
z A/D conversion
z D/A conversion
5
1.1 Software Installation
Insert the CD ROM included with your OME-PCI-1602 board and the following
installation screen should auto-start.
Follow the instructions on the screen to complete the software installation. The
software is designed to support the entire OME family of data acquisition hardware, so
during the installation, you will be asked to specify your particular hardware (OME-
PCI-1602 board in this case). During the installation process, you will also be
prompted to enter the operating system you will be using.
After installation the following folders will be created on your computer.
6
Demo Folder
Contains all demonstration programs including their source codes. Examples are
provided for Visual C++, Borland C++, Visual Basic and Delphi.
Please note: The VC++ demos are developed with VC++ 4.0. After setting up the
environment, use NMAKE.EXE to compiling and link the demo code. For example,
C:\P1602\DEMO\VC\nmake /f demo1.mak
Driver Folder
Contains software drivers, include files and definition files for the programming
languages.
Manual Folder
Contains hardware user manuals, software user manuals and technical notes.
Diag Folder
Contains card diagnostic programs
Inf Folder
Contains tech notes and .INF file for the plug and play installation (only available for
operating systems that support plug and play).
1.2 Reference:
Please refer to the following user manuals for more information.
CallDll.pdf:
Calling the DLL with VB5, VC5, Delphi3, and BCB3.
ResCheck.pdf:
How to check the system resources.(IRQ, IO Port, and DMA)
PnPInstall.pdf:
Installing the information file (.inf ) under Windows 95/98/2000/XP with Plug & Play.
EXPORTS WORD CALLBACK P1602_AllocateMemory(HGLOBAL *hMem,
WORD *Buffer, DWORD dwSize);
EXPORTS WORD CALLBACK P1602_FreeMemory(HGLOBAL hMem);
EXPORTS WORD CALLBACK P1602_StartScanPostTrg(WORD wSampleRateDiv,
DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1602_StartScanPreTrg(WORD wSampleRateDiv,
DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1602_StartScanMiddleTrg(WORD
wSampleRateDiv, DWORD dwN1, DWORD dwN2, SHORT nPriority);
EXPORTS WORD CALLBACK P1602_StartScanPreTrgVerC(WORD
wSampleRateDiv, DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1602_StartScanMiddleTrgVerC(WORD
wSampleRateDiv, DWORD dwN1, DWORD dwN2, SHORT nPriority);
11
2.2 The P1602.BAS
Attribute VB_Name = "P1602"
Option Explicit
Global Const NoError = 0
Global Const DriverHandleError = 1
Global Const DriverCallError = 2
Global Const AdControllerError = 3
Global Const M_FunExecError = 4
Global Const ConfigCodeError = 5
Global Const FrequencyComputeError = 6
Global Const HighAlarm = 7
Global Const LowAlarm = 8
Global Const AdPollingTimeOut = 9
Global Const AlarmTypeError = 10
Global Const FindBoardError = 11
Global Const AdChannelError = 12
Global Const DaChannelError = 13
Global Const InvalidDelay = 14
Global Const DelayTimeOut = 15
Global Const InvalidData = 16
Global Const FifoOverflow = 17
Global Const TimeOut = 18
Global Const ExceedBoardNumber = 19
Global Const NotFoundBoard = 20
Global Const OpenError = 21
Global Const FindTwoBoardError = 22
Global Const ThreadCreateError = 23
Global Const StopError = 24
Global Const AllocateMemoryError = 25
12
Declare Function P1602_DriverInit Lib "P1602.dll" (wTotalBoards As Integer) As
Integer
Declare Sub P1602_DriverClose Lib "P1602.dll" ()
Declare Function P1602_GetDriverVersion Lib "P1602.dll" (wVxdVersion As
Integer) As Integer
Declare Function P1602_GetConfigAddressSpace Lib "P1602.dll" (ByVal wBoardNo
As Integer, wAddrTimer As Integer, wAddrCtrl As Integer, wAddrDio As Integer,
wAddrAdda As Integer) As Integer
Declare Function P1602_ActiveBoard Lib "P1602.dll" (ByVal wBoardNo As Integer)
As Integer
Declare Function P1602_WhichBoardActive Lib "P1602.dll" () As Integer
Declare Function P1602_M_FUN_1 Lib "P1602.dll" (ByVal wDaFrequency As
Integer, ByVal wDaWave As Integer, ByVal fDaAmplitude As Single, ByVal
wAdClock As Integer, ByVal wAdNumber As Integer, ByVal wAdConfig As Integer,
fAdBuf As Single, ByVal fLowAlarm As Single, ByVal fHighAlarm As Single) As
Integer
Declare Function P1602_M_FUN_2 Lib "P1602.dll" (ByVal wDaNumber As Integer,
ByVal wDaWave As Integer, wDaBuf As Integer, ByVal wAdClock As Integer,
ByVal wAdNumber As Integer, ByVal wAdConfig As Integer, wAdBuf As Integer)
As Integer
Declare Function P1602_M_FUN_3 Lib "P1602.dll" (ByVal wDaFrequency As
Integer, ByVal wDaWave As Integer, ByVal fDaAmplitude As Single, ByVal
wAdClock As Integer, ByVal wAdNumber As Integer, wChannelStatus As Integer,
wAdConfig As Integer, fAdBuf As Single, ByVal fLowAlarm As Single, ByVal
fHighAlarm As Single) As Integer
Declare Function P1602_M_FUN_4 Lib "P1602.dll" (ByVal wType As Integer,
ByVal wDaFrequency As Integer, ByVal wDaWave As Integer, ByVal fDaAmplitude
As Single, ByVal wAdClock As Integer, ByVal wAdNumber As Integer,
wChannelStatus As Integer, wAdConfig As Integer, fAdBuf As Single, ByVal
fLowAlarm As Single, ByVal fHighAlarm As Single) As Integer
Declare Function P1602_Di Lib "P1602.dll" (wDi As Integer) As Integer
Declare Function P1602_Do Lib "P1602.dll" (ByVal wDo As Integer) As Integer
Declare Function P1602_Da Lib "P1602.dll" (ByVal wDaChannel As Integer, ByVal
wDaVal As Integer) As Integer
Declare Function P1602_SetChannelConfig Lib "P1602.dll" (ByVal wAdChannel As
Integer, ByVal wConfig As Integer) As Integer
Declare Function P1602_AdPolling Lib "P1602.dll" (fAdVal As Single) As Integer
Declare Function P1602_AdsPolling Lib "P1602.dll" (fAdVal As Single, ByVal
13
wNum As Integer) As Integer
Declare Function P1602_AdsPacer Lib "P1602.dll" (fAdVal As Single, ByVal wNum
As Integer, ByVal wSample As Integer) As Integer
Declare Function P1602_ClearScan Lib "P1602.dll" () As Integer
Declare Function P1602_StartScan Lib "P1602.dll" (ByVal wSampleRate As Integer,
ByVal dwNum As Long, ByVal nPriority As Integer) As Integer
Declare Sub P1602_ReadScanStatus Lib "P1602.dll" (wStatus As Integer,
dwLowAlarm As Long, dwHighAlarm As Long)
Declare Function P1602_AddToScan Lib "P1602.dll" (ByVal wAdChannel As Integer,
ByVal wConfig As Integer, ByVal wAverage As Integer, ByVal wLowAlarm As
Integer, ByVal wHighAlarm As Integer, ByVal wAlarmType As Integer) As Integer
Declare Function P1602_SaveScan Lib "P1602.dll" (ByVal wOridinalOrder As
Integer, wBuf As Integer) As Integer
Declare Sub P1602_WaitMagicScanFinish Lib "P1602.dll" (wStatus
As Integer, wLowAlarm As Integer, _ wHighAlarm As Integer)
Declare Function P1602_StopMagicScan Lib "P1602.dll" () As Integer
Declare Function P1602_DelayUs Lib "P1602.dll" (ByVal wDelayUs As Integer) As
Integer
'------------------------ FunB series ---------------------------Declare Function P1602_FunB_Start Lib "P1602.dll" (ByVal wClockDiv As Integer,
wChannel As Integer, wConfig As Integer, Buffer As Integer,
ByVal dwMaxCount As Long, ByVal nPriority As Integer) As Integer
Declare Function P1602_FunB_ReadStatus Lib "P1602.dll" () As Integer
Declare Function P1602_FunB_Stop Lib "P1602.dll" () As Integer
Declare Function P1602_FunB_Get Lib "P1602.dll" (P0 As Long) As Integer
Declare Function P1602_Card0_StartScan Lib "P1602.dll" (ByVal wSampleRate As
Integer, wChannelStatus As Integer, wChannelConfig As Integer, ByVal wCount As
Integer) As Integer
Declare Function P1602_Card0_ReadStatus Lib "P1602.dll" (wBuf As Integer, wBuf2
As Integer, dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer
Declare Sub P1602_Card0_Stop Lib "P1602.dll" ()
Declare Function P1602_Card1_StartScan Lib "P1602.dll" (ByVal wSampleRate As
Integer, wChannelStatus As Integer, wChannelConfig As Integer, ByVal wCount As
Integer) As Integer
Declare Function P1602_Card1_ReadStatus Lib "P1602.dll" (wBuf As Integer, wBuf2
As Integer, dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer
Declare Sub P1602_Card1_Stop Lib "P1602.dll" ()
Declare Function GetTickCount Lib "kernel32" () As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Global AdBuf(10000) As Single
Global Channel(32) As Integer
Global ConfigCode(32) As Integer
14
Global Buf(10000) As Integer
Global Buf1(10000) As Integer
Global Buf2(10000) As Integer
Global Card0Buf0(10000) As Integer
Global Card0Buf1(10000) As Integer
Global Card1Buf0(10000) As Integer
Global Card1Buf1(10000) As Integer
Global AdNumber As Integer
Global CR
Global LF
15
2.3 The P1602.PAS
unit P1602;
interface
type PSingle=^Single;
type PWord=^Word;
const
// return code
NoError = 0;
DriverHandleError = 1;
DriverCallError = 2;
AdControllerError = 3;
M_FunExecError = 4;
ConfigCodeError = 5;
FrequencyComputeError = 6;
HighAlarm = 7;
LowAlarm = 8;
AdPollingTimeOut = 9;
AlarmTypeError = 10;
FindBoardError = 11;
AdChannelError = 12;
DaChannelError = 13;
InvalidDelay = 14;
DelayTimeOut = 15;
InvalidData = 16;
FifoOverflow = 17;
TimeOut = 18;
ExceedBoardNumber = 19;
NotFoundBoard = 20;
OpenError = 21;
FindTwoBoardError = 22;
ThreadCreateError = 23;
StopError = 24;
16
AllocateMemoryError = 25;
// Function of Test
function P1602_FloatSub2(fA:Single; fB:Single):Single ; stdCall;
function P1602_ShortSub2(nA:SmallInt; nB:SmallInt):SmallInt ; stdCall;
function P1602_GetDllVersion:WORD ; stdCall;
// Function of Driver
function P1602_DriverInit(Var wTotalBoards:Word):WORD ; stdCall;
procedure P1602_DriverClose; stdCall;
function P1602_GetDriverVersion(var wDriverVersion:Word):WORD ; stdCall;
function P1602_GetConfigAddressSpace(wBoardNo:Word;var wAddrTimer:Word;
var wAddrCtrl:Word; var wAddrDio:Word;
var wAddrAdda:Word):WORD ; stdCall;
function P1602_ActiveBoard(wBoardNo:Word):WORD ; stdCall;
function P1602_WhichBoardActive:WORD ; stdCall;
// Function of M_Fun series
function P1602_M_FUN_1(wDaFrequency:WORD; wDaWave:WORD;