/* demo1 : D/O demo for PIO-D48 */ /* step 1 : connect CN1 of PIO-D48 to DB-24P */ /* step 2 : connect CN2 of PIO-D48 to another DB-24P */ /* step 3 : run DEMO2.EXE */ /* ----------------------------------------------------------- */ #include "PIO.H" WORD wBase,wIrq; WORD wBase2,wIrq2; int main() { int i,j,j1,j2,j3,j4,k,jj,dd,j11,j22,j33,j44; WORD wBoards,wRetVal; WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice,t1,t2,t3,t4,t5; char c; float ok,err; /* step 1: find address-mapping of PIO/PISO cards */ clrscr(); wRetVal=PIO_DriverInit(&wBoards,0x80,0x01,0x30); /* for PIO-D48 */ printf("\nThrer are %d PIO-D48 Cards in this PC",wBoards); if (wBoards==0) exit(0); printf("\n----------------- The Configuration Space -------------------------"); for(i=0; i "); ShowPioPiso(wSubVendor,wSubDevice,wSubAux); } /* select card_0 */ PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&t1,&t2,&t3,&t4,&t5); /* step 2: enable all D/I/O port */ outportb(wBase,1); /* enable D/I/O */ /* step 3: program 8255-1-PA-PB-PC as input port */ outportb(wBase+0xcc,0x9B); /* 8255-1-PA,PB,PC are all input port */ /* step 4: program 8255-2-PA-PB-PC as input port */ outportb(wBase+0xdc,0x9B); /* 8255-2-PA,PB,PC are all input port */ printf("\n----------- Test D/I (DB-24P)--------------"); i=1; ok=err=0.0; for (;;) { /* read D/I data from CN1 of PIO_D48 */ j1=inportb(wBase+0xc0); j2=inportb(wBase+0xc4); j3=inportb(wBase+0xc8); /* read D/I data from CN2 of PIO_D48 */ j11=inportb(wBase+0xd0); j22=inportb(wBase+0xd4); j33=inportb(wBase+0xd8); printf("\n[%2x %2x %2x] [%2x %2x %2x]",j1,j2,j3,j11,j22,j33); delay(1000); if (kbhit()!=0) { c=getch(); if ((c=='q') || (c=='Q')) return; } } PIO_DriverClose(); }