Example 1: assume initial level=Low, PC0 is used as interrupt source:
Initial=Low
Iniaial_sub()
{ now_int_state=0
_outpd(wBase+0x2a,0)
/*(select the
ISR_sub()
{
If (now_int_state==0) /* old state=low Æ change to high now */
{ |
|
|
|
|
now_int_state=1; | /* now int_signal is High | */ |
| |
/*** application codes are given here ***/ |
|
| ||
_outpd(wBase+0x2a,1); | /* select the inverted signal | */ | ||
} |
|
|
|
|
else | /* old state=highÆ change to low now | */ | ||
{ |
|
|
|
|
now_int_state=0; |
| /* now int_signal is Low |
| */ |
/*** application codes are given here ***/
_outpd(wBase+0x2a,0); | /* select the | |||
} |
|
|
|
|
if (wIrq>=8) outp(A2_8259,0x20); | /* | EOI | */ | |
outp(A1_8259,0x20); |
| /* | EOI | */ |
}