/* -------------------------------------------------------------- */
/* Note : 1.The hold_time of INT_CHAN_0 & INT_CHAN_1 must long */
/* enoug. */
/* 2.The ISR must read the interrupt status again to */
/* identify the active interrupt source. */
/* 3.The INT_CHAN_0 & INT_CHAN_1 can be active at the same */
/* time. */
/* -------------------------------------------------------------- */
void interrupt irq_service()
{
/* now ISR can not know which interrupt is active */
new_int_state=inportb(wBase+7)&0x03;
/* read all interrupt */
/* signal state */
int_c=new_int_state^now_int_state;
/* compare new_state to */
/* old_state */
if ((int_c&0x01)==1)
/* INT_CHAN_0 is active */
{
if ((new_int_state&1)==0)
/* INT0 change to low now */
{
+;
}
else
/* INT0 change to high now */
{
+;
}
invert=invert^1;
/* generate high_pulse */
}
if ((int_c&0x02)==2)
/* INT_CHAN_1 is active */
{
if ((new_int_state&2)==0)
/* INT1 change to low now */
{
+;
}
else
/* INT1 change to high now */
{
+;
}
invert=invert^2;
/* generate high_pulse */
}
now_int_state=new_int_state;
/* update interrupt status */
outportb(wBase+0x2a,invert);
/* generate a high pulse */
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
PIO-DA/PISO-DA Series User Manual (Ver.2.9, Feb. 2011, PMH-009-29 )
16