Omega Products OME-PCI-1002 Installation Manual

www.omega.com
e-mail: info@omega.com
User’s Guide
OME-PCI-1002
PCI Data Acquisition Board Windows Software Manual
Shop online at
USA: One Omega Drive, P.O. Box 4047
ISO 9001 Certified Stamford CT 06907-0047
TEL: (203) 359-1660 FAX: (203) 359-7700 e-mail: info@omega.com
Canada: 976 Bergar
Laval (Quebec) H7L 5A1, Canada TEL: (514) 856-6928 FAX: (514) 856-6886 e-mail: info@omega.ca
For immediate technical or application assistance:
USA and Canada: Sales Service: 1-800-826-6342 / 1-800-TC-OMEGA
®
Customer Service: 1-800-622-2378 / 1-800-622-BEST
®
Engineering Service: 1-800-872-9436 / 1-800-USA-WHEN
®
TELEX: 996404 EASYLINK: 62968934 CABLE: OMEGA
Mexico: En Espan˜ol: (001) 203-359-7803 e-mail: espanol@omega.com
FAX: (001) 203-359-7807 info@omega.com.mx
Servicing Europe:
Benelux: Postbus 8034, 1180 LA Amstelveen, The Netherlands
TEL: +31 (0)20 3472121 FAX: +31 (0)20 6434643 Toll Free in Benelux: 0800 0993344 e-mail: sales@omegaeng.nl
Czech Republic: Frystatska 184, 733 01 Karviná, Czech Republic
TEL: +420 (0)59 6311899 FAX: +420 (0)59 6311114 Toll Free: 0800-1-66342 e-mail: info@omegashop.cz
France: 11, rue Jacques Cartier, 78280 Guyancourt, France
TEL: +33 (0)1 61 37 29 00 FAX: +33 (0)1 30 57 54 27 Toll Free in France: 0800 466 342 e-mail: sales@omega.fr
Germany/Austria: Daimlerstrasse 26, D-75392 Deckenpfronn, Germany
TEL: +49 (0)7056 9398-0 FAX: +49 (0)7056 9398-29 Toll Free in Germany: 0800 639 7678 e-mail: info@omega.de
United Kingdom: One Omega Drive, River Bend Technology Centre
ISO 9002 Certified Northbank, Irlam, Manchester
M44 5BD United Kingdom TEL: +44 (0)161 777 6611 FAX: +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.
OME-PCI-1002 Software Manual for Windows
Table of Contents
1. Introduction ........................................................................................................................................4
1.1 Software Installation...................................................................................................................5
1.2 References ..................................................................................................................................7
2. Declaration Files.................................................................................................................................8
2.1 P100X.H .....................................................................................................................................9
2.2 P100Xu.C .................................................................................................................................11
2.3 P100X.BAS ..............................................................................................................................12
2.4 P100Xu.BAS ............................................................................................................................14
2.5 P100X.PAS...............................................................................................................................15
2.6 P100Xu.PAS.............................................................................................................................18
3. Demo Result .....................................................................................................................................19
3.1 Visual C++ ...............................................................................................................................19
3.2 Visual Basic..............................................................................................................................20
3.3 Delphi .......................................................................................................................................21
3.4 Borland C++ Builder ................................................................................................................22
4. Descriptions of Functions.................................................................................................................23
4.1 The Configuration Code Table.................................................................................................25
4.2 The Test Functions ...................................................................................................................26
P100X_FloatSub2.........................................................................................................................26
P100X_ShortSub2 ........................................................................................................................26
4.2.3 P100X_GetDllVersion......................................................................................................27
P100X_GetDriverVersion ............................................................................................................27
4.3 The DI/O Functions..................................................................................................................28
P100X_Di.....................................................................................................................................28
P100X_Do....................................................................................................................................28
4.4 The A/D Fixed-mode Functions...............................................................................................29
P100X_SetChannelConfig............................................................................................................29
4.4.2 P100X_Polling..................................................................................................................30
4.4.3 P100X_AdPolling.............................................................................................................31
4.4.4 P100X_AdsPolling ...........................................................................................................32
4.4.5 P100X_AdsPacer..............................................................................................................33
4.5 Driver Functions.......................................................................................................................34
P100X_DriverInit.........................................................................................................................34
P100X_DriverClose .....................................................................................................................34
4.5.3 P100X_GetConfigAddressSpace......................................................................................35
P100X_WhichBoardActive..........................................................................................................35
4.5.5 P100X_ActiveBoard.........................................................................................................36
P100X_GetIrqNo..........................................................................................................................36
4.6 The Interrupt Functions ............................................................................................................37
P100X_InstallIrq ..........................................................................................................................37
P100X_GetIntCount.....................................................................................................................37
4.6.3 P100X_INT_AdStart........................................................................................................38
P100X_INT_AdStop ....................................................................................................................38
4.6.5 P100X_GetBuffer.............................................................................................................39
P100X_GetFloatBuffer.................................................................................................................39
4.6.7 Architecture of Interrupt mode .........................................................................................40
5. Program Architecture .......................................................................................................................44
6. Reporting Problems..........................................................................................................................45
Page 3
OME-PCI-1002 Software Manual for Windows
1. Introduction
The OME-PCI-1002 Toolkit is a collection of DLLs and device-driver for Windows 95/98/NT/2000/XP applications. These DLLs are 32-bit and can be called by Visual C++, BC++, Visual BASIC, Delphi and LabVIEW.
The OME-PCI-1002 Toolkit consists of the following DLLs and device driver:
P100X.DLL, P100X.LIB Æ for OME-PCI-1002 card
P100X.VXD Æ OME-PCI-1002 Device driver for Windows 95/98
P100X.SYS Æ OME-PCI-1002 Device driver for Windows
NT/2000/XP
The DLLs perform a variety of tasks including:
Read software version
Initialization
Digital Input/Output
A/D conversion
Page 4
OME-PCI-1002 Software Manual for Windows
1.1 Software Installation
Insert the CD ROM included with your OME-PCI-1002 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-1002 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.
Page 5
OME-PCI-1002 Software Manual for Windows
Demo Folder Contains all demonstration programs including their source code. 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 the NMAKE.EXE to compiling and linking the demo code. For Example, C:\P1002\DEMO\VC\nmake /f demo.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).
Page 6
OME-PCI-1002 Software Manual for Windows
1.2 References
Please also refer to the following user manuals:
SoftInst.pdf:
To install the software package under Windows 95/98/NT/2000/XP.
CallDll.pdf:
To call the DLL functions with Visual C++, Visual Basic, Delphi and
Borland C++.
ResCheck.pdf:
To check the card resources, that is, I/O Port address, IRQ number
and DMA under Windows.
Page 7
OME-PCI-1002 Software Manual for Windows
2. Declaration Files
Please refer to user manual "CallDLL.pdf".
|--\Driver Å some device driver | | | |--\VB Å for Visual Basic | | |--\P100X.BAS Å Declaration file for Visual Basic | | |--\P100Xu.BAS Å Functions for Visual Basic | | | |--\VC Å for Visual C++ | | |--\P100X.H Å Header file | | |--\P100X.LIB Å Import library for VC only | | | |--\Delphi Å for Delphi | | |--\P100X.PAS Å Declaration file | | |--\P100Xu.PAS Å Functions for Delphi | | | |--\BCB Å for Borland C++ Builder 3.0 | |--\P100X.H Å Header file | |--\P100Xu.C Å Functions for BCB | |--\P100X.LIB Å Import library file for BCB only
Page 8
OME-PCI-1002 Software Manual for Windows
2.1 P100X.H
#ifdef __cplusplus #define EXPORTS extern "C" __declspec (dllimport) #else #define EXPORTS #endif
// return code #define P100X_NoError 0 #define P100X_DriverHandleError 1 #define P100X_DriverCallError 2 #define P100X_AdControllerError 3 #define P100X_ConfigCodeError 4 #define P100X_DriverNoOpen 5 #define P100X_AdPollingTimeOut 6 #define P100X_FindBoardError 7 #define P100X_AdChannelError 8 #define P100X_DaChannelError 9 #define P100X_InvalidDelay 10 #define P100X_DelayTimeOut 11 #define P100X_InvalidData 12 #define P100X_TimeoutError 13 #define P100X_ExceedBoardNumber 14 #define P100X_NotFoundBoard 15 #define P100X_OpenError 16 #define P100X_FindTwoBoardError 17 #define P100X_GetIntCountError 18 #define P100X_InstallIrqError 19 #define P100X_AllocateMemoryError 20
EXPORTS float CALLBACK P100X_FloatSub(float fA, float fB); EXPORTS short CALLBACK P100X_ShortSub(short nA, short nB); EXPORTS WORD CALLBACK P100X_GetDllVersion(void);
EXPORTS WORD CALLBACK P100X_DriverInit(WORD *wTotalBoards); EXPORTS void CALLBACK P100X_DriverClose(void); EXPORTS WORD CALLBACK P100X_GetDriverVersion
(WORD *wDriverVersion);
EXPORTS WORD CALLBACK P100X_GetIrqNo( WORD *IrqNo);
EXPORTS WORD CALLBACK P100X_GetConfigAddressSpace (WORD wBoardNo, WORD *wAddress0, WORD *wAddress1, WORD *wAddress2);
EXPORTS WORD CALLBACK P100X_ActiveBoard( WORD wBoardNo ); EXPORTS WORD CALLBACK P100X_WhichBoardActive(void);
Page 9
OME-PCI-1002 Software Manual for Windows
EXPORTS void CALLBACK P100X_SetupTimer
(WORD wChannel, WORD wCoef);
EXPORTS WORD CALLBACK P100X_Delay(WORD wDownCount);
EXPORTS void CALLBACK P100X_Do(WORD wOutData); EXPORTS WORD CALLBACK P100X_Di(WORD *wDiData);
EXPORTS WORD CALLBACK P100X_SetChannelConfig
(WORD wAdChannel, WORD wConfig); EXPORTS WORD CALLBACK P100X_Polling(WORD *wAdVal); EXPORTS WORD CALLBACK P100X_AdPolling(float *fAdVal); EXPORTS WORD CALLBACK P100X_AdsPolling
(float fAdVal[], WORD wNum);
EXPORTS WORD CALLBACK P100X_AdsPacer
(float fAdVal[], WORD wNum, WORD wSamplingDiv);
EXPORTS WORD CALLBACK P100X_InstallIrq
(HANDLE *hEvent, DWORD dwCount); EXPORTS WORD CALLBACK P100X_GetBuffer
(DWORD dwNum, WORD wBuf[]); EXPORTS WORD CALLBACK P100X_GetFloatBuffer
(DWORD dwNum, float fAdVal[]);
EXPORTS WORD CALLBACK P100X_GetIntCount(DWORD *dwVal); EXPORTS WORD CALLBACK P100X_INT_AdStart
(WORD Ch, WORD Gain, WORD wFreqDiv);
EXPORTS WORD CALLBACK P100X_INT_AdStop();
Page 10
OME-PCI-1002 Software Manual for Windows
2.2 P100Xu.C
#include <math.h>
//*-----------------------------------------------------* //* Return voltage value or -100.0 if any error occurs * //* or parameter is out of range. * //* HiLo : 1 --> High Gain , 0 --> Low Gain * //* Gain : 0-3 * //*-----------------------------------------------------* float P100X_AD2F(Word hex, int HiLo,int Gain ) { float ZeroBase, VoltageRange, FullRange ;
ZeroBase = 2048.0 ; FullRange = 2048.0 ; VoltageRange = 10.0 ; Gain = Gain % 16 ; if ( (Gain < 0) || (Gain > 3) ) return -100.0;
if ( HiLo == 0 ) //Low-Gain return ((((hex - ZeroBase) / FullRange) * VoltageRange) / pow( 2 , Gain)); else return ((((hex - ZeroBase) / FullRange) * VoltageRange) / pow( 10 , Gain));
}
Page 11
OME-PCI-1002 Software Manual for Windows
2.3 P100X.BAS
Attribute VB_Name = "P100X"
' return code Global Const P100X_NoError = 0 Global Const P100X_DriverHandleError = 1 Global Const P100X_DriverCallError = 2 Global Const P100X_AdControllerError = 3 Global Const P100X_ConfigCodeError = 4 Global Const P100X_DriverNoOpen = 5 Global Const P100X_AdPollingTimeOut = 6 Global Const P100X_FindBoardError = 7 Global Const P100X_AdChannelError = 8 Global Const P100X_DaChannelError = 9 Global Const P100X_InvalidDelay = 10 Global Const P100X_DelayTimeOut = 11 Global Const P100X_InvalidData = 12 Global Const P100X_TimeoutError = 13 Global Const P100X_ExceedBoardNumber = 14 Global Const P100X_NotFoundBoard = 15 Global Const P100X_OpenError = 16 Global Const P100X_FindTwoBoardError = 17 Global Const P100X_GetIntCountError = 18 Global Const P100X_InstallIrqError = 19 Global Const P100X_AllocateMemoryError = 20
' Function of Test Declare Function P100X_FloatSub Lib "P100X.DLL" _ (ByVal fA As Single, ByVal fB As Single) As Single Declare Function P100X_ShortSub Lib "P100X.DLL" _ (ByVal nA As Integer, ByVal nB As Integer) As Integer Declare Function P100X_GetDllVersion Lib "P100X.DLL" () As Integer
' Function of Driver Declare Function P100X_DriverInit Lib "P100X.DLL" _ (wTotalBoards As Integer) As Integer Declare Sub P100X_DriverClose Lib "P100X.DLL" () Declare Function P100X_GetDriverVersion Lib "P100X.DLL" _ (wDriverVersion As Integer) As Integer Declare Function P100X_GetIrqNo Lib "P100X.DLL" (IrqNo As Integer) _
As Integer Declare Function P100X_GetConfigAddressSpace Lib "P100X.DLL" _ (ByVal wBoardNo As Integer, wAddrTimer As Integer, _ wAddrDio As Integer, wAddrAd As Integer) As Integer Declare Function P100X_ActiveBoard Lib "P100X.DLL" _ (ByVal wBoardNo As Integer) As Integer Declare Function P100X_WhichBoardActive Lib "P100X.DLL" () As Integer
Page 12
OME-PCI-1002 Software Manual for Windows
Declare Sub P100X_SetupTimer Lib "P100X.DLL" _ (ByVal wChannel As Integer, ByVal wCoef As Integer) Declare Function P100X_Delay Lib "P100X.DLL" _
(ByVal wDownCount As Integer) As Integer
' Function of DI/DO Declare Sub P100X_Do Lib "P100X.DLL" (ByVal wOutData As Integer) Declare Function P100X_Di Lib "P100X.DLL" (wDiData As Integer) As Integer
' Function of AD Declare Function P100X_SetChannelConfig Lib "P100X.DLL" _ (ByVal wAdChannel As Integer, ByVal wConfig As Integer) As Integer Declare Function P100X_Polling Lib "P100X.DLL" _
(wAdVal As Integer) As Integer Declare Function P100X_AdPolling Lib "P100X.DLL" _
(fAdVal As Single) As Integer Declare Function P100X_AdsPolling Lib "P100X.DLL" _ (fAdVal As Single, ByVal wNum As Integer) As Integer Declare Function P100X_AdsPacer Lib "P100X.DLL" (fAdVal As Single, _ ByVal wNum As Integer, ByVal wSamplingDiv As Integer) As Integer
' Function of Interrupt Declare Function P100X_InstallIrq Lib "P100X.DLL" _ (hEvent As Long, ByVal dwCount As Long) As Integer Declare Function P100X_GetBuffer Lib "P100X.DLL" _ (ByVal dwNum As Long, wBuf As Integer) As Integer Declare Function P100X_GetFloatBuffer Lib "P100X.DLL" _ (ByVal dwNum As Long, fAdVal As Single) As Integer Declare Function P100X_INT_AdStart Lib "P100X.DLL" _ (ByVal Ch As Integer, ByVal Gain As Integer, _
ByVal wFreqDiv As Integer) As Integer Declare Function P100X_INT_AdStop Lib "P100X.DLL" () As Integer Declare Function P100X_GetIntCount Lib "P100X.DLL" (dwVal As Long) _
As Integer
Page 13
OME-PCI-1002 Software Manual for Windows
2.4 P100Xu.BAS
'*-----------------------------------------------------* '* Return voltage value or -100.0 if any error occurs * '* or parameter is out of range. * '* HiLo : 1 --> High Gain , 0 --> Low Gain * '* Gain : 0-3 * '*-----------------------------------------------------* Function P100X_AD2F(ByVal hex, HiLo, Gain As Integer) As Single Dim ZeroBase, BullRange, VoltageRange As Single
ZeroBase = 2048# FullRange = 2048# VoltageRange = 10# Gain = Gain Mod 16
If Gain < 0 Or Gain > 3 Then P100X_AD2F = -100# Exit Function End If
If HiLo = 0 Then 'Low-Gain P100X_AD2F = ((((hex - ZeroBase) / FullRange) * VoltageRange) / (2 ^ Gain)) Else P100X_AD2F = ((((hex - ZeroBase) / FullRange) * VoltageRange) / (10 ^ Gain)) End If End Function
Page 14
OME-PCI-1002 Software Manual for Windows
2.5 P100X.PAS
unit P100X;
interface
type PSingle=^Single; type PWord=^Word;
const // return code P100X_NoError = 0; P100X_DriverHandleError = 1; P100X_DriverCallError = 2; P100X_AdControllerError = 3; P100X_ConfigCodeError = 4; P100X_DriverNoOpen = 5; P100X_AdPollingTimeOut = 6; P100X_FindBoardError = 7; P100X_AdChannelError = 8; P100X_DaChannelError = 9; P100X_InvalidDelay = 10; P100X_DelayTimeOut = 11; P100X_InvalidData = 12; P100X_TimeoutError = 13; P100X_ExceedBoardNumber = 14; P100X_NotFoundBoard = 15; P100X_OpenError = 16; P100X_FindTwoBoardError = 17; P100X_GetIntCountError = 18; P100X_InstallIrqError = 19; P100X_AllocateMemoryError = 20;
// Function of Test function P100X_FloatSub(fA:Single; fB:Single):Single ; stdCall; function P100X_ShortSub(nA:SmallInt; nB:SmallInt):SmallInt ; stdCall; function P100X_GetDllVersion:WORD ; stdCall;
Page 15
Loading...
+ 32 hidden pages