Demo 6: Outport Of Cn1-Cn6 - Omega OME-PIO-D144 Hardware Manual

Pci-bus digital i/o board
Table of Contents

Advertisement

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);
printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
putch(0x07);
printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) 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);
}
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,
printf("\n(3) *** Card_0 D/O test, wBase=%x ***",wBase);
outp(D144,Disable);
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);
outp(RW_8BitDR,i);
OME-PIO-D144 User's Manual (Ver.2.1, Sep/2001)
{
putch(0x07);
putch(0x07);
{
&wSubAux,&wSlotBus,&wSlotDevice);
&wSubAux,&wSlotBus,&wSlotDevice);
/* Reset DIO of D144 */
{
/* for OME-PIO-D144 */
wBase");
*/
*/
*/
*/
---- 46

Advertisement

Table of Contents
loading

Table of Contents