[comp.sys.mac.programmer] Carrier Detect

wwg2101@venus.tamu.edu (GILPIN, WESLEY WILSON) (02/22/91)

Could someone please tell me how to implement a carrier detect routine for
use with the modem port? What I want is a boolean function returning true if
the modem is currently detecting a carrier signal, and I can't for the life 
of me figure out how to read the CD line from the modem. I am working in 
pascal on an  SE, but I undertstand C, so example code in C or Pascal would 
be fine.

Wes
WWG2101@TAMVENUS

russotto@eng.umd.edu (Matthew T. Russotto) (02/22/91)

In article <12468@helios.TAMU.EDU> wwg2101@venus.tamu.edu writes:
>Could someone please tell me how to implement a carrier detect routine for
>use with the modem port? What I want is a boolean function returning true if
>the modem is currently detecting a carrier signal, and I can't for the life 
>of me figure out how to read the CD line from the modem. I am working in 
>pascal on an  SE, but I undertstand C, so example code in C or Pascal would 
>be fine.

Most cables for the Mac do not support the carrier detect line-- they either
support DTR/DSR or CTS/RTS.  On some modems, DSR and CD are equivalent, so
you can read the status of CTS to see if you have a carrier.  On
others, you can make a custom cable and connect CD (pin 8 on the DCE) to
pin 7 on the Mac.  In either case, reading the status of these lines
is going to require some assembly language, and a look at the manual for
the serial chip, unless the Comm Toolbox has added this ability.

--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.

jackb@MDI.COM (Jack Brindle) (02/23/91)

In article <1991Feb22.151625.26340@eng.umd.edu> russotto@eng.umd.edu (Matthew T. Russotto) writes:
>
>Most cables for the Mac do not support the carrier detect line-- they either
>support DTR/DSR or CTS/RTS.  On some modems, DSR and CD are equivalent, so
>you can read the status of CTS to see if you have a carrier.  On
>others, you can make a custom cable and connect CD (pin 8 on the DCE) to
>pin 7 on the Mac.  In either case, reading the status of these lines
>is going to require some assembly language, and a look at the manual for
>the serial chip, unless the Comm Toolbox has added this ability.
>
>--
>Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
>     .sig under construction, like the rest of this campus.


Actually, the exact opposite is true, at least for Apple cables. Apple's
cables have always brought the DCD line (pin8) into the Mac's HSK input
line, a very useless configuration in most cases. Since most of my packet
radio applications talk to boxes that require handshaking, I have to tell
customers to use a cable that configures the cts output into the Mac's
HSK input. By the way, in the Apple configuration, the result is unusable,
since the CD line is negated by the packet TNC until someone connects. Thus
you can't even set the modem up unless you ignore the HSK input signal!

Secondly, the Mac's serial driver's have supported notification from the
driver of a change in the state of the HSKin line ever since the original
loose leaf Inside Mac days. Take a good look at the serial driver chapter
in Inside Mac Volume II. It works quite nicely, and does not require
directly programming the SCC. The state of the input pins (HSKin and GPi)
is also available, although configuring the GPi is in itself a pain.

Look at Volume 5 of I.M. for info on using that pin. Also, the serial
driver is discussed in volume 4 for other "features" that were added. This
means you need to look at Vol 2, 4 and 5. Hope you already have them (or 
have a fat wallet :-)... ).

Jack Brindle
WA4FIB
mdisea!MDI.COM!jackb