Omega Engineering OME-PIO-D96 manual DEMO1

Models: OME-PIO-D96

1 51
Download 51 pages 21.71 Kb
Page 41
Image 41

4.2

DEMO1

*/

/* demo 1

: D/O demo of CN1

/* step 1

: connect a OME-DB-24C to CN1 of OME-PIO-D96

*/

/* step 2

: run DEMO1.EXE

*/

/* step 3 : check the LEDs of OME-DB-24C will turn on sequentially*/

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

#include "PIO.H"

WORD wBase,wIrq;

main()

{

i1,i2,i3;

int

long

i=1;

WORD

wBoards,wRetVal,t1,t2,t3,t4,t5,t6;

WORD

wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;

char

c;

clrscr();

 

/* step1 : find address-mapping of PIO/PISO cards

*/

wRetVal=PIO_DriverInit(&wBoards,0x80,0x01,0x10);

/* for OME-PIO-D96

*/

printf("\n(1) Threr are %d OME-PIO-D96 Cards in this PC",wBoards); if ( wBoards==0 ) exit(0);

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

The Configuration Space

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

for(i=0;i<wBoards;i++)

 

 

{

PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice 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);

}

PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&t1,&t2,&t3,&t4,&t5);

/* step2 : enable all D/I/O port

/* select card_0 */

*/

outportb(wBase,1);

/* /RESET -> 1 */

/* step3 : configure I/O direction

*/

outportb(wBase+0xcc,0x07);

/* set CN1 as D/O ports */

for (;;)

 

{

 

i1=i&0xff;

 

i2=(i>>8)&0xff;

 

i3=(i>>16)&0xff;

 

outportb(wBase+0xc0,i1);

 

outportb(wBase+0xc4,i2);

 

outportb(wBase+0xc8,i3);

 

delay(10000);

 

i=i<<1;

 

i=i&0x0ffffff;

 

if (i==0) i=1;

 

if (kbhit()!=0) return;

 

}

 

PIO_DriverClose();

 

}

 

OME-PIO-D96 User Manual (Ver.1.1, Mar/2003)

---- 39

Page 41
Image 41
Omega Engineering OME-PIO-D96 manual DEMO1