[comp.sys.ibm.pc.programmer] Programming a COM port, raising DTR

tom@ramona.Cary.NC.US (Tom Salzmann) (04/11/90)

I am looking for code examples (MASM or C) of how to properly raise
DTR on a COM port.  I have an application which dials the modem
after raising DTR.  The problem is that this application works fine
on most systems, but on a few systems it simply won't raise DTR all
the time.  Here is a segment of code I use to do it:

        MOV     DX, port address + offset for modem control register
        MOV     AL,0BH
        OUT     DX,AL

Should something more robust be done to properly raise DTR?   Please
reply to me directly and I'll gladly summarize here once I become an
expert on the subject. :-)
--
Tom Salzmann <tom@ramona.Cary.NC.US>

dts@pwllheli.sw.stratus.com (Daniel Senie) (04/11/90)

|>I am looking for code examples (MASM or C) of how to properly raise
|>DTR on a COM port.  I have an application which dials the modem
|>after raising DTR.  The problem is that this application works fine
|>on most systems, but on a few systems it simply won't raise DTR all
|>the time.  Here is a segment of code I use to do it:
|>
|>        MOV     DX, port address + offset for modem control register
|>        MOV     AL,0BH
|>        OUT     DX,AL
|>

You should read the modem control register and set the DTR bit by ORing
it into the value read. To clear it, AND in the inverse pattern. You
should never blast a new value into an I/O port without first reading
the contents. Since you only wanted to change the one bit, don't clobber
the rest.
               
Daniel Senie               UUCP: uunet!lectroid!dts 
Stratus Computer, Inc.     ARPA: dts@lectroid.sw.stratus.com
55 Fairbanks Blvd.         CSRV: 74176,1347
Marlboro, MA 01752         TEL.: 508 - 460 - 2686