Omega OME-PIO-D144 manual Refer to Sec .5.2 for more information

Models: OME-PIO-D144

1 53
Download 53 pages 23.23 Kb
Page 44
Image 44

outp(wBase+5,0);

/* disable all interrupt */

 

PIO_DriverClose();

 

 

}

 

 

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

*/

/* Use PC0 as external interrupt signal

*/

WORD init_high()

 

 

{

 

 

DWORD dwVal;

 

 

disable();

 

 

outp(wBase+5,0);

/* disable all interrupt */

 

if (wIrq<8)

 

 

{

 

 

irqmask=inp(A1_8259+1);

 

outp(A1_8259+1,irqmask & (0xff ^ (1 << wIrq)));

 

setvect(wIrq+8, irq_service);

 

}

 

 

else

 

 

{

 

 

irqmask=inp(A1_8259+1);

/* IRQ2 */

outp(A1_8259+1,irqmask & 0xfb);

outp(A1_8259+1,irqmask & (0xff ^ (1 << wIrq)));

 

irqmask=inp(A2_8259+1);

 

 

outp(A2_8259+1,irqmask & (0xff ^ (1 << (wIrq-8))));

setvect(wIrq-8+0x70, irq_service);

 

 

}

 

 

 

outp(wBase+5,1);

/* enable interrupt

 

*/

now_int_state=1;

/* now int_signal is low

*/

outp(wBase+0x2a,1);

/* select the inverte input */

enable();

 

 

 

}

 

 

 

void interrupt irq_service()

 

 

{

 

 

 

if (now_int_state==0)

 

 

 

{

/* find a high_pulse here

*/

outp(wBase+0x2a,1);

/* select the inverte input */

now_int_state=1;

/* now int_signal is High

*/

}

 

 

 

else

 

 

 

{

/* find a low_pulse

 

*/

COUNT++;

 

outp(wBase+0x2a,0);

/* select the non-inverte input */

now_int_state=0;

/* now int_signal is High

*/

}

 

 

 

if (wIrq>=8) outp(A2_8259,0x20); outp(A1_8259,0x20);

}

Refer to Sec. 2.5.2 for more information.

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

---- 42

Page 44
Image 44
Omega OME-PIO-D144 manual Refer to Sec .5.2 for more information