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.
• wBoards=0 to N Æ Number of boards found in this PC
• wSubVendor Æ SubVendor ID of board to find
• wSubDevice Æ SubDevice ID of board to find
• wSubAux Æ SubAux ID of board to find
This function can detect all OME-PIO/PISO series card in the system. It is
implemented based on the PCI Plug & Play mechanism. It will find all OME-
PIO/PISO series cards installed in this system & save all their resources in the library.
Find all PIO/PISO in this PC
/* Step 1:Detect all OME-PIO/PISO series in this PC */
wRetVal=PIO_DriverInit(&wBoards, 0xff, 0xff, 0xff); /*Find all OME-PIO_PISO*/
printf("\nThrer are %d OME-PIO_PISO Cards in this PC",wBoards);
if (wBoards==0 ) exit(0);
/* Step2: Save resource of all OME-PIO/ISO cards installed in this PC */
printf("\n-----------------------------------------------------");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i, &wBase, &wIrq, &wSubVendor, &wSubDevice, &wSubAux,
&wSlotBus, &wSlotDevice);
printf("\nCard_%d:wBase=%x,wIrq=%x,subID=[%x,%x,%x],
SlotID=[%x,%x]",i,wBase,wIrq,wSubVendor,wSubDevice,
wSubAux,wSlotBus,wSlotDevice);
printf(" --> ");
ShowPioPiso(wSubVendor,wSubDevice,wSubAux);
}
Find all OME-PIO-D144 in this PC
/* Step1: Detect all OME-PIO-D144 cards first */
wSubVendor=0x80; wSubDevice=0x01; wSubAux=0x00; /* for PIO_D144 */
wRetVal=PIO_DriverInit(&wBoards, wSubVendor, wSubDevice, wSubAux);
printf("Threr are %d OME-PIO-D144 Cards in this PC\n",wBoards);
/* Step2: Save resource of all OME-PIO-D144 cards installed in this PC */
for (i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i, &wBase, &wIrq, &wID1, &wID2, &wID3, &wID4, &wID5);
printf("\nCard_%d: wBase=%x, wIrq=%x", i, wBase, wIrq);
wConfigSpace[i][0]=wBaseAddress; /* save all resource of this card */
wConfigSpace[i][1]=wIrq; /* save all resource of this card */
}
• wBoardNo=0 to N Æ totally N+1 boards found by PIO_DriveInit(...)
• wBase Æ base address of the board control word
• wIrq Æ allocated IRQ channel number of this board
• wSubVendor Æ subVendor ID of this board
• wSubDevice Æ subDevice ID of this board
• wSubAux Æ subAux ID of this board
• wSlotBus Æ hardware slot ID1 of this board
• wSlotDevice Æ hardware slot ID2 of this board
The user can use this function to save resource of all OME-PIO/PISO cards
installed in this system. Then the application program can control all functions of
OME-PIO/PISO series card directly.
Find the configure address space of OME-PIO-D144
/* Step1: Detect all OME-PIO-D144 cards first */
wSubVendor=0x80; wSubDevice=0x01; wSubAux=0x00; /* for OME-PIO-D144 */
wRetVal=PIO_DriverInit(&wBoards, wSubVendor,wSubDevice,wSubAux);
printf("Threr are %d OME-PIO-D144 Cards in this PC\n",wBoards);
/* Step2: Save resource of all OME-PIO-D144 cards installed in this PC */
for (i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&t1,&t2,&t3,&t4,&t5);
printf("\nCard_%d: wBase=%x, wIrq=%x", i,wBase,wIrq);
wConfigSpace[i][0]=wBaseAddress; /* save all resource of this card */
wConfigSpace[i][1]=wIrq; /* save all resource of this card */
}
/* Step3: Control the OME-PIO-D144 directly */
wBase=wConfigSpace[0][0]; /* get base address the card_0 */
outp(wBase,1); /* enable all D/I/O operation of card_0 */
wBase=wConfigSpace[1][0]; /* get base address the card_1 */
outp(wBase,1); /* enable all D/I/O operation of card_1 */
This function will output a text string for the special subIDs. This text string is the
same as that defined in PIO.H
The demo program is given as follows:
wRetVal=PIO_DriverInit(&wBoards,0xff,0xff,0xff); /* find all PIO_PISO series card*/
printf("\nThrer are %d OME-PIO_PISO Cards in this PC",wBoards);
if (wBoards==0 ) exit(0);
/* ----------------------------------------------------------- */
/* demo 1 : D/O demo */
/* step 1 : connect a OME-DB-24C to CN1 of OME-PIO-D144 */
/* step 2 : run DEMO1.EXE */
/* step 3 : check the LEDs of OME-DB-24C turn on sequentially */
/* ----------------------------------------------------------- */
#include "PIO.H"
int main()
{
int i;
WORD wBoards;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) The Configuration Space -> wBase");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d:wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
/* step 1: make sure which ports are D/O ports */
/* in this demo --> only CN1_PA, CN1_PB, CN1_PC are D/O port */
/* step 2: enable all D/I/O port */
outp(wBase,1); /* enable D/I/O */
/* step 3: select the active port */
outp(wBase+0xc4,0); /* select CN1_PA */
/* step 4: send initial-value to D/O latch register of active port */
outp(wBase+0xc0,0); /* set CN1_PA0 to CN1_PA7 to 0 */
/* step 5: repeat for all D/O ports */
outp(wBase+0xc4,1); /* select CN1_PB */
outp(wBase+0xc0,0); /* set CN1_PB0 to CN1_PB7 to 0 */
outp(wBase+0xc4,2); /* select CN1_PC */
outp(wBase+0xc0,0); /* set CN1_PC0 to CN1_PC7 to 0 */
/* step 6: configure all I/O port */
outp(wBase+0xc8,0x00); /* CN1 to CN2 port are all output */
/* ------------------------------------------------------------ */
/* demo 2 : D/O demo for CN1 ~ CN6 */
/* step 1 : connect a OME-DB-24C to CN1 ~ CN6 of OME-PIO-D144 */
/* step 2 : run DEMO2.EXE */
/* step 3 : check the LED's of OME-DB-24C turn on sequentially */
/* ------------------------------------------------------------ */
#include "PIO.H"
int main()
{
int i,j,k,jj;
WORD wBoards,wRetVal;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */
printf("\n(1) There are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) The Configuration Space -> wBase");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
/* step 1: make sure which ports are D/O ports */
/* in this demo --> all D/O ports are output port */
/* step 2: enable all D/I/O port */
outp(wBase,1); /* enable D/I/O */
/* step 3: select the active port */
/* step 4: send initial-value to D/O latch register of active port */
/* step 5: repeat for all D/O ports */
for (i=0; i<18; i++)
{
outp(wBase+0xc4,i); /* select CN1 to CN6 port */
outp(wBase+0xc0,0); /* set 8-bit D/O latch register */
}
/* step 6: configure all I/O port */
outp(wBase+0xc8,0x00); /* CN1 to CN2 port are all output */
outp(wBase+0xcc,0x00); /* CN3 to CN4 port are all output */
outp(wBase+0xd0,0x00); /* CN5 to CN6 port are all output */
WORD init_low();
static void interrupt irq_service();
int COUNT,irqmask,now_int_state;
WORD wBase,wIrq;
int main()
{
int i,j;
WORD wBoards,wRetVal;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
DWORD dwVal;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00);
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PIO-D144:");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
outp(wBase+0x2a,0); /* select the non-inverte input */
now_int_state=0; /* now int_signal is low */
outp(wBase+5,1); /* enable interrupt */
enable();
}
void interrupt irq_service()
{
if (now_int_state==0)
{
COUNT++; /* find a high_pulse */
outp(wBase+0x2a,1); /* select the inverte input */
now_int_state=1; /* now int_signal is High */
}
else
{
/* find a low_pulse here */
outp(wBase+0x2a,0); /* select the non-inverte input */
now_int_state=0; /* now int_signal is High */
}
if (wIrq>=8) outp(A2_8259,0x20);
outp(A1_8259,0x20);
}
static void interrupt irq_service();
int COUNT,irqmask,now_int_state;
int main()
{
int i,j;
WORD wBoards;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
DWORD dwVal;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00);
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PIO-D144:");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
outp(wBase+5,1); /* enable interrupt */
now_int_state=1; /* now int_signal is low */
outp(wBase+0x2a,1); /* select the inverte input */
enable();
}
void interrupt irq_service()
{
if (now_int_state==0)
{
/* find a high_pulse here */
outp(wBase+0x2a,1); /* select the inverte input */
now_int_state=1; /* now int_signal is High */
}
else
{
COUNT++; /* find a low_pulse */
outp(wBase+0x2a,0); /* select the non-inverte input */
now_int_state=0; /* now int_signal is High */
}
if (wIrq>=8) outp(A2_8259,0x20);
outp(A1_8259,0x20);
}
static void interrupt irq_service();
int irqmask,now_int_state,invert,new_int_state,int_c,int_num;
int CNT_L1,CNT_L2,CNT_L3,CNT_L4;
int CNT_H1,CNT_H2,CNT_H3,CNT_H4;
int main()
{
int i,j;
WORD wBoards,wRetVal;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
DWORD dwVal;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00);
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PIO-D144:");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]",
i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
/* ------------------------------------------------------------ */
/* demo 6 : D/O demo */
/* step 1 : connect a OME-DB-24C to CN1 of OME-PIO-D144 */
/* step 2 : run DEMO6.EXE */
/* step 3 : check the LED's of OME-DB-24C turn on sequentially */
/* ------------------------------------------------------------ */
#include "PIO.H"
#include "OME-PIO-D144.H"
int main()
{
int i;
char c;
WORD wBoards;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 ) {
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) The Configuration Space -> wBase");
for(i=0; i<wBoards; i++) {
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\n(3) *** Card_0 D/O test, wBase=%x ***",wBase);
outp(D144,Disable); /* Reset DIO of D144 */
outp(D144,Enable);
outp(IO_SCR0,0x00);
/* ------------------------------------------------------------- */
/* demo 10: Find card number */
/* step 1 : run demo10.exe */
/* step 2 : connect a 50-pin flat-cable to CON2 & CON3 of card_? */
/* step 3 : The card number is shown in screen as TEST OK */
/* ------------------------------------------------------------- */
#include "PIO.H"
WORD wBase,wIrq;
WORD wBoards,wRetVal;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
int main()
{
int i,j,k;
char c;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) The Configuration Space -> wBase");
for(i=0; i<wBoards; i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]"
,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
for (;;)
{
printf("\n------------- press any key to stop -------------");
for (i=0; i<wBoards; i++) test_card(i);
delay_ms(1000); /* delay 1 sec */
if (kbhit()!=0) {getch(); break;}
}
PIO_DriverClose();
}
/* ----------------------------------------------------------- */
test_card(int card)
{
int i,j,k,ok,val;
PIO_GetConfigAddressSpace(card,&wBase,&wIrq,&wSubVendor,&wSubDevice,
&wSubAux,&wSlotBus,&wSlotDevice);
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’s WARRANTY 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 such 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-W
ARRANTY
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.