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
Page 6
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
Page 7
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
Page 12
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
Page 13
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
Page 14
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
Page 15
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
Page 16
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
Page 17
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;
function P1602_FloatSub2; external 'P1602.DLL' name 'P1602_FloatSub2';
function P1602_ShortSub2; external 'P1602.DLL' name 'P1602_ShortSub2';
function P1602_GetDllVersion; external 'P1602.DLL' name 'P1602_GetDllVersion';
function P1602_GetDriverVersion; external 'P1602.DLL' name
'P1602_GetDriverVersion';
19
Page 20
function P1602_DriverInit; external 'P1602.DLL' name 'P1602_DriverInit';
procedure P1602_DriverClose; external 'P1602.DLL' name 'P1602_DriverClose';
function P1602_GetConfigAddressSpace;
external 'P1602.DLL' name 'P1602_GetConfigAddressSpace';
function P1602_ActiveBoard; external 'P1602.DLL' name 'P1602_ActiveBoard';
function P1602_WhichBoardActive;
external 'P1602.DLL' name 'P1602_WhichBoardActive';
// Function of M_Fun series
function P1602_M_FUN_1; external 'P1602.DLL' name 'P1602_M_FUN_1';
function P1602_M_FUN_2; external 'P1602.DLL' name 'P1602_M_FUN_2';
function P1602_M_FUN_3; external 'P1602.DLL' name 'P1602_M_FUN_3';
function P1602_M_FUN_4; external 'P1602.DLL' name 'P1602_M_FUN_4';
function P1602_Do; external 'P1602.DLL' name 'P1602_Do';
function P1602_Di; external 'P1602.DLL' name 'P1602_Di';
function P1602_Da; external 'P1602.DLL' name 'P1602_Da';
function P1602_SetChannelConfig;
external 'P1602.DLL' name 'P1602_SetChannelConfig';
function P1602_AdPolling; external 'P1602.DLL' name 'P1602_AdPolling';
function P1602_AdsPolling; external 'P1602.DLL' name 'P1602_AdsPolling';
function P1602_AdsPacer; external 'P1602.DLL' name 'P1602_AdsPacer';
//*********************
function P1602_ClearScan; external 'P1602.DLL' name 'P1602_ClearScan';
function P1602_StartScan; external 'P1602.DLL' name 'P1602_StartScan';
procedure P1602_ReadScanStatus; external 'P1602.DLL' name
'P1602_ReadScanStatus';
function P1602_AddToScan; external 'P1602.DLL' name 'P1602_AddToScan';
function P1602_SaveScan; external 'P1602.DLL' name 'P1602_SaveScan';
procedure P1602_WaitMagicScanFinish; external 'P1602.DLL' name
'P1602_WaitMagicScanFinish';
function P1602_StopMagicScan; external 'P1602.DLL' name
'P1602_StopMagicScan';
//*********************
20
Page 21
function P1602_DelayUs; external 'P1602.DLL' name 'P1602_DelayUs';
//*******************
function P1602_Card0_StartScan; external 'P1602.DLL' name
'P1602_Card0_StartScan';
function P1602_Card0_ReadStatus; external 'P1602.DLL' name
'P1602_Card0_ReadStatus';
procedure P1602_Card0_Stop; external 'P1602.DLL' name 'P1602_Card0_Stop';
function P1602_Card1_StartScan; external 'P1602.DLL' name
'P1602_Card1_StartScan';
function P1602_Card1_ReadStatus; external 'P1602.DLL' name
'P1602_Card1_ReadStatus';
procedure P1602_Card1_Stop; external 'P1602.DLL' name 'P1602_Card1_Stop';
//*******************
function P1602_FunA_Start; external 'P1602.DLL' name 'P1602_FunA_Start';
function P1602_FunA_ReadStatus; external 'P1602.DLL' name
'P1602_FunA_ReadStatus';
function P1602_FunA_Stop; external 'P1602.DLL' name 'P1602_FunA_Stop';
function P1602_FunA_Get; external 'P1602.DLL' name 'P1602_FunA_Get';
//*******************
function P1602_FunB_Start; external 'P1602.DLL' name 'P1602_FunB_Start';
function P1602_FunB_ReadStatus; external 'P1602.DLL' name
'P1602_FunB_ReadStatus';
function P1602_FunB_Stop; external 'P1602.DLL' name 'P1602_FunB_Stop';
function P1602_FunB_Get; external 'P1602.DLL' name 'P1602_FunB_Get';
end.
21
Page 22
2.4 LabVIEW Call DLLs
LabVIEW is an industrial graphical programming system developed by National
Instruments. With LabVIEW, the user can quickly design a user interface and
application program as a block diagram.
NAPPCI\Win\VIEW\P1602.Dll Æ DLLs
NAPPCI\Win\VIEW\DEMO1.VI Æ Demo VI
NAPPCI\Win\VIEW\MFUN1.VI Æ Driver VI
NOTE:
1. Tested under Windows 95/98/NT and LabVIEW 4.0
2. The demo1.VI will call MFUN1.VI to perform M_Functions. The M_Functions
can send out an arbitrary waveform to the D/A output port and perform A/D input
at the same time. If you connect D/A channel_0 to A/D channel_0, the
M_Functions can measure the D/A output back. The output response is shown in
Fig 8 and the connecting diagram of demo1.VI is given in Fig. 9.
Fig 8. The output of DEMO1.VI. (call M_FUN_1)
22
Page 23
Fig 9. The connection diagram for DEMO1.VI (call MFUN1.VI)
Fig 10. The connection diagram for MFUN1.VI (call DLL M_FUN_1)
23
Page 24
2.5 Demo Program
A common demo program is used for all P1602.dll examples. The demo program
will accept wDaFreq and wAdClk and call the different driver functions for
demonstration purposes.
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include "P1602.H"
/********************************************************************/
/* DEMO1 program for one P1602 cards in the PC system. */
/* Please set the resolution of your monitor to at least 1024*768 */
/********************************************************************/
/* First Card: some P1602 function call demo. */
/* For the proper operation the P1602, the following functions */
/* must be used. */
/* P1602_DriverInit(); <-- initial the driver */
/* P1602_DriverClose(); <-- close the driver */
/********************************************************************/
short nDMA=-1, nIRQ=-1; // not used
WORD wBase=0x220,wAdBuf[510],wFlag=0,wAddrCtrl;
int iLine;
DWORD dwDaNum=90,dwAdClk=24;
WORD wTotalBoard,wInitialCode;
static int cxChar, cyChar, cxClient, cyClient,cxBuffer;
static int cyBuffer, xCaret, yCaret;
static char cBuf[80];
HDC hdc;
TEXTMETRIC tm;
PAINTSTRUCT ps;
int i;
switch (iMsg)
{
case WM_CREATE : // window initial
/**************************************************************/
/* NOTICE: call P1602_DriverInit() to initialize the driver. */
/**************************************************************/
// Initialize the device driver, and return the board number in the PC
wInitialCode=P1602_DriverInit(&wTotalBoard);
if( wInitialCode!=NoError )
{
MessageBox(hwnd,"No P1602 card in this system !!!",
sprintf(cBuf,"Press any key to continue");
TextOut(hdc,0,0,cBuf,strlen(cBuf));
xCaret = 0 ; yCaret=1;
SetCaretPos(0,yCaret*cyChar);
EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY :
/**************************************************************/
/* NOTICE: call P1602_DriverClose() to close the driver. */
/**************************************************************/
P1602_DriverClose(); // close the driver
zDescription : This function will specify the starting address of A/D data buffer for
MagicScan.
z Syntax : void P1602_SaveScan(WORD wAdChannel, WORD wBuf[]);
z Input Parameter :
wAdChannel : Scan number in the scan queue.
(Note: not the A/D channel number.)
wBuf : starting address of the A/D data buffer for the channel specified in
wAdChannel
z Return Value :
NoError : Ok
ExceedBoardNumber: invalid board number
FindBoardError : cannot find the OME-PCI-1602 board
AdChannelError : invalid A/D channel
Demo Program :.DEMO11.C
z
• Code Fragment
WORD wV0[100000]; // A/D ch:0 buffer
WORD wV2[100000]; // A/D ch:2 buffer
:
:
wRetVal=P1602_ClearScan();
//**** For OME-PCI-1602L
wRetVal += P1602_AddToScan(0,0,1,0,0,0); // CH:0 to scan
wRetVal += P1602_SaveScan(0,wV0);
wRetVal += P1602_AddToScan(2,0,1,0,0,0); // CH:2 to scan
wRetVal += P1602_SaveScan(1,wV2); // Notice: 1 not 2
// ^ Notice: This is a ordinal number in
// Scan Queue not a channel number.
wSampleRateDiv=80; // sample rate=8M/wSampleRateDiv
P1602_StartScan(wSampleRateDiv,DATALENGTH,nPriority);
47
Page 48
3.7.6 P1602_WaitMagicScanFinish
zDescription : This function will delay until the MagicScan operation is finished.
This function will refer to the current active OME-PCI-1602 board. Use the
P1602_ActiveBoard(….) to select the active board.
zSyntax : void P1602_WaitMagicScanFinish(WORD *wStatus, WORD
*wLowAlarm, WORD *wHighAlarm);
zInput Parameter :
*wStatus : address of wStatus which will contain the MagicScan status
*wLowAlarm : address of wLowAlarm which will contain the MagicScan alarm
status
*dwHighAlarm : address of wHighAlarm which will contain the MagicScan
wLowAlarm=1 Æ channel_0 is low alarm, others are OK
wLowAlarm=3 Æ channel_0 and channel_1 are low alarm, others are OK
wHighAlarm Æ 32 bits corresponding to 32 channels
Æ 0 = no high alarm
Æ 1 = is high alarm
wHighAlarm=0 Æ all channels OK, no high alarm
wHighAlarm=1 Æ channel_0 is high alarm, others are OK
wHighAlarm=3 Æ channel_0 and channel_1 are high alarm, others are OK
48
Page 49
3.8 The Pulg&Play Functions
3.8.1 P1602_DriverInit
zDescription: This function will detect all of the OME-PCI-1602 boards installed in
the system. This function must be called once before any other function is called.
z Syntax : WORD P1602_DriverInit(WORD *wTotalBoard);
z Input Parameter : *wTotalBoard: address of wTotalBoard
wTotalBoard=1 Æ one OME-PCI-1602 card in the system
wTotalBoard=n Æ n*OME-PCI-1602 cards in the system
z Return Value :
NoError : OK
NoFoundBoard: can not detect any OME-PCI-1602
FindBoardError: handshake check error
DriverHandleError : the NAPPCI.VxD .open error for Windows 95
the Napwnt.SYS .open error for Windows NT
DriverCallError : call NAPPCI.VxD return error
Call Napwnt.SYS return error
zDemo Program: All DEMO programs.
3.8.2 P1602_DriverClose
zDescription: Returns all resources to the system. This function should be called
before the program is terminated.
zSyntax : void P1602_DriverClose(void);
Input Parameter : void
z
z
Return Value : void
Demo Program: All DEMO programs.
z
49
Page 50
3.8.3 P1602_GetConfigAddressSpace
zDescription: Gets the I/O address of OME-PCI-1602 board n. This function
is for debugging purposes only. It is not necessary to call this function.
zSyntax : WORD P1602_GetConfigAddressSpace(WORD wBoardNo, WORD
*wAddrTimer,WORD *wAddrCtrl, WORD *wAddrDio, WORD *wAddrAdda);
zInput Parameter :
wBoardNo: OME-PCI-1602 board number
wAddrTimer, wAddrCtrl, wAddrDio, wAddrAdda: refer to the “OME-PCI-1602
Hardware manual” chapter-3 for details.
z Return Value :
NoError : OK
FindBoardError: handshake check error
ExceedBoardError: wBoardNo is invalid
Demo Program : DEMO1.C
z
3.8.4 P1602_WhichBoardActive
z Description: Returns the board number of the active board.
z Syntax: WORDP1602_WhichBoardActive(void);
z Input Parameter: void
z Return Value: board number of the active board.
z Demo Program: DEMO1.C
50
Page 51
3.8.5 P1602_ActiveBoard
zDescription: This function will make active one of the OME-PCI-1602 boards
installed in the system. This function must call once before the D/I/O, A/D, D/A functions
are called.
z Syntax: WORD P1602_ActiveBoard(WORD wBoardNo);
z Input Parameter:
wBoardNo: board number
Return Value :
z
NoError : OK
ExceedBoardError: wBoardNo is invalid
zDemo Program : All DEMO programd.
The P1602_ActiveBoard(…) function will effect all functions except the following:
1. P1602_FloatSub2
2. P1602_ShortSub2
3. P1602_GetDriverVersion
4. P1602_DriveInit
5. P1602_DriveClose
6. P1602_GetConfigAddressSpace
7. P1602_Card0_StartScan
8. P1602_Card0_ReadData
9. P1602_Card0_Stop
10. P1602_Card1_StartScan
11. P1602_Card1_ReadData
12. P1602_Card1_Stop
51
Page 52
3.9 Multiboard Batch Capture
(Two boards operating simultaneously)
3.9.1 P1602_FunA_Start
Description: This function will start the batch capture process for two boards
z
operating simultaneously.
z
Syntax :
WORD P1602_FunA_Start(WORD wClockDiv0, WORD wChannel0[],
WORD wConfig0[], WORD *Buffer0, DWORD dwMaxCount0,
WORD wClockDiv1, WORD wChannel1[],
WORD wConfig1[], WORD *Buffer1, DWORD dwMaxCount1
Short nPriority);
Input Parameter :
z
wClockDiv0: the A/D sample rate divisor for first board.
the sample rate is 8M/wClockDiv0.
wChannel0[]: (0=no scan, 1=scan) for each channel of the first board
wConfig0[]: configuration code for each channel of the first board
Refer to "Section 3.1 Configuration Table"
*Buffer0: buffer to store the A/D data of the first board
dwMaxCount0: sample count for the first board
wClockDiv1: the A/D sample rate divisor for the second board.
the sample rate is 8M/wClockDiv1.
WChannel1[]: (0=no scan, 1=scan) for each channel of the second board
WConfig1[]: configuration code for each channel of the second board
Refer to "Section 3.1 Configuration Table"
*Buffer1: buffer to store the A/D data of the second board
dwMaxCount1: sample count for the second board
52
Page 53
nPriority: A/D thread priority. The value of nPriority range from:
-2: THREAD_PRIORITY_LOWEST
-1: THREAD_PRIORITY_BELOW_NORMAL
0: THREAD_PRIORITY_NORMAL
1: THREAD_PRIORITY_ABOVE_NORMAL
2: THREAD_PRIORITY_HIGHEST
Other: THREAD_PRIORITY_NORMAL
z Return Value :
NoError : OK
FindTwoBoardError : cannot find out two OME-PCI-1602 boards
z Demo Program : DEMO20.C
53
Page 54
3.9.2 P1602_FunA_ReadStatus
z Description : This function will read the status of the batch capture process.
z Syntax :
WORD P1602_FunA_ReadStatus( void );
zInput Parameter :
void;
Return Value :
z
0: data is ready
1: data not ready
zDemo Program : DEMO20.C
54
Page 55
3.9.3 P1602_FunA_Stop
z Description: This function will stop the batch capture function.
z Syntax:
word P1602_FunA_Stop(void);
zInput Parameter:
void
z Return Value :
NoError : OK
StopError : Stop Error
Demo Program : DEMO20.C
z
3.9.4 P1602_FunA_Get
z Description: This function will retrieve the number A/D samples acquired.
z Syntax:
word P1602_FunA_Get(DWORD *P0, DWORD *P1);
Input Parameter:
z
*P0: [output] the number of A/D samples that have been acquired for the first board.
*P1: [output] the number of A/D samples that have been acquired for the second board.
z
Return Value :
NoError : OK
z Demo Program : DEMO20.C
55
Page 56
3.10 The Single Board Batch Capture
3.10.1 P1602_FunB_Start
z
Description : This function will start the batch capture process.
zSyntax :
WORD P1602_FunB_Start(WORD wClockDiv0, WORD wChannel0[],
WORD wConfig0[], WORD *Buffer0, DWORD dwMaxCount0,
SHORT nPriority);
Input Parameter :
z
wClockDiv0: the A/D sample rate divisor for this board.
the sample rate is 8M/wClockDiv0.
wChannel0[]: (0=no scan, 1=scan) for each channel of this board
wConfig0[]: configuration code for each channel of this board
Refer to "Section 3.1 Configuration Table"
*Buffer0: buffer to store the A/D data of this board
dwMaxCount0: to specify the data length of this board
nPriority: Thread priority. The value of nPriority ranges from:
-2: THREAD_PRIORITY_LOWEST
-1: THREAD_PRIORITY_BELOW_NORMAL
0: THREAD_PRIORITY_NORMAL
1: THREAD_PRIORITY_ABOVE_NORMAL
2: THREAD_PRIORITY_HIGHEST
Other: THREAD_PRIORITY_NORMAL
z Return Value :
NoError : OK
FindBoardError : cannot find the OME-PCI-1602 board
Description: This function will stop the continuous capture function.
z
z
Syntax: void P1602_Card1_Stop(void);
z Input Parameter: void
Return Value: void
z
z
Demo Program: DEMO14.C
62
Page 63
3.11 Other Functions
3.11.1 P1602_DelayUs
z Description: This is a machine independent timer. This function can be
used to create the settling timedelay or used as a general purpose machine
independent timer. This function will refer to the current active OME-PCI-1602
board. Use the P1602_ActiveBoard(….) to select the active board.
z Syntax: word P1602_DelayUs(WORD wDelayUs);
z Input Parameter:
wDelayUs : number of us to delay, 8191 Max
wDelayUs=1 Æ delay 1 µs
wDelayUs=1000 Æ delay 1000 us = 1 ms
wDelayUs=8191 Æ delay 8191 us = 8.191 ms (maximum delay)
wDelayUs=8192 Æ invalid delay (will return error)
z Return Value:
NoError : OK
ExceedBoardNumber: invalid board number
FindBoardError : cannot find the OME-PCI-1602 board
InvalidDelay : dwDelayUs > 8191
Demo Program : DEMO1.C
z
Long Time Delay :
z
WORD DelayMs(WORD wDelayMs) // maximum delay=4294967.295 sec
{
WORD wDelay,wRetVal
wRetVal=0;
for (wDelay=0; wDelay<wDelayMs; wDelay++)
wRetVal+=P1602_DelayUs(1000);
return(wRetVal);
}
63
Page 64
4. Demo Programs
The following demonstration programs are provided on the included CD:
z demo1: one board, D/I/O test, D/A test, A/D polling & pacer trigger test, general test
z demo2: two boards, same as demo1
z demo3: one board, all 32 channels of A/D by software trigger(by polling)
z demo4: two boards, same as demo3
z demo5: one board, M_function_1 demo
z demo6: two boards, same as demo5
z demo7: one board, M_function_2 demo
z demo8: two boards, same as demo7
z demo9: one board, M_function_3 demo
z demo10: two boards, same as demo9
z demo11: one board, MagicScan demo
z demo12: two boards, same as demo11
z demo13: one board, continuous capture demo
z demo14: two boards, continuous capture demo (Windows 95/98/NT only)
z demo15: all installed boards, D/I/O test for board number identification
z demo16: one board, performance evaluation demo
z demo17: one board, MagicScan demo, scan sequence: 4Æ3Æ5
z demo18: one board, MagicScan demo, scan 32 channel, show channel
0/1/15/16/17
z demo19: one board, A/D calibration.
z demo20: two boards, P1602_FUNA, batch capture demo
z demo21: single board, P1602_FUNB, batch capture demo
64
Page 65
WARRANTY/DISCLAIMER
OMEGA ENGINEERING, INC. warrants this unit to be free of defects in materials and workmanship for a
period of 13 months from date of purchase. OMEGA’s WARRANTY adds an additional one (1) month
grace period to the normal one (1) year product warranty to cover handling and shipping time. This
ensures that OMEGA’s customers receive maximum coverage on each product.
If the unit malfunctions, it must be returned to the factory for evaluation. OMEGA’s Customer Service
Department will issue an Authorized Return (AR) number immediately upon phone or written request.
Upon examination by OMEGA, if the unit is found to be defective, it will be repaired or replaced at no
charge. OMEGA’sWARRANTY does not apply to defects resulting from any action of the purchaser, including but not limited to mishandling, improper interfacing, operation outside of design limits,
improper repair, or unauthorized modification. This WARRANTY is VOID if the unit shows evidence of
having been tampered with or shows evidence of having been damaged as a result of excessive corrosion;
or current, heat, moisture or vibration; improper specification; misapplication; misuse or other operating
conditions outside of OMEGA’s control. Components which wear are not warranted, including but not
limited to contact points, fuses, and triacs.
OMEGA is pleased to offer suggestions on the use of its various products. However,
OMEGA neither assumes responsibility for any omissions or errors nor assumes liability for any
damages that result from the use of its products in accordance with information provided by
OMEGA, either verbal or written. OMEGA warrants only that the parts manufactured by it will be
as specified and free of defects. OMEGA MAKES NO OTHER WARRANTIES OR
REPRESENTATIONS OF ANY KIND WHATSOEVER, EXPRESS OR IMPLIED, EXCEPT THAT OF TITLE,
AND ALL IMPLIED WARRANTIES INCLUDING ANY WARRANTY OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. LIMITATION OF
LIABILITY: The remedies of purchaser set forth herein are exclusive, and the total liability of
OMEGA with respect to this order, whether based on contract, warranty, negligence,
indemnification, strict liability or otherwise, shall not exceed the purchase price of the
component upon which liability is based. In no event shall OMEGA be liable for
consequential, incidental or special damages.
CONDITIONS: Equipment sold by OMEGA is not intended to be used, nor shall it be used: (1) as a “Basic
Component” under 10 CFR 21 (NRC), used in or with any nuclear installation or activity; or (2) in medical
applications or used on humans. Should any Product(s) be used in or with any nuclear installation or
activity, medical application, used on humans, or misused in any way, OMEGA assumes no responsibility
as set forth in our basic WARRANTY / DISCLAIMER language, and, additionally, purchaser will indemnify
OMEGA and hold OMEGA harmless from any liability or damage whatsoever arising out of the use of the
Product(s) in suc h a manner.
RETURN REQUESTS/INQUIRIES
Direct all warranty and repair requests/inquiries to the OMEGA Customer Service Department. BEFORE
RETURNING ANY PRODUCT(S) TO OMEGA, PURCHASER MUST OBTAIN AN AUTHORIZED RETURN
(AR) NUMBER FROM OMEGA’S CUSTOMER SERVICE DEPARTMENT (IN ORDER TO AVOID
PROCESSING DELAYS). The assigned AR number should then be marked on the outside of the return
package and on any correspondence.
The purchaser is responsible for shipping charges, freight, insurance and proper packaging to prevent
breakage in transit.
FOR W
ARRANTY RETURNS, please have the
following information available BEFORE
contacting OMEGA:
1. Purc hase Order number under which the product
was PURCHASED,
2. Model and serial number of the product under
warranty, and
3. Repair instructions and/or specific problems
relative to the product.
FOR NON-WARRANTY REPAIRS,
consult OMEGA
for current repair charges. Have the following
information available BEFORE contacting OMEGA:
1. Purchase Order number to cover the COST
of the repair,
2. Model and serial number of the product, and
3. Repair instructions and/or specific problems
relative to the product.
OMEGA’s policy is to make running changes, not model changes, whenever an improvement is possible. This affords
our customers the latest in technology and engineering.
reproduced, translated, or reduced to any electronic medium or machine-readable form, in whole or in part, without the
prior written consent of OMEGA ENGINEERING, INC.