Examples (Transparent XON/XOFF)
The following describes the actions performed by the software. The modem
performs identical actions on the reverse directions of transmission.
Transmitter Example
Each character in the user data stream is individually examined. If
it is any of the six characters $10, $11, $13, $90, $91, or $93, it is exclusive-ORed
with the value $21, and prefixed by a DLE character ($10). This is a replacement
function as shown in the following table:
Char Replaced by
$10 $10 $31
$11 $10 $30
$13 $10 $32
$90 $10 $B1
$91 $10 $B0
$93 $10 $B2
The characters are transmitted using the effective parity setting on the
DTE-DCE interface; the XOR with $21 preserves the correct value of the parity
bit.
If the software wants the modem to stop delivering data, it inserts an XOFF
($13 at current parity setting) in the transmitted data stream at any point,
which may be between a DLE ($10) and the subsequent transparent character.
The XOFF should be issued BEFORE the buffer is completely full, since there
may be a lag of several characters before the modem reacts to the XOFF and
suspends delivery. To resume data delivery, the software inserts an XON
($11 at current parity setting) at any arbitrary point. Characters inserted
for flow control are NOT passed through the transparency algorithm defined
above.
Receiver Example
Each character received from the modem is individually examined. A transparency
sequence in progress flag (TSIP-FLAG) is maintained as part of a state machine.
The initial value of the TSIP-FLAG is OFF. The following tests and actions
should be undertaken in the order listed.
If the character received is $13 or $93 (XOFF with either parity), it is
interpreted (regardless of the setting of the TSIP-FLAG) as a request from
the modem for the DTE to suspend transmitting data to the modem. The receiver
portion of the software must communicate this request to the transmitter
portion of the software in a timely manner, since the modem has a limited
amount of buffer space to allow additional characters to be received after
it sends XOFF (about 64 characters maximum). The XOFF character is discarded
from the received data stream. The TSIP-FLAG is not changed.
If the character received is $11 or $91 (XON with either parity), it is
interpreted (regardless of the setting of the TSIP-FLAG) as a request from
the modem for the DTE to resume transmission of data to the modem, if any
is available. The XON character is discarded from the received data stream.
The TSIP-FLAG is not changed.
If the character is not an XON or and XOFF, the following steps are performed:
Step 1: If the TSIP-FLAG is ON, the received character is exclusive-ORed
with $21, then delivered to the higher layer for further processing (e.g.,
placed in a receive data buffer). The TSIP-FLAG is then turned OFF.
Step 2: If the TSIP-FLAG is OFF and the character received is $10
or $90 (DLE with either parity), the start of a transparency sequence is
indicated. The DLE is discarded from the received data stream, and the TSIP-FLAG
is turned ON.
Step 3: If the TSIP-FLAG is OFF and the character received is not
a $10 or $90, the character is a normal non-transparent user data character
which should be delivered to the higher layer for further processing (e.g.,
placed in a receive data buffer). The TSIP-FLAG remains OFF (unchanged).
Click here to return to the Contents page.