More comm ports and interrupts...

Quote
On Tue, 28 Nov 1995, Paul Peavyhouse wrote:
> Douglas Evan Cook <co...@bert.cs.byu.edu> wrote:
> >I am developing an interface between some electronics equipment and my
> >serial port.  Everything works great as far as the signal levels go, but
> >I am having one problem.  I need to have the COM port generate interrupts
> >whenever one of the lines (either DSR or DTR - I always get them mixed
> >up) changes states.  I know how to write interrupt handlers - in fact, so
> >far I have been using the clock interrupt to check the com port 18.2
> >times per second, but I need to check it either twice as often or else I
> >need to check it only when it actually is triggered.  However, I can't
> >get the COM port to generate interrupts.  I have tried setting the
> >interrupt mask, and even set it to let through ALL interrupts, but no
> >luck.  I haven't yet detected a single COMM interrupt.  I'm wondering if
> >anyone else has had the same problem?  Maybe it is an interaction of a
> >memory manager or something that is virtualizing my interrupt
> >controller?  I would really appreciate it if anyone who has any idea of
> >what I am talking about could drop me a line and help me out.

>      Are you wanting the connection (DTR) to be low until the remote
> machine has some info, then have it raise DTR, the local one realizes DTR
> has been raised, and then the local one reads what the remote has to say?
> If this is what you're getting at, I take it the remote is running on a
> battery of some sort (you want to conserve power).  If it's not then I
> see no reason why you shouldn't just maintain a constant carrier.  Why
> raise and lower DTR to send signal there is info?  Just send it, and
> check if the local COM port has something in its receive buffer.
>      I'd be glad to help you more, but I'm still slighty clueless about
> what you are trying to accomplish.
>                                                      PV

Thanks for responding.  Actually, the problem is that the actual data is
carried on pulses over the DTR line, but the modulation doesn't match the
serial port's.  I basically just count the number of pulses.  The problem
is that the pulses come at about 10 per second.  I need to poll at 20 per
second to get an accurate count, and the clock interrupt comes 18.2 times
per second.  I have had success when I just polled within a loop, but I
need the program to run as a TSR (actually, it will end up as a Windows
DLL, but I can do the Windows part once I get it running under DOS).  
Because of this, it MUST be interrupt based, and it MUST be an interrupt
generated on the DTR.  I have successfully wired the system, but somehow
the interrupts don't get through.  I'm sure I'm missing something simple,
maybe a misunderstanding of the PIC or something.  My dream response
to this posting would be a 20 line code skeleton of a program that sets
everything up and interrupts on DTR.  However, any help is greatly
appreciated.  THANX!

Douglas