Omega Products OME-PCI-1802 Installation Manual

www.omega.com
e-mail: info@omega.com
User’s Guide
OME-PCI-1800/1802
PCI Data Acquisition Boards 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-180x Software Manual
Table of Contents
1. INTRODUCTION.................................................................................................................................................... 5
1.1 SOFTWARE
INSTALLATION............................................................................................................................ 6
1.2 PLUG & PLAY ...................................................................................................................................................... 8
1.3 USING WITH VISUAL C++..................................................................................................................................... 11
1.4 USING WITH MFC................................................................................................................................................. 12
1.5 USING WITH BC++............................................................................................................................................... 13
1.6 USING WITH VISUAL BASIC .................................................................................................................................. 14
1.6.1 The Demo1 Result:..................................................................................................................................... 14
1.6.2 The P180X.BAS.......................................................................................................................................... 15
1.6.3 DEMO1.FRM............................................................................................................................................. 18
1.7 U
SING WITH DELPH .............................................................................................................................................. 21
1.7.1 P180X.PAS................................................................................................................................................. 21
1.8 C
ALLING THE DLL FROM LABVIEW...................................................................................................................... 28
1.9 DEMO PROGRAM............................................................................................................................................. 30
2. DESCRIPTION OF FUNCTIONS ....................................................................................................................... 35
2.1 CONFIGURATION
CODE................................................................................................................................. 37
2.2 ERROR CODE .................................................................................................................................................... 38
2.3 P180X.H .............................................................................................................................................................. 39
2.4 TEST
FUNCTIONS ............................................................................................................................................ 42
P180X_FloatSub2 ................................................................................................................................................ 42
P180X_ShortSub2 ............................................................................................................................................... 42
2.4.3 P180X_GetDllVersion ............................................................................................................................... 43
P180X_GetDriverVersion .................................................................................................................................... 43
2.5 T
HE M_FUNCTIONS .............................................................................................................................................. 44
P180X_M_FUN_1................................................................................................................................................ 44
2.5.2 P180X_M_FUN_2 ..................................................................................................................................... 46
2.5.3 P180X_M_FUN_3 ..................................................................................................................................... 48
2.6 T
HE DIO FUNCTIONS ........................................................................................................................................... 50
2.6.1 P180X_Di................................................................................................................................................... 50
2.6.2 P180X_Do.................................................................................................................................................. 51
2.7 T
HE D/A FUNCTIONS............................................................................................................................................ 52
2.7.1 P180X_Da.................................................................................................................................................. 52
2.8 T
HE A/D FIXED-MODE FUNCTIONS....................................................................................................................... 53
P180X_SetChannelConfig.................................................................................................................................... 53
Page 3
OME-PCI-180x Software Manual
2.8.2 P180X_AdPolling ...................................................................................................................................... 54
2.8.3 P180X_AdsPolling..................................................................................................................................... 55
2.8.4 P180X_AdsPacer ....................................................................................................................................... 56
2.9 T
HE MAGICSCAN FUNCTIONS .............................................................................................................................. 57
2.9.1 P180X_ClearScan...................................................................................................................................... 57
2.9.2 P180X_StartScan ....................................................................................................................................... 58
2.9.3 P180X_ReadScanStatus............................................................................................................................. 59
2.9.4 P180X_AddToScan .................................................................................................................................... 60
2.9.5 P180X_SaveScan ....................................................................................................................................... 61
2.9.6 P180X_WaitMagicScanFinish ................................................................................................................... 62
2.10 T
HE PULG&PLAY FUNCTIONS ......................................................................................................................... 63
2.10.1 P180X_DriverInit....................................................................................................................................... 63
2.10.2 P180X_DriverClose ................................................................................................................................... 63
2.10.3 P180X_GetConfigAddressSpace................................................................................................................ 65
P180X_WhichBoardActive................................................................................................................................... 65
2.10.5 P180X_ActiveBoard................................................................................................................................... 67
2.11 M
ULTI-BOARD BATCH CAPTURE ..................................................................................................................... 68
2.11.1 P180X_FunA_Start .................................................................................................................................... 68
2.11.2 P180X_FunA_ReadStatus.......................................................................................................................... 70
2.11.3 P180X_FunA_Stop..................................................................................................................................... 71
2.11.4 P180X_FunA_Get ...................................................................................................................................... 71
2.12 T
HE SINGLE BOARD BATCH CAPTURE ............................................................................................................. 72
2.12.1 P180X_FunB_Start .................................................................................................................................... 72
2.12.2 P180X_FunB_ReadStatus.......................................................................................................................... 73
2.12.3 P180X_FunB_Stop..................................................................................................................................... 74
2.12.4 P180X_FunB_Get ...................................................................................................................................... 74
2.13 T
HE CONTINUOUS CAPTURE FUNCTIONS ......................................................................................................... 75
2.13.1 P180X_Card0_StartScan........................................................................................................................... 75
2.13.2 P180X_Card0_ReadStatus......................................................................................................................... 76
P180X_Card0_Stop.............................................................................................................................................. 76
2.13.4 P180X_Card1_StartScan........................................................................................................................... 77
2.13.5 P180X_Card1_ReadStatus......................................................................................................................... 78
2.13.6 P180X_Card1_Stop ................................................................................................................................... 78
2.14 O
THER FUNCTIONS .......................................................................................................................................... 79
P180X_DelayUs ................................................................................................................................................... 79
3. DEMO PROGRAMS............................................................................................................................................. 80
Page 4
OME-PCI-180x Software Manual
1. INTRODUCTION
The PCI-180x toolkit is a collection of DLLs for Windows 95/NT/2000/XP applications. The DLLs are 32 bit and can be called by Visual C/C++, BC++, Visual BASIC, Delphi, and LabVIEW.
These DLLs can perform a variety of data acquisition operations such as:
z Get software version
z Initialize data acquisition hardware
z Digital Input/Output
z A/D conversion
z D/A conversion
Page 5
OME-PCI-180x Software Manual
1.1 SOFTWARE INSTALLATION
Insert the CD ROM included with your OME-PCI-180x 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-180x 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 6
OME-PCI-180x Software Manual
Demo Folder Contains all demonstration programs including the 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:\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).
Page 7
OME-PCI-180x Software Manual
1.2 PLUG & PLAY
Then the p180X.inf provides all information needed to complete the Plug & Play installation. After the installation, the Windows will reserve the resources and populate the registry. The Plug & Play information is shown in Figure 1. Figure 2 shows the resources that are reserved. If the user executes “c:\WINNT\regedit.exe”, the registration information of the PCI-180XH/L will be located under “My Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\P180x” as in Figure 3. Figure 4 shows the registration items in detail.
Fig 1. The Plug & Play information
Page 8
OME-PCI-180x Software Manual
Fig 2. The allocated resources for this PCI-180X.
Fig 3. The registry path
Page 9
OME-PCI-180x Software Manual
Fig 4. Registry item details
Page 10
OME-PCI-180x Software Manual
1.3 Using With Visual C++
All demo programs were created with Visual C++5.and tested under Windows 95/NT. Key issues are given below:
1. Make sure the PATH includes the Visual C++ compiler
2. Execute the \MSDEV\BIN\VCVARS32.BAT to setup the environment. The VCVARS32.BAT is provided by Visual C++.
3. The source program must include “P180X.H”
4. Copy the P180X.LIB, import library, to the same directory as the source program.
5. Copy the P180X.DLL, to the same directory as the source program
6. Edit the source program (refer to Demo\VC5\DEMO1.C)
7. Edit the NMAKE file (refer to Demo\VC5\DEMO1.MAK)
8. NMAKE /f DEMO1.MAK
9. Execute DEMO1.EXE
NOTE: The P180X.lib is used while linking and the P180X.DLL is used at run time.
Page 11
OME-PCI-180x Software Manual
1.4 Using With MFC
Using the PCI-180x toolkit with MFC is similar as using it with Visual C++. Key issues
are given below:
1. Use MFC wizard to create the source code
2. The source program must include “P180X.H”
3. Copy the P180X.LIB, import library, to the same directory as the source program
4. Copy the P180X.DLL, to the same directory as the source program
5. Select Build/Settings/Link and key “P180X.lib” in the object/library modules
field
NOTE: The P180X.lib is used while linking and the P180X.DLL is used in run time.
Page 12
OME-PCI-180x Software Manual
1.5 Using With BC++
The DLL was created in Visual C++ 5.0. The P180X.H and P180X.lib are also designed for use with Visual C/C++. BC++ can not use these two files. The following modifications are necessary.
#include <conio.h> #include <windows.h> HINSTANCE hDLLLib;
// Step 1 : declare a function pointer
float CALLBACK (*FloatSub2)(float fA, float fB); main() {
// Step 2 : load dll
hDllLib=LoadLibrary("P180X.dll"); if (hDLLLib) {
// Step 3 : get the function address
FloatSub2=(FARPROC)GetProcAddress(hDLLLib,"P180X_FloatSub2"); if (FloatSub2) {
// Step 4 : call function
printf("1.2-3.4=%f",FloatSub2(1.2,3.4); } else printf("get P180X_FloatSub2 function address error");
// Step 5 : free library
FreeLibrary(hDLLib); } else printf("load P180X.dll error"); getch(); }
This usage can be divided into
and P180X.DLL, the user can use BC++ to call DLL.
5 steps listing above. Using this modification
Page 13
OME-PCI-180x Software Manual
1.6 Using With Visual Basic
P180X.DLL Æ DLLs
DEMO1.FRM Æ Form file
P180X.BAS Æ Module file
DEMO1.VBP Æ Project file
NOTE : 1. Tested under Windows 95/NT and VB 4.0 (32 bit)
1.6.1 The Demo1 Result:
Page 14
OME-PCI-180x Software Manual
1.6.2 The P180X.BAS
Attribute VB_Name = "Module1" 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 FrequencyCalculateError = 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
Declare Function P180X_DriverInit Lib "P180X.dll" (wTotalBoards As Integer) As Integer Declare Sub P180X_DriverClose Lib "P180X.dll" ()
Declare Function P180X_GetDriverVersion Lib "P180X.dll" (wVxdVersion As Integer) As Integer
Declare Function P180X_GetConfigAddressSpace Lib "P180X.dll" (ByVal wBoardNo As Integer, _ wAddrTimer As Integer, wAddrCtrl As Integer, wAddrDio As Integer, _
wAddrAdda As Integer) As Integer
Declare Function P180X_ActiveBoard Lib "P180X.dll" (ByVal wBoardNo As Integer) As Integer Declare Function P180X_WhichBoardActive Lib "P180X.dll" () As Integer
Declare Function P180X_M_FUN_1 Lib "P180X.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 P180X_M_FUN_2 Lib "P180X.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
Page 15
OME-PCI-180x Software Manual
Declare Function P180X_M_FUN_3 Lib "P180X.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 P180X_M_FUN_4 Lib "P180X.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 P180X_Di Lib "P180X.dll" (wDi As Integer) As Integer Declare Function P180X_Do Lib "P180X.dll" (ByVal wDo As Integer) As Integer
Declare Function P180X_Da Lib "P180X.dll" (ByVal wDaChannel As Integer, _
ByVal wDaVal As Integer) As Integer
Declare Function P180X_SetChannelConfig Lib "P180X.dll" (ByVal wAdChannel As Integer, _
ByVal wConfig As Integer) As Integer
Declare Function P180X_AdPolling Lib "P180X.dll" (fAdVal As Single) As Integer Declare Function P180X_AdsPolling Lib "P180X.dll" (fAdVal As Single, ByVal wNum As Integer) _
As Integer
Declare Function P180X_AdsPacer Lib "P180X.dll" (fAdVal As Single, ByVal wNum As Integer, _
ByVal wSample As Integer) As Integer
Declare Function P180X_ClearScan Lib "P180X.dll" () As Integer Declare Function P180X_StartScan Lib "P180X.dll" (ByVal wSampleRate As Integer, _
ByVal dwNum As Long, ByVal nPriority As Integer) As Integer
Declare Sub P180X_ReadScanStatus Lib "P180X.dll" (wStatus As Integer, dwLowAlarm As Long, _
dwHighAlarm As Long)
Declare Function P180X_AddToScan Lib "P180X.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 P180X_SaveScan Lib "P180X.dll" (ByVal wOridinalOrder As Integer, _
wBuf As Integer) As Integer
Declare Sub P180X_WaitMagicScanFinish Lib "P180X.dll" (wStatus As Integer, _
wLowAlarm As Integer, _ wHighAlarm As Integer)
Declare Function P180X_StopMagicScan Lib "P180X.dll" () As Integer
Declare Function P180X_DelayUs Lib "P180X.dll" (ByVal wDelayUs As Integer) As Integer
'------------------------ FunA series ----------------------------
'------------------------ FunB series ---------------------------­Declare Function P180X_FunB_Start Lib "P180X.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 P180X_FunB_ReadStatus Lib "P180X.dll" () As Integer Declare Function P180X_FunB_Stop Lib "P180X.dll" () As Integer Declare Function P180X_FunB_Get Lib "P180X.dll" (P0 As Long) As Integer
Declare Function P180X_Card0_StartScan Lib "P180X.dll" (ByVal wSampleRate As Integer, _
wChannelStatus As Integer, wChannelConfig As Integer, ByVal wCount As Integer) As Integer Declare Function P180X_Card0_ReadStatus Lib "P180X.dll" (wBuf As Integer, wBuf2 As Integer, _
dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer Declare Sub P180X_Card0_Stop Lib "P180X.dll" ()
Page 16
OME-PCI-180x Software Manual
Declare Function P180X_Card1_StartScan Lib "P180X.dll" (ByVal wSampleRate As Integer, _
wChannelStatus As Integer, wChannelConfig As Integer, _
ByVal wCount As Integer) As Integer Declare Function P180X_Card1_ReadStatus Lib "P180X.dll" (wBuf As Integer, wBuf2 As Integer, _
dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer Declare Sub P180X_Card1_Stop Lib "P180X.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 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
Page 17
OME-PCI-180x Software Manual
1.6.3 DEMO1.FRM
Public Sub ShowWave()
Dim a(1000), yc, xc, xl, yt As Single Dim ii As Integer Dim tmpstr$
Picture1.Cls yc = Picture1.ScaleTop + Picture1.ScaleHeight / 2 xl = Picture1.ScaleLeft xs = Picture1.ScaleWidth / AdNumber ys = Picture1.ScaleHeight / 10 Picture1.Line (xl, yc)-(xl + Picture1.ScaleWidth, yc), QBColor(4) Picture1.PSet (X1, yc - ys * AdBuf(0)) For ii = 1 To AdNumber - 1 Picture1.Line -(xl + (xs * ii), yc - (ys * AdBuf(ii))) Next ii
End Sub
Private Sub DA0Text_Change()
DA0Text.Text = UCase(DA0Text.Text)
End Sub
Private Sub DA0Text_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call StartCMD_Click End If
End Sub
Private Sub DA1Text_Change()
DA1Text.Text = UCase(DA1Text.Text)
End Sub
Private Sub DA1Text_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call StartCMD_Click End If
End Sub
Private Sub DoText_Change()
DoText.Text = UCase(DoText.Text)
End Sub
Private Sub DoText_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call StartCMD_Click End If
End Sub
Private Sub ExitCMD_Click()
Unload Me
End Sub
Private Sub Form_Load()
Page 18
OME-PCI-180x Software Manual
Dim TotalBoards As Integer Dim RetValue As Integer
CR = Chr$(13) LF = Chr$(10) RetValue = P180X_DriverInit(TotalBoards) If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue) + CR + LF + _
"The 180X Card Not Found !", 0, "P180X Return Error Code !")
Exit Sub End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call P180X_DriverClose
End Sub
Private Sub StartCMD_Click()
Dim V0 As Single Dim Didata As Integer Dim dadata As Integer Dim RetValue, ret, cc, Dodata As Integer
AdNumber = 100 RetValue = P180X_ActiveBoard(0) If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue) + CR + LF + "The 180X Card Not Found
!", 0, "P180X Return Error Code !") Exit Sub End If Dodata = Val("&H" + DoText.Text) RetValue = P180X_Do(Dodata) If RetValue <> 0 Then ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P180X Return Error Code !") Exit Sub End If RetValue = P180X_Di(Didata) If RetValue <> 0 Then ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P180X Return Error Code !")
Exit Sub
End If DiText.Text = Hex(Didata) dadata = Val("&h" + DA0Text.Text) RetValue = P180X_Da(0, dadata) dadata = Val("&h" + DA1Text.Text) RetValue = P180X_Da(1, dadata) If RetValue <> 0 Then ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P180X Return Error Code !") Exit Sub End If RetValue = P180X_SetChannelConfig(0, 0) ' // +/- 5V range RetValue = RetValue + P180X_DelayUs(23) ' // delay 23 us settling time RetValue = RetValue + P180X_AdPolling(V0)
If RetValue <> 0 Then ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P180X Return Error Code !") Exit Sub End If
Page 19
OME-PCI-180x Software Manual
CH0Text.Text = Format(V0, "#0.000")
RetValue = P180X_SetChannelConfig(1, 0) ' // +/- 5V range RetValue = RetValue + P180X_DelayUs(23) ' // delay 3 us settling time RetValue = RetValue + P180X_AdPolling(V0) If RetValue <> 0 Then ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P180X Return Error Code !") Exit Sub End If CH1Text.Text = Format(V0, "#0.000") RetValue = P180X_SetChannelConfig(0, 0) ' Ch:0, +/- 5V range RetValue = RetValue + P180X_DelayUs(23) ' // delay 3 us settling time RetValue = RetValue + P180X_AdsPolling(AdBuf(0), AdNumber) '
Call ShowWave
End Sub
Page 20
OME-PCI-180x Software Manual
1.7 Using With Delphi

