Mail Archives: djgpp/1995/09/06/06:53:11
Using trial and error, I think I've found the correct way to terminate an
interrupt routine which is called via a wrapper function.
Originally I looked at some SoundBlaster code and saw the interrupt routine
was terminated with :-
outportb(0x20, 0x20);
enable();
My interrupt routine would hang most times, even with frequencies as low as
200Hz (very unacceptable). When I say hang, I mean the routine fails to
get serviced but the main program still runs.
I wasn't sure if either of these were needed when using the wrapper functions
so I preceeded to comment out the two statements one at a time, trying all 4
combinations. Without the outport command it seems the routine never gets
called or gets continually interrupted. ie. incorrect method.
I tried without the enable and it seemed to work fine. I tried to crank the
interrupt frequency up to 200Khz to see if I could crash it. It seemed to
be continuously being serviced thus leaving the main programmed idle. But as
I brought the freq back down to a reasonable level, the main program started
to kick in. (Fantastic, just what I wanted).
From this I concluded that the outport(0x20, 0x20) is needed, but if the
enable is present, it may cause something else to interrupt before the
wrapper routine can finish its job and the PIC gets confused. Not sure
exactly whats happening but it seems the enable shouldn't be in an interrupt
routine if you are using the go32 wrapper functions.
Hope this helps others in the future as it cost me quite a bit of time.
I can now get interrupt rates of 20 to 40KHz on my 486DX4/100.
Brendan Simon
brendan AT rdt DOT monash DOT edu DOT au
- Raw text -