[net.micro.pc] Query: Break Generation

amys@sco.UUCP (Amy Snader) (10/18/84)

<what's a nice line-eater like you doing in a place like this?>

Does anyone know how to convince the IBM PC/XT serial i/o chip
to generate the break condition?  
I've heard rumors that software able to generate break exists,
although the IBM technical reference makes no mention 
that the chip can do this. 
--amy

ac4@pucc-h (Tom Putnam) (10/19/84)

> Does anyone know how to convince the IBM PC/XT serial i/o chip
> to generate the break condition?  
> I've heard rumors that software able to generate break exists,
> although the IBM technical reference makes no mention 
> that the chip can do this. 

The IBM Technical Reference Manual does describe the INS 8250
Asynchronous Communications Controller, but I can see where you
might not be able to understand specs at that level.  The 8250
has a number of control and status registers, one of which is
called the Line Control register.  One bit of the Line Control
register is used to force the communication line into a "breaking" 
condition (i.e. constant "spacing" condition).  If you want to
generate a "break," you need to turn on the break bit in
the line control register, hold it in that condition for greater
than one full character time, and then turn off the break bit.

Here is a crude way to generate a "break" from within a BASIC
program:

10 'Send a "break"
20 DEF SEG=0: PORT=PEEK(&H400)+PEEK(&H401)*256: DEF SEG
30 I=INP(PORT+3): J=I OR &H40: OUT PORT+3,J
40 FOR J=1 TO 500: NEXT: OUT PORT+3,I
50 RETURN

This routine peeks into low memory to get the port address of the
COM1: 8250 (a non-portable construct - there are probably better
ways to do this), then it gets the current Line Control setting,
OR's on the break bit (&H40), and OUTputs the new Line Control value.
It then hangs around for a while using a null FOR-NEXT loop.  This
is not a very accurate way to time the break, but the length of time 
of a break is not really critical so long as it exceeds one full character 
time.  Note that this loop probably executes too fast if you use the
compiler instead of the interpreted BASIC.  Finally, the routine
restores the original Line Control setting (without the break bit).

-- 
Tom Putnam
{decvax|harpo|ihnp4|inuxc|seismo|ucbvax}!pur-ee!pucc-h:ac4