TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: TIM HUTZLER
from: ERIC SCHONNING
date: 1995-12-22 00:00:00
subject: Re: Serial control lines

TH> I want to control the DSR and/or the CTS line of a serial port that a
TH> serial mouse is connected to. When I probed these pins, I found some
TH> unexpected things.
 
TH> First, when the computer is first turned on, all of the output lines
TH> (TD, DSR, and CTS) light both the 'hi' and 'lo' indicaters on my logic
TH> probe. The odd thing is, the legend does not list this condition, so I
TH> have to assume that it is a square wave with a duty cycle that appears
TH> to be about 50-percent.
 
Well, that may be so, or the lines could be in a floating condition. 
Without connecting a scope hard to say exactly what they are doing. 
The DSR and CTS are inputs to the serial port so they could be in any
state really...
 
TH> Now, when I run Windows, or if I simple run something like "copy
TH>  COMx:" I can see the data on TD, and CTS and DSR assume a
TH> steady high state. They remain high after exiting Windows, or when the
TH> copy command completed execution.
 
Most programs assume once they've initialized the com ports they stay
that way, as any future programs if they are written correctly will
leave the port the way they found it on startup.  Copy is not one of
these programs however...
 
TH> *My* challange is that I want to force either of the control lines
TH> 'lo.' But, I don't know how to do that. I tried using the INT 014
TH> service, but that simply returns the control lines to this alternating
TH> state. I just want to negate the control lines. Using service 5
TH> (extended control word) doesn't work either.
 
Its been a while since I've looked at the int 14 support, so you may be
correct on this one.
 
TH> I want to avoid direct register manipulation, but if someone knows the
TH> programming model of the 8250, I'll consider it. My concern is
TH> compatibility. It *must* work with all PCs.
 
TH> Anyone messed with manipulating control lines before?
 
I do it all the time.  Use INP/OUT.  A good reference book is "Using
Assembly Language" by Allan Wyatt, last I saw up to 3rd edition, but
any of the others will work as well.  He has a good section on the
serial port registers and what each bit is.  The base.address+4
controls the DTR and RTS (bit 0 and bit 1 respectively).  So OUT'ing at
3 to this port (11 in binary) will set both of these bits high.  You
can't directly control CTS however, but you can see its state easily
enough.  Check base.adddress+6, bit 4 (decimal 16, or 10000 binary)
using INP and BIT (ie: if BIT(INP(BA+6),4)=1 then CTS set) sort of
thing.  You can get the base address of the com ports from the bios
tables.  I believe the example code or hints code that comes with PB
release disk has this information.  I am running late to work so gotta
run.  This may meet your compatibility issue since you will be using
the base addresses that that machine has installed.  I've never had any
problems along these lines for com1-com4 support, except for some
really *strange* setups.  But they are very very few.  Usually 3F8 for
COM1, 2F8 for COM2, etc.  
 
TH> PS - how does a serial mouse get its power. My guess is the toggling
TH> state on the TD line. But that's just a *guess*. 
 
I've seen circuits that use the RTS/CTS lines to power themselves off
the serial port, like to run a MAX232 chip.  I really dunno how the
mouse powers itself though.
    Eric
--- QM v1.00
---------------
* Origin: Creekside Manor (805) 484-8016 CdCom Support BBS (1:206/2512.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.