From: aarond@xibm.StorTek.com (Aaron Dailey)
Subject: Re: Handling multiple interrupts
Organization: StorageTek
Date: Thu, 21 Jan 1993 17:02:11 GMT

I don't think your address is sendable, so I'm following up to the
net:

In article <rlw.727258443@elan> rlw@elan (Robert Wald) writes:

     Hi, I need some help with interrupts. I'm using two kinds. First,
   the serial port is interrupt driven, and secondly, the AT Real Time
   Clock countdown interrupt. The second is being used to drive
   a camera with a computer controlled exposure time (it has to be
   done this way). 
     First, I'd like to know if there are any references to using
   the hardware properly on the net. I've looked for books, but they
   all shy away once it gets very technical, which is exactly what
   I need. 

The 8259 datasheet is of course the ultimate reference, but it's
terse.  Does anyone know of good books on programming the PIC, the
timer, DMA, etc?

     The main thing I need to do is to make sure that the
   (simulated?) cascaded 8259 interrupt controllers are happy. The
   serial interrupt is on the first controller, and the RTC interrupt
   is on the second. It seems that some pictures come out with 
   what looks like a doubled exposure time, suggesting that an
   RTC interrupt is being missed. The serial interrupts are driving
   a 19200 baud heavily used connection (unfortunately I can't
   assume a 16550, it has to work with normal serial controllers) running
   a V.32bis modem (without compression) from a 386 machine,
   and I want to make sure that everything is being set and cleared 
   correctly. Does the serial interrupt have to inform the 
   second 8259 that it can go ahead and interrupt, or is sending
   the 0x20 (I think) to the first one enough? Under what circumstances
   can an interrupt be totally suppressed?

The serial interrupt ISR, as it's connected only to the first PIC,
only needs to give an EOI to the first PIC.  I'm not sure what would
be going on in your code; the RTC might be interrupting while the
serial ISR is interrupting; have you taken this into accout in your
code?  If you're executing the serial ISR, until you enable interrupts
on the 386 (either by executing the interrupt return, or explicitly
enabling interrupts with STI in your ISR), and give the master PIC an
EOI, you won't see your RTC interrupt.

     I could also use some help with the RTC interrupt itself.
   Its supposed to have been documented in PC Techniques last summer
   (possibly 1991), but I can't find it.

The datasheet for the RTC is good; you can get it from Motorola, who
originally designed the chip, or from your PC chipset vendor.

     I also need to do some internal timing to make sure that
   this is working correctly. How do you read the time in some fashion
   without using a DOS call, or can you make the time DOS (or BIOS) call
   from within an ISR? I want to make sure that the timing is exactly
   doubled (which I'm pretty sure it is). 

I don't think you want to use DOS.  I think you can set up one of the
8254 timers, and use it.  Probably the standand timer isn't high
enough resolution (it's 18 /Sec)

     Also, I need to add flow control. Is there a simple example
   or program around which gives an example of modem flow control? 

Maybe kermit or one of the other PD comm programs?

   Thanks very much for any help.

   -Rob


--
Aaron Dailey Internet: Aaron_Dailey@stortek.com
StorageTek Corporation   Voice: (303) 673-4989, FAX: (303) 673-2570
Mail:  MS0242, 2270 South 88th Street, Louisville, C0 80028

Newsgroups: comp.sys.ibm.pc.soundcard