[comp.sys.apple] RS232-C communications

kamath@reed.UUCP (Sean Kamath) (12/01/88)

>gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <8811251119.AA18101@crash.cts.com> rich@nosc.mil writes:
>>
>>There must be *some* sort of "starting point" [in bitwise communicatons] 
>>that's fairly widely accepted as first|leading|initial|whatever you like!!
>
>There are standards such as RS-232-C for serial bit order, based on the
>order in which the selector bars had to be triggered on mechanical
>teleprinters in order to set up for a given character.
>
>I don't 100% recall whether the least significant bit of the "ASCII
>code value" was sent first or last for the teleprinters (I think it
>was first).  The hardware could have been designed either way,
>which is in fact my point: most-significant is not necessarily the
>"first" bit although in a serial context it could be, depending on
>the conventions that apply in the specific case.
>
> [deleted discussion of programming techniques]

For a very nice and rather complete dissertation on RS-232 communications
hardware and history, the book "Serial Communications for the C Programmer"
from Howard Sams & co is very good.  While it's written with C in mind (but
you should all learn C anyway, if only we could really get gcc to compile
65816 code. . .), the first 5 chapters don't include any code at all, but is
all about why marks and space are called marks and spaces, why transmission
lines are kept "high" all the time, etc. Very good reading.

The second half of the book is all on writing a communications program for
the IBM-PC using Aztec C.  It includes pretty good explanations of CRC's as
well as ring buffers, and other pretty handy things to know about when
programming with speed in mind.

As for the byte-swapped ordering discussion that this came out of, I think
it's pretty ridiculous.  When you start hopping around from machine to
machine, sometimes the first thing you have to do is store a long with
value 0x12345678 into a known location, and run the debugger on it to see
how it stores it. :-) But seriously, yes, the 6502 is "odd" becouse your JSR
$FDED get's switched to "20 ED FD", and the 68K is "reversed".  I think the
discussion is closed.  I hope it is.


Sean Kamath

Now on BITNET, and maybe I'll even GET some stuff from the server now. . .
:-)


-- 
UUCP:  {decvax allegra ucbcad ucbvax hplabs}!tektronix!reed!kamath
CSNET: reed!kamath@Tektronix.CSNET  ||  BITNET: kamath@reed.BITNET
ARPA: kamath%reed.bitnet@cunyvm.cuny.edu
US Snail: 3934 SE Boise, Portland, OR  97202-3126 (I hate 4 line .sigs!)