Demo5: Interrupt Demo3 - ICP DAS USA PIO-D144 User Manual

Hide thumbs Also See for PIO-D144:
Table of Contents

Advertisement

ГК Атлант Инжиниринг – официальный представитель в РФ и СНГ
+7(495)109-02-08 sales@bbrc.ru www.bbrc.ru
PIO-D144 User's Manual

4.6 Demo5: Interrupt demo3

/* ----------------------------------------------------------- */
/* demo 5 : four interrupt source
/*
CN1_PC0: initial Low, active High
/*
CN1_PC1: initial High, active Low
/*
CN1_PC2: initial Low, active High
/*
CN1_PC3: initial High, active Low
/* step 1 : run demo5.exe
/* ----------------------------------------------------------- */
#include "PIO.H"
#define A1_8259 0x20
#define A2_8259 0xA0
#define EOI 0x20
WORD init_low();
WORD wBase,wIrq;
static void interrupt irq_service();
int
irqmask,now_int_state,invert,new_int_state,int_c,int_num;
int
CNT_L1,CNT_L2,CNT_L3,CNT_L4;
int
CNT_H1,CNT_H2,CNT_H3,CNT_H4;
int main()
{
int
i,j;
WORD wBoards,wRetVal;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
DWORD dwVal;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00);
printf("\n(1) Threr are %d PIO-D144 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07);
putch(0x07);
printf("(1) There are no PIO-D144 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all PIO-D144:");
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);
}
/* select card_0 */
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,
printf("\n(3) *** Card_0, wBaseAddr=%x ***",wBaseAddr);
outp(wBase+0xc8,0xff);
printf("\n(4) *** show the count of High_pulse **\n");
init_low();
Page 42
putch(0x07);
&wSubAux,&wSlotBus,&wSlotDevice);
&wSubAux,&wSlotBus,&wSlotDevice);
/* CN1 to CN2 port are all input */
Version: 2.1
Date: 1999/10
*/
*/
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents