[comp.sys.mac.programmer] Serial Driver Query

jackiw@cs.swarthmore.edu (Nick Jackiw) (02/11/89)

Hi...this is one anyone who's used the Serial Driver can answer (please do).

I don't know diddly about asynch serial I/O, but recently I've been 
requested to write a simple throughput program which reads commands from
a Sperry animation system (at its maximum speed, 9600baud), translates
them, and spits them out to a Sony BVU 950 video editing deck (at its
minimum speed, 38400 baud). Currently, we have a PC whose SOLE PURPOSE
is to do this task, and I can free that up by doing a Mac version as a
background (hook'd, not multifinder) task on our File Server mac, which is
on all the time.

I've taken a glimpse through IM II-249, and it seems like a piece of cake,
but I thought I'd ask if anyone can foresee complications right off the bat.
Specifically, I notice that the serConfig constants include baud9600 and
baud19200 and baud57600, but no baud38400. MY QUESTION IS: If I use the
csCode=13 csParam=38400 to set the baud rate manually, will it give me
38400 baud or will it bump my requested 38400 to its nearest serConfig
(i. e. 19200 or 57600)?

Any help would be greatly appreciated.

-Nick



-- 
+-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+
|  nicholas jackiw  | jackiw%campus.swarthmore.edu@swarthmr.bitnet           |
+-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+
"I cannot approve thy marriage choices, son."(Samson's dad, _Samson Agonistes_)

topping@dinghy.cis.ohio-state.edu (brian e. topping) (02/12/89)

To get the Mac to listen to a clock rate that is not listed in the standard
list, you need to have a signal coming in on pin 2 that has a synthesized
clock of the proper speed.  Then you have to throw a few registers in the
SCC to get things synched properly.  I am no expert on this, but have some
experience with doing MIDI on the Mac.  MIDI uses a 31.25KHz clock for
transmission.  You may want to look up some articles on doing MIDI interfaces,
including the hardware (MacTutor, Oct. '85) and the software drivers (MT, 
July '87).  Hope this helps --bri

tim@hoptoad.uucp (Tim Maroney) (02/12/89)

In article <2411@masada.cs.swarthmore.edu> jackiw@swatsun.UUCP () writes:
>I don't know diddly about asynch serial I/O, but recently I've been 
>requested to write a simple throughput program which reads commands from
>a Sperry animation system (at its maximum speed, 9600baud), translates
>them, and spits them out to a Sony BVU 950 video editing deck (at its
>minimum speed, 38400 baud). Currently, we have a PC whose SOLE PURPOSE
>is to do this task, and I can free that up by doing a Mac version as a
>background (hook'd, not multifinder) task on our File Server mac, which is
>on all the time.

Hmm, good luck on doing it in the background; that's a lot of work for
an 8MHz 68000 with its 16-bit data bus to handle.  9600 baud seems to
push the Mac to its limits.  Of course, you won't be drawing to the
screen, which will help, but still, you might want to do a "proof of
concept" before spending your time on the whole program.  You might
wind up slowing things down so much that it might as well be a
foreground task.

>I've taken a glimpse through IM II-249, and it seems like a piece of cake,
>but I thought I'd ask if anyone can foresee complications right off the bat.
>Specifically, I notice that the serConfig constants include baud9600 and
>baud19200 and baud57600, but no baud38400. MY QUESTION IS: If I use the
>csCode=13 csParam=38400 to set the baud rate manually, will it give me
>38400 baud or will it bump my requested 38400 to its nearest serConfig
>(i. e. 19200 or 57600)?

You can find out very easily with a ten line or so program.  IM says:
"The closest baud rate that the Serial Driver will generate is returned
in csParam."  So try the control call you've suggested and check the
csParam return value.  My guess is it'll get bumped to 19.2 Kbaud or
57.6 Kbaud; there's probably an internal switch on the constants listed
under SerReset; but don't take my word for it.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"I wouldn't work for Dukakis if my life depended on it.  I've worked for
 Greeks and I know just how filthy and stinking they can be."
    -- Caller, KGO-AM, 8 Nov 88

rt2@cunixb.cc.columbia.edu (Rens Troost) (02/21/91)

Does anybody have an exhaustive list of csCodes allowed by the Serial
Driver? I'm debugging someone else's code, and the number 8 appears, which
I cannot find documented. Is this indeed an error?

Thanks!
-Rens

mandel@vax.anes.tulane.edu (Jeff E Mandel MD MS) (02/21/91)

In article <1991Feb20.160252.28024@cunixf.cc.columbia.edu>
rt2@cunixb.cc.columbia.edu (Rens Troost) writes:
>Does anybody have an exhaustive list of csCodes allowed by the Serial
>Driver? I'm debugging someone else's code, and the number 8 appears, which
>I cannot find documented. Is this indeed an error?
>
I hate to tell anyone to RTFM, but if you refer to IM VII p259, you will see
that csCode 8 is used for SerReset and SerSetBuf when issuing PBControl, and
SerStatus when issuing PBStatus.

Jeff E Mandel MD MS
Asst Professor of Anesthesiology
Tulane University School of Medicine
New Orleans, LA