Demo 6: outport of cn1-cn6, Demo, Utport of – Omega OME-PIO-D144 User Manual

Page 48: Cn1-cn6, 7 demo 6: outport of cn1-cn6

Advertising
background image

4.7 DEMO 6: Outport of CN1-CN6

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

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

while(1) {

printf("\n");

for(i=1;i<=0x80;i=i<<1) {

printf("\nCN1: PA=%02xH, PB=%02xH, PC=%02xH, press Q to stop",i,i,i);

outp(Act_IOPCR,CN1_PA);

outp(RW_8BitDR,i);

outp(Act_IOPCR,CN1_PB);

outp(RW_8BitDR,i);

outp(Act_IOPCR,CN1_PC);

outp(RW_8BitDR,i);

sleep(1);

}

printf("\n");

for(i=1;i<=0x80;i=i<<1) {

printf("\nCN2: PA=%02xH, PB=%02xH, PC=%02xH, press Q to stop",i,i,i);

outp(Act_IOPCR,CN2_PA);

outp(RW_8BitDR,i);

outp(Act_IOPCR,CN2_PB);

outp(RW_8BitDR,i);

outp(Act_IOPCR,CN2_PC);

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

---- 46

outp(RW_8BitDR,i);

Advertising