Omega OME-PIO-D144 manual Demo10 Find Card Number

Page 50

4.8Demo10: Find Card Number

/* -------------------------------------------------------------

*/

/* 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,

for (;;)

&wSubAux,&wSlotBus,&wSlotDevice);

 

 

{

press any key to stop

-------------");

printf("\n-------------

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);

outp(wBase,1);

/* enable D/I/O

*/

OME-PIO-D144 User’s Manual (Ver.2.1, Sep/2001)

---- 48

Image 50
Contents User’sGuide Benelux CanadaMexico Czech RepublicOME-PIO-D144 Table of Contents Demo Program Product Check List SpecificationsAll signals are TTL compatible Hardware configuration Board LayoutRefer to DEMO1.C for demo program Enable I/O OperationI/O Port Location O Architecture Make sure the initial level is High or Low If INT signal is Low now Æ select the non-inverted inputInterrupt Operation Refer to DEMO3.C for source code Refer to DEMO4.C for source code CN1PC0 CN1PC1 CN1PC2 CN1PC3 If PC1 is active OME-DN-37 & OME-DN-50 Daughter BoardsOME-DB-37 OME-DB-8125OME-ADP-37/PCI & OME-ADP-50/PCI OME-DB-24P OME-DB-24PD OME-DB-24P/24PD Isolated Input BoardOME-PIO-D144 OME-DB-24R/24RD Relay Board COM OME-DB-24PR OME-DB-24PR/24POR/24COME-DB-24PR Daughter Board Comparison Table GND Pin AssignmentVCC OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 PIO/PISO identification information How to Find the I/O AddressResource-allocated information PC’s physical slot informationOME-PISO-P32A32 OME-PIO-821OME-PISO-P32C32 OME-PISO-P8R8PIODriverInit PIODriverInit&wBoards, wSubVendor,wSubDevice,wSubAuxPIOGetConfigAddressSpace ShowPIOPISO Assignment of I/O Address Slot5 0x0A Slot6 0x08 Slot7 0x09 Slot8 0x07OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 I/O Address Map RESET\ Control RegisterRESET\ Address Read WriteINT Mask Control Register AUX Control RegisterAUX data Register CN1PC3 CN1PC2 CN1PC1 CN1PC0Aux Status Register Interrupt Polarity Control RegisterRead/Write 8-bit data Register Active I/O Port Control RegisterCN4PC CN4PB CN4PA CN3PC CN3PB CN3PA 9 I/O Selection Control RegisterCN2PC CN2PB CN2PA CN1PC CN1PB CN1PA CN6PC CN6PB CN6PA CN5PC CN5PB CN5PA\TC\LARGE\DEMO?\ \TC\LARGE\\TC\LARGE\LIB\ \TC\LARGE\LIB\PIO.HOME-PIO-D144.H Demo1 Use D/O of CN1 CN3 CN4 Demo2 Use D/O of CN1~CN6 PA/PB/PC Demo3 Interrupt demo1 COUNT=0Refer to Sec .5.1 for more information Demo4 Interrupt demo2 Refer to Sec .5.2 for more information Demo5 Interrupt demo3 CN1PC1 OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 Demo 6 Outport of CN1-CN6 OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 Demo10 Find Card Number OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 WARRANTY/DISCLAIMER Temperature