Omega Engineering OME-PIO-D96 manual DEMO1

Page 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

Image 41
Contents User’sGuide Mexico CanadaBenelux Czech RepublicOME-PIO-D96 Table of Contents Introduction FeaturesOptions SpecificationsOrder Description OME-PISO-series cost-effective generation, isolated cards PCI Data Acquisition FamilyProduct Check List Board Layout Hardware configurationRefer to DEMO1.C for demo program Enable I/O OperationI/O port Location D/I/O Architecture Make sure the initial level is High or Low Interrupt OperationINTCHAN3 Interrupt Block Diagram of OME-PIO-D96INTCHAN0/1/2/3 COUNTL++ Initialhigh, activelow Interrupt sourceInitiallow, activehigh Interrupt source Muliti Interrupt Source Read all interrupt state OME-DB-37 Daughter BoardsOME-DN-37 & OME-DN-50 OME-DB-8125OME-ADP-37/PCI & OME-ADP-50/PCI OME-DB-24P/24PD Isolated Input Board OME-DB-24R/24RD Relay Board OME-DB-24PR/24POR/24C Daughter Boards Comparison Table Pin Assignment All signals are TTL compatibleVCC GND Resource-allocated information How to Find the I/O AddressOME-PIO/PISO identification information PC’s physical slot informationWSubVendor=0x80 wSubDevice=1 wSubAux=0x10 /* for PIOD96 PIODriverInitPIODriverInit&wBoards, wSubVendor,wSubDevice,wSubAux Current sinking Enable all D/I/O operation of card1 PIOGetConfigAddressSpaceEnable all D/I/O operation of card0 ShowPIOPISOwSubVendor,wSubDevice,wSubAux ShowPIOPISOSlot5 0x0A Slot6 0x08 Slot7 0x09 Slot8 0x07 Assignment of I/O AddressAddress Read Write I/O Address MapAUX data Register RESET\ Control RegisterAUX Control Register Aux Status Register INT Mask Control RegisterINV3 INV2 INV1 INV0 Interrupt Polarity Control Register7 I/O Selection Control Register Read/Write 8-bit data Register Demo program How to install software & utility?Piopiso PIOPISO.EXE for Windows DEMO1 DEMO2 DEMO3 COUNTL++ DEMO4 COUNTL++ DEMO5 CNTL1=CNTL2=CNTL3=CNTL4=0 Page WARRANTY/DISCLAIMER Temperature