[comp.sys.amiga.datacomm] ASCII code for BREAK ???

ben@epmooch.UUCP (Rev. Ben A. Mesander) (02/18/91)

>In article <drues.666917751@pv320a.vincent.iastate.edu> drues@iastate.edu (Michael E Drues) writes:
>Can anyone tell me what ASCII code for "BREAK" is???
>I can't find it in ASCII table I have.
>
>Thanks,
>mike  
>
>--
>Michael Drues                              Dept. of Biomedical Engineering
>Internet:drues@iastate.edu                        1146 Veterinary Medicine
>BITNET:v2.med@isumvs.bitnet                          Iowa State University
>Office:(515)294-6520(or 4-1771) Home:(515)233-5652        Ames, Iowa 50011

If you're asking about sending a "break" over a modem line, it is not an
ASCII character. A break simply holds the RS-232 send line active for a 
"long" time, usually ~1 sec, and is *not* a normal character consisting of
start, stop, and data bits. Terminal programs usually have an option 
to set the length of a "break." 

Remote computers usually have thier own "break" characters to abort
applications. On UNIX and MSDOS machines, it is a CTRL-C. On Primes, 
it is a CTRL-P. On Amigas it is a CTRL-C or a CTRL-D depending on the
application. TRS-80's use a CTRL-A for break. CP/M uses a CTRL-C...

--
ben@epmooch.UUCP            ben%servalan.UUCP@uokmax.ecn.uoknor.edu
{chinet,uokmax}!servalan!epmooch!ben  (Ben Mesander)   War in gulf:
newpath 288 396 216 0 360 arc 288 612 moveto 288 180 lineto 288 396
moveto 136 244 lineto 288 396 moveto 440 244 lineto 36 setlinewidth
stroke showpage

drues@iastate.edu (Michael E Drues) (02/19/91)

Can anyone tell me what ASCII code for "BREAK" is???
I can't find it in ASCII table I have.

Thanks,
mike  

--
Michael Drues                              Dept. of Biomedical Engineering
Internet:drues@iastate.edu                        1146 Veterinary Medicine
BITNET:v2.med@isumvs.bitnet                          Iowa State University
Office:(515)294-6520(or 4-1771) Home:(515)233-5652        Ames, Iowa 50011

papa@pollux.usc.edu (Marco Papa) (02/19/91)

In article <drues.666917751@pv320a.vincent.iastate.edu> drues@iastate.edu writes:
>Can anyone tell me what ASCII code for "BREAK" is???
>I can't find it in ASCII table I have.

There is NO ASCII code for BREAK. That's why you didn't find it. Break is a 
line condition, not a ASCII code.

-- Marco
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Xerox sues somebody for copying?" -- David Letterman
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

thad@public.BTR.COM (Thaddeus P. Floryan) (02/19/91)

In article <drues.666917751@pv320a.vincent.iastate.edu> drues@iastate.edu writes:
>Can anyone tell me what ASCII code for "BREAK" is???
>I can't find it in ASCII table I have.


There is NO code for ``BREAK'' since it is not a character but, instead, a
continuous (typically 100 to 300 mS) "condition" on the line.

Some OLD software I've seen would attempt to simulate a BREAK by setting the
baud temporarily to, say, 50, then sending an ASCII ``NULL'' char, but that
is a kludge.

Thad Floryan [ thad@btr.com (OR) {decwrl, mips, fernwood}!btr!thad ]

ccplumb@rose.uwaterloo.ca (Colin Plumb) (02/19/91)

drues@iastate.edu wrote:
>Can anyone tell me what ASCII code for "BREAK" is???
>I can't find it in ASCII table I have.

Break is not part of ASCII; it's more part of RS232.  Well, actually,
it makes sense in most asynchronous serial protocols, but there aren't
very many that aren't descendants (some legitimate; most bastard) of
RS232.

The details:

When sending data over an asynchronous line (like RS232), the bits (8,
usually) of a character are surrounded by start and stop bits to synchronise
the receiver.  When the line is idle, it transmits a continuous stream of
1's.  When a character is to be sent, it's preceded by a 0 bit, which
signals the receiver that something is coming.  The receiver has been
sampling the line at typically 16 times the bit frequency (38400 times
a second for 2400 baud) looking for a 0 signal.  When it gets it, it
waits half a bit time and checks again, to make sure the 0 bit is really
there.  Then it waits one bit time, reads the bit, waits one bit time,
reads the next bit, etc.  At the end of the last bit, it waits one more
bit time and checks the stop bit (which must be a 1 signal) and goes back
to checking 16 times per bit for a 1->0 transition.  This way, the
received bits are the signal measured on the line in the middle of each
of the transmitted bits.

