[comp.sys.mac.programmer] Serial port question

peter@aucs.uucp (Peter Steele) (11/17/89)

I am posting this for a friend who does not have access to this newsgroup. 
If you can, reply directly to him. If not, I can forward replies to him.
His message follows:
---------------------------------------
Does anyone know how to initialize the Mac serial driver to send at
38400 baud? The contants are available to initalize it to 57600 and
19200 baud but not 38400. Any reason why? I think that Microphone can
send at 38400 so its probably possible.

Any leads would be greatly appreciated.

Thanks, Steven Langlois
        ISDN Basic Rate Access
        BNR, a subsidiary of Northern Telecom

Bitnet: slang@bnr.ca
Bitnet from AppleLink:  slang@bnr.ca@DASNET#
-----------------------------------------
-- 
Peter Steele, Microcomputer Applications Analyst
Acadia University, Wolfville, NS, Canada B0P1X0 (902)542-2201x121
UUCP: {uunet|watmath|utai|garfield}!cs.dal.ca!aucs!Peter
BITNET: Peter@Acadia  Internet: Peter@AcadiaU.CA

testus@intercon.com (Amanda Walker) (11/18/89)

In article <1989Nov16.190032.13720@aucs.uucp>, peter@aucs.uucp (Peter Steele)
writes:
> Does anyone know how to initialize the Mac serial driver to send at
> 38400 baud? The contants are available to initalize it to 57600 and
> 19200 baud but not 38400. Any reason why? I think that Microphone can
> send at 38400 so its probably possible.

There's a control call to the serial driver that will let you give it an
arbitrary speed, and it will set the port to the closest rate that the
hardware will allow, and return the resulting actual baud rate.

	csCode = 13
	csParam = desired baud rate (in), actual baud rate (out).

See IM II-254 for more information.

Amanda Walker <amanda@intercon.com>
--

andyp@gvgpvd.GVG.TEK.COM (Andy Peterman) (11/18/89)

In article <1989Nov16.190032.13720@aucs.uucp> peter@aucs.uucp (Peter Steele) writes:
>Does anyone know how to initialize the Mac serial driver to send at
>38400 baud? The contants are available to initalize it to 57600 and
>19200 baud but not 38400. Any reason why? I think that Microphone can
>send at 38400 so its probably possible.

I always add the line:

	#define baud38400 1

to the Serial.h file supplied by Apple. I've never understood why, but
for some reason they leave it out of the header file.  I use this baud
rate quite often and have never had any problems.

	Andy Peterman

jimc@isc-br.ISCS.COM (Jim Cathey) (11/22/89)

In article <1989Nov16.190032.13720@aucs.uucp> peter@aucs.uucp (Peter Steele) writes:
>Does anyone know how to initialize the Mac serial driver to send at
>38400 baud? The contants are available to initalize it to 57600 and
>19200 baud but not 38400. Any reason why? I think that Microphone can
>send at 38400 so its probably possible.

According to IM volumes II & III, and Zilog's SCC manual, a constant of
1 will send at 38,250 baud.  The formula is:

sclk = 1/(3,672,000 / 16)
baud = 1/(2 * (CONSTANT + 2) * sclk)

(0 is 57375, 1 is 38250, 2 is 28688, 3 is 22950, 4 is 19125, ... 380 is 300).

The constant is dropped directly into the SCC's time constant register.

Just looking at the numbers, it looks like they used one of those
drop-a-half-cycle-every-eight-full-cycles (multiply by 15/16) counter
stages to get 3.672 MHz out of a 15.6672 MHz crystal.

+----------------+
! II      CCCCCC !  Jim Cathey
! II  SSSSCC     !  ISC-Bunker Ramo
! II      CC     !  TAF-C8;  Spokane, WA  99220
! IISSSS  CC     !  UUCP: uunet!isc-br!jimc (jimc@isc-br.iscs.com)
! II      CCCCCC !  (509) 927-5757
+----------------+
			"With excitement like this, who is needing enemas?"