Subject: Re: UPS RS232 cabling question
To: VaX#n8 <vax@linkdead.paranoia.com>
From: Jukka Marin <jmarin@pyy.jmp.fi>
List: current-users
Date: 05/04/1997 13:00:40
On Sun, May 04, 1997 at 03:15:36AM -0500, VaX#n8 wrote:
> Heya.  I'm trying to set up a UPS to PC, RS232 connection.
> Last time I tried to drive the serial control lines from NetBSD, it
> didn't work too well.

I think it should work OK if you open the serial port and keep it open
when you want to control the signals.  You want to use the CLOCAL flag
to stop CD from killing your process.

> Also, the UPS signals the computer by pulling it's output lines to signal
> ground via an optoisolator, with the signal coming in the collector.
> Will that draw the levels logically high?  Will it be sufficient
> to interface with a normal RS-232 serial connector on the PC?

The RS232 inputs are usually pulled to ground by a resistor inside the
RS232 receiver IC, so pulling it to GND using a opto isolator isn't going
to change the level at all.  Also, the treshold voltage of the inputs varies
with the type of receiver chip, being somewhere around 0 V (usually a bit
above 0 V so you can use GND and +5V to drive the input - yes, really).

When the port is open, the DTR output is at +12V and TxD output at -12V.
You could connect a pull-up resistor between DTR and, say, CD, and then
connect the output of the opto isolator between TxD and CD.  When the opto
is off, CD is at +12V (well, above the treshold, anyway) and when the opto
goes on, CD goes below the treshold.  A suitable pull-up resistor is in
the 1...10 kohm range, depending on the opto and the RS232 receiver chip.

You can try driving the shutdown input of the UPS using a 9V battery if
you aren't certaing of how it works.  I would put a 1-kohm resistor in
series with the battery to limit the current (just in case the UPS doesn't
have a current limiting resistor in series with the photo diode of the
opto isolator).

Hope this helps,

  -jm


-- 

                       1503 kHz @ 22:30 EET DST Mon-Fri

                     ---> http://www.jmp.fi/~jmarin/ <---