How do I convert 20mA current-loop to RS232C?river wrote:
> How do I convert 20mA current-loop to RS232C? I got an old
SC/MP and
> old 2650 SBCs that I'd like to fire up.
It depends which end the SBCs think they are. Current loops
have three
components, a current source, a current detector and a transmitter.
The
"obvious" thing to do would be to attach the current source to
the
transmitter (which is essentially the approach used in RS232, except
it's
voltage that's regulated not current), but since 20mA comes from
telegraphy, it's not done that way -- both loops are usually powered
from
the same end, so the remote device doesn't introduce power into
the
(network provider's) loop. The remote device then only needs
to be in
essence a solenoid for the receiver and a switch for the transmitter.
The effect is that you have "active" and "passive" current loops
interfaces, the "active" end being the one providing current.
Usually
it's the "host" end that does this, with terminals as the passive
elements in the loops.
That said, what follows is the comments from a bit of code I did
to get
a Teletype ASR33 talking to a
VAX. This is very much in the
"it worked
for me" category...
; This little ditty is used to emulate a 20mA interface using an
RS232
; port and the following circuit:
;
; RS232
20mA Passive Interface
;
100
; TXD --/\/\---------//------------
RX-
;
; GND --->|----------//------------
RX+
;
; RTS ---------------//------------
TX-
;
; RXD --------+------//------------
TX+
;
|
; DTR --/\/\--+
;
1k
;
; The way this works is that the transmit loop (RX at the other
end)
; current is provided via the TX and GND via a 100 ohm current
; limiting resistor.
;
; The receive side of this is a bit trickier; RTS is held low (-6V)
; to provide a constant mark to RXD as long as the remote interface
; holds the line closed. DTR is held high (+6V) and connected
to RXD
; via a 1k resistor, so when the remote interface opens the line
to
; transmits a space symbol, the line is biased by the DTR connection,
; which pulls the RXD line to a space (+6V) state.
;
; For this to work, DTR and RTS must be held high and low respectively,
; not a normal state for RS232 ports under VMS. Fortunately,
as long
; as the port isn't in MODEM or COMMSYNC modes, VMS ignores the
control
; signal states; we just need to prod them into the state we want
and
; leave it at that.
;
; Note: the above is not a true 20mA interface; it makes the following
; assumptions:
;
; The line is local, ie transmission
line loss is negligible;
; Transmit does not in any
way detect current flow;
; The receive interface has
a low (<100 ohm) impedance;
; Line/transmitter/receiver
impedances remain constant.
;
; The above circuit could be made more adaptable by replacing the
100
; ohm resistor with a potentiometer, allowing the circuit
to be
; adapted for longer transmission lines etc. However
it is not by
; any stretch of the imagination a universal 20mA converter.
Note that the above was designed around the sort of characteristics
found on DEC serial interfaces. These tend to operate on
the lower
voltage/higher current end of the RS232 spec, +/-6V. I think
a dead
short TX-GND got about 50mA through. A multimeter is your
friend for
this sort of thing. 8-)
If the interface is active, the above won't work. You'll need
to design
something or buy a converter. B&B Electronics
(www.bb-elec.com)
sell a
series of simple 20mA converters at reasonable prices if you don't
feel
like designing it yourself.