If the receiver's clock is not at quite the same speed as the
transmitter's, as is inevitably the case, then the times at which the
receiver measures the bits will drift away from the centre.  As long as
you don't get more than 1/2 a bit drift in a single character, the
receiver will still be measuring the right bits and will get the right
values.  It resynchronises to the leading edge of the start bit every
character, so error does not build up forever.

If, at the end of one character, the receiver does not see a 1 level, it
can't accurately find the change to 0 level that indicates the next
character and so it signals a "framing" error.

Note the need for a full stop bit.  If the receiver was running fast,
it might have sampled early in the last data bit and needs to wait
that entire data bit before the line is clear (1) again.  If the receiver
was running slow, it might have sampled almost the end of the last data
bit, and waiting the minimum full bit time will place it at the end of the
stop bit.  If the stop bit were less than a bit, it would be missed.

If your clocks are more accurate than this, you can economise a little,
but it's not really worth it.  The best use of more accurate clocks
is to send more bits between start and stop, but as a practical matter,
it's hard to find chips which will do this.

Anyway, due to the presence of stop bits, if there are 8 data bits, there
are at most 9 bit times (start + 8 data bits of 0) of 0 signal allowed
in a row.  Rules are made to be broken, so you can break this rule
to sens a special signal (a break) to the receiver.  It is not a normal
character, although it looks like a 0 byte with a framing error.
Breaks are typically at least 2 characters long, and often much longer
than that, and are frequently used to reset a receiver somehow or
return it to a sensible state.

If you look at any serial device deriver or serial chip, you'll see
some bit or command to send a break, but this bit does not correspond
to normal data... it's abnormal, just as there is no touch tone
frequency corresponding to hanging up a telephone.
-- 
	-Colin

coburn@clo.enet.dec.com (John T. Coburn) (02/19/91)

In article <drues.666917751@pv320a.vincent.iastate.edu>, drues@iastate.edu (Michael E Drues) writes...
:Can anyone tell me what ASCII code for "BREAK" is???
:I can't find it in ASCII table I have.
: 

That's because a BREAK is not an ASCII code - it is a line condition ie it is a
mark or space (I forget which) on the serial line for a defined period of time
that is greater than 1 bit time.

:Thanks,
:mike  
: 
:--
:Michael Drues                              Dept. of Biomedical Engineering
:Internet:drues@iastate.edu                        1146 Veterinary Medicine
:BITNET:v2.med@isumvs.bitnet                          Iowa State University
:Office:(515)294-6520(or 4-1771) Home:(515)233-5652        Ames, Iowa 50011

--------------------------------------------------------------------------------
John Coburn                             !Email:
Digital Equipment Corporation           ! coburn@clovax.enet.dec.com   -or-
Enterprise Integration Services 	! coburn%clovax.enet@decwrl.dec.com
Cleveland, Ohio                         ! ...!decwrl!clovax.enet!coburn
================================================================================

peterk@cbmger.UUCP (Peter Kittel GERMANY) (02/19/91)

In article <1991Feb19.032422.26230@watdragon.waterloo.edu> ccplumb@rose.uwaterloo.ca (Colin Plumb) writes:
>drues@iastate.edu wrote:
>>Can anyone tell me what ASCII code for "BREAK" is???
>>I can't find it in ASCII table I have.
>
>Break is not part of ASCII; it's more part of RS232.  Well, actually,
>it makes sense in most asynchronous serial protocols, but there aren't
>very many that aren't descendants (some legitimate; most bastard) of
>RS232.
>
> [ lots of detailed explanation deleted ]

Hmm, I hardly dare to step in here because so many people already
stated that there is no ASCII code for BREAK, BUT:

In most systems I know, a Ctrl-C serves as a break signal. Now, for
this you can indeed give an ASCII value, it's 3. For beginners: If
you press Ctrl and a letter key, the system will deliver the code
of the key minus 64 (at least normally :-). So, Ctrl-A gives a 1,
and Ctrl-Z gives a 26 (often used as EOF in the CP/M and MS-DOS
world). 

-- 
Best regards, Dr. Peter Kittel  // E-Mail to  \\  Only my personal opinions... 
Commodore Frankfurt, Germany  \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk

billy@phoenix.pub.uu.oz.au (Jeff Coleman) (02/21/91)

There is a bit of a description on the workings of achieving break on the AMIGA
in the RKM Inc+Autodoc manual under serial.device ... 
obviously you are meant to use the serial device to do the break for you..
but there is enough information there (and with the knowledge of custom chips)
to do it at a lower level.

& mind you i'm not advocating it! &