/* DEMO1 : D/O demo for PIO-DA16/8/4 */ /* step1 : Run DEMO1.EXE */ /* step2 : Check the LEDs of DB-24C will turn on sequentially */ /* -------------------------------------------------------------- */ #include "PIO.H" WORD wBase,wIrq; void pio_da16_do(WORD wDo); int main() { int i,j; WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6; WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice; clrscr(); /* step1 : find address-mapping of PIO/PISO cards */ wRetVal=PIO_DriverInit(&wBoards,0x80,0x04,0x00);/*for PIO-DA16/8/4*/ printf("\n(1) Threr are %d PIO-DA16/8/4 Cards in this PC",wBoards); if ( wBoards==0 ) exit(0); printf("\n\n-------------- The Configuration Space --------------"); for(i=0;i "); ShowPioPiso(wSubVendor,wSubDevice,wSubAux); } PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&t1,&t2,&t3,&t4,&t5); /* select card_0 */ /* step2 : enable all D/I/O port */ outp(wBase,1); /* /RESET -> 1 */ printf("\n\n(2) DEMO1 D/O test"); j=1; for(;;) { gotoxy(1,8); pio_da16_do(j); printf("\nDO ==> %4x",j); delay1(10000); if (kbhit()!=0) break; j=j<<1; j=j&0x0ffff;if (j==0) j=1; } PIO_DriverClose(); } /* -------------------------------------------------------------- */ void pio_da16_do(WORD wDo) { outp(wBase+0xf8,wDo); /* 0xf8 : low byte of DO port */ outp(wBase+0xfc,(wDo>>8)); /* 0xfc : high byte of DO port */ }