P180X.PAS Æ unit file

P180X.DLL Æ DLLs
NOTE : 1. Tested under Windows 95/NT and Delphi 3.0 (32 bit)
1.7.1 P180X.PAS
unit P180X;
interface
type PSingle=^Single; type PWord=^Word;
const // return code NoError = 0; DriverHandleError = 1; DriverCallError = 2; AdControllerError = 3; M_FunExecError = 4; ConfigCodeError = 5; FrequencyCalculateError = 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;
Page 21
OME-PCI-180x Software Manual
ExceedBoardNumber = 19; NotFoundBoard = 20; OpenError = 21; FindTwoBoardError = 22; ThreadCreateError = 23; StopError = 24; AllocateMemoryError = 25;
// Function of Test function P180X_FloatSub2(fA:Single; fB:Single):Single ; stdCall; function P180X_ShortSub2(nA:SmallInt; nB:SmallInt):SmallInt ; stdCall; function P180X_GetDllVersion:WORD ; stdCall;
// Function of Driver function P180X_DriverInit(Var wTotalBoards:Word):WORD ; stdCall; procedure P180X_DriverClose; stdCall; function P180X_GetDriverVersion(var wDriverVersion:Word):WORD ; stdCall;
function P180X_GetConfigAddressSpace(wBoardNo:Word;
var wAddrTimer:Word; var wAddrCtrl:Word; var wAddrDio:Word; var wAddrAdda:Word):WORD ; stdCall; function P180X_ActiveBoard(wBoardNo:Word):WORD ; stdCall; function P180X_WhichBoardActive:WORD ; stdCall;
// Function of M_Fun series function P180X_M_FUN_1(wDaFrequency:WORD; wDaWave:WORD;
fDaAmplitude:Single; wAdClock:WORD; wAdNumber:WORD; wAdConfig:WORD;
fAdBuf:PSingle; fLowAlarm:Single; fHighAlarm:Single):WORD ; stdCall;
function P180X_M_FUN_2(wDaNumber:WORD; wDaWave:WORD;
wDaBuf:PWord; wAdClock:WORD; wAdNumber:WORD; wAdConfig:WORD;
wAdBuf:PWord):WORD ; stdCall;
function P180X_M_FUN_3(wDaFrequency:WORD; wDaWave:WORD;
fDaAmplitude:Single; wAdClock:WORD; wAdNumber:WORD;
wChannelStatus:PWord; wAdConfig:PWord; fAdBuf:PSingle; fLowAlarm:Single; fHighAlarm:Single):WORD ; stdCall;
Page 22
OME-PCI-180x Software Manual
function P180X_M_FUN_4(wType:WORD; wDaFrequency:WORD;
wDaWave:WORD; fDaAmplitude:Single; wAdClock:WORD; wAdNumber:WORD;
wChannelStatus:PWord; wAdConfig:PWord; fAdBuf:PSingle; fLowAlarm:Single;
fHighAlarm:Single):WORD ; stdCall;
// Function of DI/DO function P180X_Do(wOutData:Word):Word; stdCall; function P180X_Di(var wDiData:Word):WORD ; stdCall;
// Function of AD/DA function P180X_Da(wDaChannel:Word; wDaVal:Word):WORD ; stdCall; function P180X_SetChannelConfig(wAdChannel:Word;
wConfig:Word):WORD ; stdCall; function P180X_AdPolling(var fAdVal:Single):WORD ; stdCall; function P180X_AdsPolling(fAdVal:PSingle; wNum:Word):WORD ; stdCall; function P180X_AdsPacer(fAdVal:PSingle; wNum:Word; wSamplingDiv:Word ):WORD ; stdCall;
//******************* function P180X_ClearScan:WORD ; stdCall; function P180X_StartScan(wSampleRateDiv:WORD; dwNum:LongInt;
nPriority:SmallInt):WORD ; stdCall; procedure P180X_ReadScanStatus(var wStatus:WORD;
var dwLowAlarm:LongInt; var dwHighAlarm:LongInt); stdCall; function P180X_AddToScan(wAdChannel:WORD; wConfig:WORD;
wAverage:WORD; wLowAlarm:WORD; wHighAlarm:WORD;
wAlarmType:WORD):WORD ; stdCall; function P180X_SaveScan(wAdChannel:WORD; wBuf:PWord):WORD ; stdCall; procedure P180X_WaitMagicScanFinish(var wStatus:WORD;
var dwLowAlarm:LongInt; var dwHighAlarm:LongInt); stdCall;
function P180X_StopMagicScan:WORD ; stdCall;
//******************* function P180X_DelayUs(wDelayUs:WORD):WORD ; stdCall;
Page 23
OME-PCI-180x Software Manual
//******************* //function P180X_Card0_StartScan( wSampleRate:WORD; // wChannelStatus:PWORD; wChannelConfig:PWORD; // wCount:WORD):WORD ; stdCall; function P180X_Card0_StartScan( wSampleRate:WORD;
wChannelStatus:PWORD; wChannelConfig:PWORD;
wCount:WORD):WORD ; stdCall; function P180X_Card0_ReadStatus(wBuf:PWORD; wBuf2:PWORD; var dwP1:LongInt; var dwP2:LongInt; var wStatus:WORD):WORD ; stdCall; procedure P180X_Card0_Stop; stdCall;
function P180X_Card1_StartScan(wSampleRate:WORD;
wChannelStatus:PWORD; wChannelConfig:PWORD;
wCount:WORD):WORD ; stdCall; function P180X_Card1_ReadStatus(wBuf:PWORD; wBuf2:PWORD;
var dwP1:LongInt; var dwP2:LongInt;
var wStatus:WORD):WORD ; stdCall; procedure P180X_Card1_Stop; stdCall;
//******************* function P180X_FunA_Start( wClock0Div:WORD; wChannel0:PWord; wConfig0:PWord; Buffer0:PWord; dwMaxCount0:LongInt; wClock1Div:WORD; wChannel1:PWord; wConfig1:PWord; Buffer1:PWord; dwMaxCount1:LongInt; nPriority:SmallInt):WORD ; stdCall; function P180X_FunA_ReadStatus:WORD ; stdCall; function P180X_FunA_Stop:WORD ; stdCall; function P180X_FunA_Get(var P0:LongInt; var P1:LongInt):WORD ; stdCall;
//******************* function P180X_FunB_Start( wClock0Div:WORD; wChannel0:PWord; wConfig0:PWord; Buffer0:PWord; dwMaxCount0:LongInt; nPriority:SmallInt):WORD ; stdCall; function P180X_FunB_ReadStatus:WORD ; stdCall; function P180X_FunB_Stop:WORD ; stdCall; function P180X_FunB_Get(var P0:LongInt):WORD ; stdCall;
Page 24
OME-PCI-180x Software Manual
//********************************************************************************* //********************************************************************************* implementation
function P180X_FloatSub2; external 'P180X.DLL' name 'P180X_FloatSub2'; function P180X_ShortSub2; external 'P180X.DLL' name 'P180X_ShortSub2'; function P180X_GetDllVersion; external 'P180X.DLL' name 'P180X_GetDllVersion'; function P180X_GetDriverVersion; external 'P180X.DLL' name 'P180X_GetDriverVersion';
function P180X_DriverInit; external 'P180X.DLL' name 'P180X_DriverInit'; procedure P180X_DriverClose; external 'P180X.DLL' name 'P180X_DriverClose'; function P180X_GetConfigAddressSpace; external 'P180X.DLL' name 'P180X_GetConfigAddressSpace'; function P180X_ActiveBoard; external 'P180X.DLL' name 'P180X_ActiveBoard'; function P180X_WhichBoardActive; external 'P180X.DLL' name 'P180X_WhichBoardActive';
// Function of M_Fun series function P180X_M_FUN_1; external 'P180X.DLL' name 'P180X_M_FUN_1'; function P180X_M_FUN_2; external 'P180X.DLL' name 'P180X_M_FUN_2'; function P180X_M_FUN_3; external 'P180X.DLL' name 'P180X_M_FUN_3'; function P180X_M_FUN_4; external 'P180X.DLL' name 'P180X_M_FUN_4';
function P180X_Do; external 'P180X.DLL' name 'P180X_Do'; function P180X_Di; external 'P180X.DLL' name 'P180X_Di';
function P180X_Da; external 'P180X.DLL' name 'P180X_Da'; function P180X_SetChannelConfig; external 'P180X.DLL' name 'P180X_SetChannelConfig'; function P180X_AdPolling; external 'P180X.DLL' name 'P180X_AdPolling'; function P180X_AdsPolling; external 'P180X.DLL' name 'P180X_AdsPolling';
Page 25
Loading...
+ 57 hidden pages