Omega OME-PIO-D144 manual Demo2 Use D/O of CN1~CN6

Page 39

4.3Demo2: Use D/O of CN1~CN6

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

*/

/* demo 2 : D/O demo for CN1 ~ CN6

*/

/* step 1 : connect a OME-DB-24C to CN1 ~ CN6 of OME-PIO-D144

*/

/* step 2 : run DEMO2.EXE

*/

/* step 3 : check the LED's of OME-DB-24C turn on sequentially

*/

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

*/

#include "PIO.H"

 

int main()

{

int i,j,k,jj;

WORD wBoards,wRetVal;

WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice; char c;

clrscr();

PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */ printf("\n(1) There 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);

}

/* select card_0 */

PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,

 

&wSubAux,&wSlotBus,&wSlotDevice);

/* step 1: make sure which ports are D/O ports

 

*/

/* in this demo --> all D/O ports are output port

*/

/* step 2: enable all D/I/O port

*/

*/

outp(wBase,1);

/* enable D/I/O

 

/* step 3: select the active port

 

*/

/* step 4: send initial-value to D/O latch register of active port */

/* step 5: repeat for all D/O ports

*/

 

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

 

 

 

{

 

 

*/

outp(wBase+0xc4,i); /* select CN1 to CN6 port

 

outp(wBase+0xc0,0); /* set 8-bit D/O latch register

*/

}

 

 

 

/* step 6: configure all I/O port */

 

*/

outp(wBase+0xc8,0x00);

/* CN1 to CN2 port are all output

outp(wBase+0xcc,0x00);

/* CN3 to CN4 port are all output

*/

outp(wBase+0xd0,0x00);

/* CN5 to CN6 port are all output

*/

/* K=PA/PB/PC

*/

 

 

 

 

 

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

 

----- 37

Image 39
Contents User’sGuide Czech Republic CanadaMexico BeneluxOME-PIO-D144 Table of Contents Demo Program Specifications All signals are TTL compatibleProduct Check List Board Layout Hardware configurationEnable I/O Operation I/O Port LocationRefer to DEMO1.C for demo program O Architecture If INT signal is Low now Æ select the non-inverted input Interrupt OperationMake sure the initial level is High or Low Refer to DEMO3.C for source code Refer to DEMO4.C for source code CN1PC0 CN1PC1 CN1PC2 CN1PC3 If PC1 is active OME-DB-8125 Daughter BoardsOME-DB-37 OME-DN-37 & OME-DN-50OME-ADP-37/PCI & OME-ADP-50/PCI OME-DB-24P/24PD Isolated Input Board OME-PIO-D144OME-DB-24P OME-DB-24PD OME-DB-24R/24RD Relay Board OME-DB-24PR/24POR/24C OME-DB-24PRCOM OME-DB-24PR Daughter Board Comparison Table Pin Assignment VCCGND OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 PC’s physical slot information How to Find the I/O AddressResource-allocated information PIO/PISO identification informationOME-PISO-P8R8 OME-PIO-821OME-PISO-P32C32 OME-PISO-P32A32PIODriverInit&wBoards, wSubVendor,wSubDevice,wSubAux PIODriverInitPIOGetConfigAddressSpace ShowPIOPISO Slot5 0x0A Slot6 0x08 Slot7 0x09 Slot8 0x07 Assignment of I/O AddressOME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 Address Read Write RESET\ Control RegisterRESET\ I/O Address MapCN1PC3 CN1PC2 CN1PC1 CN1PC0 AUX Control RegisterAUX data Register INT Mask Control RegisterInterrupt Polarity Control Register Aux Status RegisterActive I/O Port Control Register Read/Write 8-bit data RegisterCN6PC CN6PB CN6PA CN5PC CN5PB CN5PA 9 I/O Selection Control RegisterCN2PC CN2PB CN2PA CN1PC CN1PB CN1PA CN4PC CN4PB CN4PA CN3PC CN3PB CN3PA\TC\LARGE\LIB\PIO.H \TC\LARGE\\TC\LARGE\LIB\ \TC\LARGE\DEMO?\OME-PIO-D144.H Demo1 Use D/O of CN1 CN3 CN4 Demo2 Use D/O of CN1~CN6 PA/PB/PC COUNT=0 Demo3 Interrupt demo1Refer to Sec .5.1 for more information Demo4 Interrupt demo2 Refer to Sec .5.2 for more information Demo5 Interrupt demo3 CN1PC1 OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 Demo 6 Outport of CN1-CN6 OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 Demo10 Find Card Number OME-PIO-D144 User’s Manual Ver.2.1, Sep/2001 WARRANTY/DISCLAIMER Temperature