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.
Insert the CD ROM included with your OME-PCI-1202 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-1202 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.
5
Page 6
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 NMAKE.EXE to compile and link the demo code. For example,
C:\P1202\DEMO\VC\nmake /f demo1.mak
Driver Folder
Contains software drivers, include files and definition files for 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).
6
Page 7
1.2 Plug & Play Installation for
Windows
The 1202.inf file provides all the information needed to complete the Plug & Play
installation. After the installation, Windows will reserve the resources and update the
registry. The Plug & Play information is shown in Fig 1(Windows 2000 device manager).
Figure 2 shows the resources reserved. If the user runs “c:\WINNT\regedit.exe”, the registry
information of the OME-PCI-1202H/L can be found under
“HKEY_LOCAL_MACHINE\System\CurrentControlSet001\Services\P1202” as in Fig 3.
The Fig 4 shows the registry items in detail.
Fig 1. The Plug & Play information
7
Page 8
Fig 2. The allocated resources for this OME-PCI-1202.
Fig 3. Registry Path and Keys
8
Page 9
Fig 4. Registry Item Detail
9
Page 10
1.3 Using With Visual C++
All the demo programs have been developed and tested using Windows 95/NT
and Visual C++ 4.0 compiler. The key points are given as 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 in Visual C++.
3. The source program must include “P1202.H”
4. Copy the P1202.LIB, import library, to the same directory as the source program.
5. Copy the P1202.DLL, to the same directory as the source program
6. Edit the source program (e.g. DEMO1.C)
7. Edit the NMAKE file (e.g. DEMO1.MAK)
8. NMAKE /f DEMO1.MAK
9. Execute DEMO1.EXE
NOTE: The P1202.lib is used at linking time and the P1202.DLL is at run time.
1.4 Using With MFC
The key points for using MFC are given as below:
1. Use MFC wizard to create source code
2. The source program must include “P1202.H”
3. Copy the P1202.LIB, import library, to the same directory as the source program
4. Copy the P1202.DLL, to the same directory as the source program
5. Select Build/Settings/Link and key “P1202.lib” in the object/library
modules field
NOTE: The P1202.lib is used at linking time and the P1202.DLL is used at run
time.
10
Page 11
1.5 Using With BC++
The drivers were created with Visual C++ 4.0. The P1202.H and P1202.lib are
also directly compatible with Visual C/C++. You cannot use these files with BC++.
else printf("get P1202_FloatSub2 function address error");
// Step 5 : free library
FreeLibrary(hDLLib);
}
else printf("load P1202.dll error");
getch();
}
By incorporating these modifications and the P1202.DLL, the user can use
BC++ to call the driver.
11
Page 12
1.6 Using With Visual Basic
\DEMO\VB\P1202.DLL Æ DLLs
\DEMO\VB\DEMO1.FRM Æ Form file
\DEMO\VB\P1202.BAS Æ Module file
\DEMO\VB\DEMO1.VBP Æ Project file
NOTE: 1. Tested under Windows 95/NT and VB 4.0 (32 bits)
• The Demo1 Result:
12
Page 13
• The P1202.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 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 InvalidateDelay = 14
Global Const DelayTimeOut = 15
Global Const InvalidateData = 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 P1202_DriverInit Lib "P1202.dll" (wTotalBoards As Integer) As Integer
Declare Sub P1202_DriverClose Lib "P1202.dll" ()
Declare Function P1202_GetDriverVersion Lib "P1202.dll" (wVxdVersion As Integer) As Integer
Declare Function P1202_GetConfigAddressSpace Lib "P1202.dll" (ByVal wBoardNo As Integer, _
wAddrTimer As Integer, wAddrCtrl As Integer, wAddrDio As Integer, _
wAddrAdda As Integer) As Integer
Declare Function P1202_ActiveBoard Lib "P1202.dll" (ByVal wBoardNo As Integer) As Integer
Declare Function P1202_WhichBoardActive Lib "P1202.dll" () As Integer
Declare Function P1202_M_FUN_1 Lib "P1202.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 P1202_M_FUN_2 Lib "P1202.dll" (ByVal wDaNumber As Integer, _
13
Page 14
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 P1202_M_FUN_3 Lib "P1202.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 P1202_M_FUN_4 Lib "P1202.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 P1202_Di Lib "P1202.dll" (wDi As Integer) As Integer
Declare Function P1202_Do Lib "P1202.dll" (ByVal wDo As Integer) As Integer
Declare Function P1202_Da Lib "P1202.dll" (ByVal wDaChannel As Integer, _
ByVal wDaVal As Integer) As Integer
Declare Function P1202_SetChannelConfig Lib "P1202.dll" (ByVal wAdChannel As Integer, _
ByVal wConfig As Integer) As Integer
Declare Function P1202_AdPolling Lib "P1202.dll" (fAdVal As Single) As Integer
Declare Function P1202_AdsPolling Lib "P1202.dll" (fAdVal As Single, ByVal wNum As Integer) _
As Integer
Declare Function P1202_AdsPacer Lib "P1202.dll" (fAdVal As Single, ByVal wNum As Integer, _
ByVal wSample As Integer) As Integer
Declare Function P1202_ClearScan Lib "P1202.dll" () As Integer
Declare Function P1202_StartScan Lib "P1202.dll" (ByVal wSampleRate As Integer, _
ByVal dwNum As Long, ByVal nPriority As Integer) As Integer
Declare Sub P1202_ReadScanStatus Lib "P1202.dll" (wStatus As Integer, dwLowAlarm As Long, _
dwHighAlarm As Long)
Declare Function P1202_AddToScan Lib "P1202.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 P1202_SaveScan Lib "P1202.dll" (ByVal wOridinalOrder As Integer, _
wBuf As Integer) As Integer
Declare Sub P1202_WaitMagicScanFinish Lib "P1202.dll" (wStatus As Integer, _
wLowAlarm As Integer, _ wHighAlarm As Integer)
Declare Function P1202_StopMagicScan Lib "P1202.dll" () As Integer
Declare Function P1202_DelayUs Lib "P1202.dll" (ByVal wDelayUs As Integer) As Integer
'------------------------ FunA series ----------------------------
'------------------------ FunB series ---------------------------Declare Function P1202_FunB_Start Lib "P1202.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 P1202_FunB_ReadStatus Lib "P1202.dll" () As Integer
Declare Function P1202_FunB_Stop Lib "P1202.dll" () As Integer
Declare Function P1202_FunB_Get Lib "P1202.dll" (P0 As Long) As Integer
14
Page 15
Declare Function P1202_Card0_StartScan Lib "P1202.dll" (ByVal wSampleRate As Integer, _
wChannelStatus As Integer, wChannelConfig As Integer, ByVal wCount As Integer) As
Integer
Declare Function P1202_Card0_ReadStatus Lib "P1202.dll" (wBuf As Integer, wBuf2 As Integer, _
dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer
Declare Sub P1202_Card0_Stop Lib "P1202.dll" ()
Declare Function P1202_Card1_StartScan Lib "P1202.dll" (ByVal wSampleRate As Integer, _
wChannelStatus As Integer, wChannelConfig As Integer, _
ByVal wCount As Integer) As Integer
Declare Function P1202_Card1_ReadStatus Lib "P1202.dll" (wBuf As Integer, wBuf2 As Integer, _
dwP1 As Long, dwP2 As Long, wStatus As Integer) As Integer
Declare Sub P1202_Card1_Stop Lib "P1202.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
15
Page 16
DEMO1.FRM
Public Sub ShowWave()
Dim a(1000), yc, xc, xl, yt As Single
Dim ii As Integer
Dim tmpstr$
"The 180X Card Not Found !", 0, "P1202 Return Error Code !")
Exit Sub
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call P1202_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 = P1202_ActiveBoard(0)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue) + CR + LF + "The 180X Card Not
Found !", 0, "P1202 Return Error Code !")
Exit Sub
End If
Dodata = Val("&H" + DoText.Text)
RetValue = P1202_Do(Dodata)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P1202 Return Error Code !")
Exit Sub
End If
RetValue = P1202_Di(Didata)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P1202 Return Error Code !")
Exit Sub
End If
DiText.Text = Hex(Didata)
dadata = Val("&h" + DA0Text.Text)
RetValue = P1202_Da(0, dadata)
dadata = Val("&h" + DA1Text.Text)
RetValue = P1202_Da(1, dadata)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P1202 Return Error Code !")
Exit Sub
End If
RetValue = P1202_SetChannelConfig(0, 0) ' // +/- 5V range
RetValue = RetValue + P1202_DelayUs(23) ' // delay 23 us settling time
RetValue = RetValue + P1202_AdPolling(V0)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P1202 Return Error Code !")
Exit Sub
17
Page 18
End If
CH0Text.Text = Format(V0, "#0.000")
RetValue = P1202_SetChannelConfig(1, 0) ' // +/- 5V range
RetValue = RetValue + P1202_DelayUs(23) ' // delay 3 us settling time
RetValue = RetValue + P1202_AdPolling(V0)
If RetValue <> 0 Then
ret = MsgBox("The Return Error Code = " + Str$(RetValue), 0, "P1202 Return Error Code !")
Exit Sub
End If
CH1Text.Text = Format(V0, "#0.000")
RetValue = P1202_SetChannelConfig(0, 0) ' Ch:0, +/- 5V range
RetValue = RetValue + P1202_DelayUs(23) ' // delay 3 us settling time
RetValue = RetValue + P1202_AdsPolling(AdBuf(0), AdNumber) '
Call ShowWave
End Sub
18
Page 19
1.7 Using With Delphi
P1202.PAS Æ unit file
P1202.DLL Æ DLLs
UNIT1.PAS Æ demo source file
UNIT1.DFM Æ form file
PROJECT1.DPR Æ project file
NOTE: 1. tested under Windows 95/NT and Delphi 2.0 (32 bits)
2. The P1202.PAS is designed for demo purposes and the P1202.PAS now
only supports “P1202_ShortSub2(A,B)”. The user can modify this file to
support all driver functions.
unit P1202;
interface
function P1202_ShortSub2(a: smallint; b: smallint): smallint; StdCall;
implementation
function P1802_ShortSub2; external 'P1202.DLL' name 'P1202_ShortSub2';
end.
procedure TForm1.Button1Click(Sender: TObject) ;
var
a,b,c : smallint;
begin
a := StrToInt(Edit1.text);
b := StrToInt(Edit2.text);
c := P1202_ShortSub2(a,b);
Edit3.text := IntToStr(c);
end;
P1202.PAS
UNIT1.PAS
(partial)
end.
19
Page 20
1.8 Using With LabVIEW
LabVIEW is an industrial graphical programming language developed by
National Instruments.
P1202.Dll Æ DLL
DEMO1.VI Æ Demo VI
MFUN1.VI Æ Driver VI
NOTE:
1. Tested under Windows 95/NT and LabVIEW 4.0
2. The demo1.VI will call MFUN1.VI to perform M_Functions. The M_Functions
can send an arbitrary waveform to the D/A output and perform A/D input at the
same time. If D/A channel_0 is connected to A/D channel_0, M_Functions can
measure the D/A output back. The output response is shown in Fig 8 and the
connection diagram for demo1.VI is given in Fig. 9.
Fig 8. The Output of DEMO1.VI (call M_FUN_1)
20
Page 21
Fig 9. The Connection Diagram of DEMO1.VI (call MFUN1.VI)
Fig 10. The Connecting Diagram of MFUN1.VI (call DLL M_FUN_1)
21
Page 22
1.9 Demo Program
A common demo program is used for all p1202.dll demonstrations. The demo
program will accept wDaFreq and wAdClk
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include "P1202.H"
/********************************************************************/
/* DEMO1 program for one P1202 card in the PC system. */
/* Please set the resolution of your monitor to at least 1024x768.*/
/********************************************************************/
/* First Card: P1202 function call demo. */
/* For the proper operation the P1202, the following functions */
/* must be used. */
/* P1202_DriverInit(); <-- initial the driver */
/* P1202_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 P1202_DriverInit() to initialize the driver. */
/**************************************************************/
// Initialize the device driver, and return the board number in the PC
wInitialCode=P1202_DriverInit(&wTotalBoard);
if( wInitialCode!=NoError )
{
MessageBox(hwnd,"No P1202 card in this system !!!",
"P1202 Card Error",MB_OK);
}
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
GetTextMetrics(hdc, &tm);
cxChar=tm.tmAveCharWidth;
cyChar=tm.tmHeight;
ReleaseDC(hwnd, hdc);
return 0;
case WM_SIZE :
cxClient=LOWORD(lParam); // window size in pixels
cyClient=HIWORD(lParam);
cxBuffer=max(1,cxClient/cxChar); // window size in characters
cyBuffer=max(1,cyClient/cyChar);
return 0;
case WM_SETFOCUS :
CreateCaret(hwnd, NULL, cxChar, cyChar);
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 P1202_DriverClose() to close the driver. */
/**************************************************************/
P1202_DriverClose(); // close the driver
EXPORTS float CALLBACK P1202_FloatSub2(float fA, float fB);
EXPORTS short CALLBACK P1202_ShortSub2(short nA, short nB);
EXPORTS WORD CALLBACK P1202_GetDllVersion(void);
EXPORTS WORD CALLBACK P1202_DriverInit(WORD *wTotalBoards);
EXPORTS void CALLBACK P1202_DriverClose(void);
EXPORTS WORD CALLBACK P1202_GetDriverVersion(WORD *wVxdVersion);
EXPORTS WORD CALLBACK P1202_GetConfigAddressSpace(WORD wBoardNo,
WORD *wAddrTimer,WORD *wAddrCtrl, WORD *wAddrDio, WORD *wAddrAdda);
EXPORTS WORD CALLBACK P1202_ActiveBoard( WORD wBoardNo );
30
Page 31
EXPORTS WORD CALLBACK P1202_WhichBoardActive(void);
EXPORTS WORD CALLBACK P1202_M_FUN_1(WORD wDaFrequency, WORD wDaWave,
float fDaAmplitude, WORD wAdClock, WORD wAdNumber,
WORD wAdConfig, float fAdBuf[],
float fLowAlarm, float fHighAlarm);
EXPORTS WORD CALLBACK P1202_M_FUN_2(WORD wDaNumber, WORD wDaWave,
WORD wDaBuf[], WORD wAdClock, WORD wAdNumber,
WORD wAdConfig, WORD wAdBuf[]);
EXPORTS WORD CALLBACK P1202_M_FUN_3(WORD wDaFrequency, WORD wDaWave,
float fDaAmplitude, WORD wAdClock, WORD wAdNumber,
WORD wChannelStatus[], WORD wAdConfig[],
float fAdBuf[], float fLowAlarm, float fHighAlarm);
EXPORTS WORD CALLBACK P1202_M_FUN_4(WORD wType, WORD wDaFrequency, WORD
wDaWave,
float fDaAmplitude, WORD wAdClock, WORD wAdNumber,
WORD wChannelStatus[], WORD wAdConfig[],
float fAdBuf[], float fLowAlarm, float fHighAlarm);
EXPORTS WORD CALLBACK P1202_Di(WORD *wDi);
EXPORTS WORD CALLBACK P1202_Do(WORD wDo);
EXPORTS WORD CALLBACK P1202_Da(WORD wDaChannel, WORD wDaVal);
EXPORTS WORD CALLBACK P1202_SetChannelConfig(WORD wAdChannel,
WORD wConfig);
EXPORTS WORD CALLBACK P1202_AdPolling(float *fAdVal);
EXPORTS WORD CALLBACK P1202_AdsPolling(float fAdVal[], WORD wNum);
EXPORTS WORD CALLBACK P1202_AdsPacer(float fAdVal[], WORD wNum,
WORD wSample);
EXPORTS WORD CALLBACK P1202_ClearScan(void);
EXPORTS WORD CALLBACK P1202_StartScan(WORD wSampleRateDiv, DWORD dwNum,
SHORT nPriority);
EXPORTS void CALLBACK P1202_ReadScanStatus(WORD *wStatus,
DWORD *dwLowAlarm, DWORD *dwHighAlarm);
EXPORTS WORD CALLBACK P1202_AddToScan(WORD wAdChannel, WORD wConfig,
WORD wAverage, WORD wLowAlarm, WORD wHighAlarm,
WORD wAlarmType);
EXPORTS WORD CALLBACK P1202_SaveScan(WORD wAdChannel, WORD wBuf[]);
EXPORTS void CALLBACK P1202_WaitMagicScanFinish(WORD *wStatus,
DWORD *dwLowAlarm, DWORD *dwHighAlarm);
EXPORTS WORD CALLBACK P1202_StopMagicScan();
EXPORTS WORD CALLBACK P1202_DelayUs(WORD wDelayUs);
EXPORTS WORD CALLBACK P1202_Card0_StartScan(WORD wSampleRate, WORD
wChannelStatus[],
WORD wChannelConfig[],WORD wCount);
EXPORTS WORD CALLBACK P1202_Card0_ReadStatus(WORD wBuf[], WORD wBuf2[],
DWORD *dwP1, DWORD *dwP2,
WORD *wStatus);
EXPORTS void CALLBACK P1202_Card0_Stop(void);
31
Page 32
EXPORTS WORD CALLBACK P1202_Card1_StartScan(WORD wSampleRate,
WORD wChannelStatus[],WORD wChannelConfig[],WORD wCount);
EXPORTS WORD CALLBACK P1202_Card1_ReadStatus(WORD wBuf[], WORD wBuf2[],
DWORD *dwP1, DWORD *dwP2,WORD *wStatus);
EXPORTS void CALLBACK P1202_Card1_Stop(void);
EXPORTS WORD CALLBACK P1202_FunA_Start(WORD wClock0Div, WORD wChannel0[],
WORD wConfig0[], WORD *Buffer0, DWORD dwMaxCount0,
WORD wClock1Div, WORD wChannel1[],WORD wConfig1[],
WORD *Buffer1, DWORD dwMaxCount1, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_FunA_ReadStatus(void);
EXPORTS WORD CALLBACK P1202_FunA_Stop(void);
EXPORTS WORD CALLBACK P1202_FunA_Get(DWORD *P0, DWORD *P1);
EXPORTS WORD CALLBACK P1202_FunB_Start(WORD wClock0Div, WORD wChannel0[],
WORD wConfig0[], WORD *Buffer0, DWORD dwMaxCount0, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_FunB_ReadStatus(void);
EXPORTS WORD CALLBACK P1202_FunB_Stop(void);
EXPORTS WORD CALLBACK P1202_FunB_Get(DWORD *P0);
EXPORTS WORD CALLBACK P1202_StartScanPostTrg(WORD wSampleRateDiv,
DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_StartScanPreTrg(WORD wSampleRateDiv,
DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_StartScanMiddleTrg(WORD wSampleRateDiv,
DWORD dwN1, DWORD dwN2, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_StartScanPreTrgVerC(WORD wSampleRateDiv,
DWORD dwNum, SHORT nPriority);
EXPORTS WORD CALLBACK P1202_StartScanMiddleTrgVerC(WORD wSampleRateDiv,
DWORD dwN1, DWORD dwN2, SHORT nPriority);
32
Page 33
2.3 The Test Functions
2.3.1 P1202_FloatSub2
z Description:
Calculates C=A-B in float format, float=4 bytes floating point number. This function is
zDescription : This function will perform A/D conversions on a single channel by
software polling The P1202_SetChannelConfig function can be used to change channel
or configuration code and the P1202_AdPolling will refer to that condition in later
operation. This function will refer to the current active OME-PCI-1202 board. Use the
P1202_ActiveBoard(….) to select the active board.
z Syntax : WORD P1202_AdPolling(float *fAdVal);
z Input Parameter :
*fAdVal : address of fAdVal which contains the A/D data. The data is converted
to volts based on the setting of P1202_SetChannelConfig.
z Return Value :
NoError : OK
ExceedBoardNumber: invalidate board number
FindBoardError : cannot find the OME-PCI-1202 board
AdPollingTimeOut : hardware timeout error
zDemo Program : DEMO1.C
40
Page 41
2.7.3 P1202_AdsPolling
zDescription : This function performs multiple A/D conversions on a single channel
by polling. The P1202_AdsPolling function is controlled by software polling so the A/D
conversion process could be disturbed by operating system interrupts. Since the hardware
pacer is used to control the A/D process with the P1202_AdsPacer function, it is a better
choice if a waveform must be precisely reconstructed. The P1202_SetChannelConfig
function can be used to change channel or configuration code. This function will refer to
the current active OME-PCI-1202 board. Use the P1202_ActiveBoard(….) to select the
active board.
z Syntax : WORD P1202_AdsPolling(float fAdVal[], WORD wNum);
z Input Parameter :
fAdVal[]: starting address of the A/D data buffer, the data will be converted to
volts based on the setting of P1202_SetChannelConfig.
wNum: number of A/D conversions to be performed.
• Return Value :
NoError: OK
ExceedBoardNumber: invalid board number
FindBoardError: cannot find the OME-PCI-1202 board
AdPollingTimeOut: hardware timeout error
zDemo Program : DEMO1.C
41
Page 42
2.7.4 P1202_AdsPacer
zDescription : This function will perform multiple A/D conversions by pacer trigger.
The P1202_SetChannelConfig function can be used to change the channel or
configuration code. The hardware pacer will generate a periodic A/D trigger signal. So
the AD data can be used to reconstruct the waveform of the analog input. The
P1202_AdsPolling function is controlled by software polling so the A/D conversion
process could be disturbed by operating system interrupts. Since the hardware pacer is
used to control the A/D process in the P1202_AdsPacer function, it is a better choice if a
waveform must be precisely reconstructed. This function will refer to the current active
OME-PCI-1202 board. Use the P1202_ActiveBoard(….) to select the active board.
z Syntax : WORD P1202_AdsPacer(float fAdVal[], WORD wNum, WORD wSample);
z Input Parameter :
fAdVal[] : starting address of the A/D data buffer, the data will be automatically
calculate based on the setting of the P1202_SetChannelConfig
function.
wNum : number of A/D conversions to be performed.
wSample : AD sample rate = 8M/wSample.
for example: wSample=80 Æ sample rate=8M/80=100K
z Return Value :
NoError : OK
ExceedBoardNumber: invalid board number
FindBoardError : cannot find the OME-PCI-1202 board
AdPollingTimeOut : hardware timeout error
zDemo Program : DEMO1.C
P1202_SetChannelConfig
P1202_AdPolling
P1202_AdsPollng
Fix channel AD conversion mode
P1202_AdsPacer
42
Page 43
2.8 The MagicScan Functions
2.8.1 P1202_ClearScan
zDescription : This function will set the MagicScan controller to its initial state. This
function will refer to the current active OME-PCI-1202 board. Use the
P1202_ActiveBoard(….) function to select the active board.
z Syntax : WORD P1202_ClearScan();
z Input Parameter : void
z Return Value :
NoError : OK
ExceedBoardNumber: invalid board number
FindBoardError : cannot find the OME-PCI-1202 board
zDescription : This function will specify the starting address of the A/D data buffer
for MagicScan.
z Syntax : void P1202_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
zReturn Value :
NoError : Ok
ExceedBoardNumber: invalid board number
FindBoardError : cannot find the OME-PCI-1202 board
AdChannelError : invalid A/D channel
z Demo Program : DEMO11.C
• Code Fragment
WORD wV0[100000]; // AD ch:0 buffer
WORD wV2[100000]; // AD ch:2 buffer
:
:
wRetVal=P1202_ClearScan();
//**** For OME-PCI-1202L
wRetVal += P1202_AddToScan(0,0,1,0,0,0); // CH:0 to scan
wRetVal += P1202_SaveScan(0,wV0);
wRetVal += P1202_AddToScan(2,0,1,0,0,0); // CH:2 to scan
wRetVal += P1202_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
P1202_StartScan(wSampleRateDiv,DATALENGTH,nPriority);
47
Page 48
2.8.6 P1202_WaitMagicScanFinish
zDescription : This function will delay until the MagicScan operation is finished.
This function will refer to the current active OME-PCI-1202 board. Use the
P1202_ActiveBoard(….) to select the active board.
zSyntax : void P1202_WaitMagicScanFinish(WORD *wStatus, WORD
*wLowAlarm, WORD *wHighAlarm);
zInput Parameter : [output]
*wStatus : address of wStatus which store the MagicScan status
*wLowAlarm : address of wLowAlarm which store the MagicScan alarm status
*dwHighAlarm : address of wHighAlarm which store the MagicScan alarm
WORD DelayMs(WORD wDelayMs) // maximum delay=4294967.295 sec
{
WORD wDelay,wRetVal
wRetVal=0;
for (wDelay=0; wDelay<wDelayMs; wDelay++)
wRetVal+=P1202_DelayUs(1000);
return(wRetVal);
}
63
Page 64
3. Demo Program
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 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, P180X_FUNA, batch capture demo
z demo21: single board, P180X_FUNB, batch capture demo
z demo23: single board, post-trigger demo
z demo24: single board, pre-trigger demo
z demo25: single board, middle-trigger 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’sWARRAN TY 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. Purchase 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.