Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)
Chapter 3 85
Common Device Control Functions
Altering Terminal Deficefiles
Setting Binary Editing Mode
In some cases you may need to disable all special character processing
and pass everything through as data. Binary editing mode allows you to
transfer information in this manner.
Binary editing mode treats all characters as data and passes all eight
bits of every character through without performing any special
operations. Fairly obviously, this restricts the way in which data
transfers can take place. You cannot use parity checking in binary
mode, since all eight bits of each character are treated as data. Block
mode transfers are also impossible, since no special handshake
characters are recognized.
The only way that a binary read will terminate without returning an
error is by reaching the byte count specified in the FREAD, READ, or
READX call that initiated the read. Read timeouts will terminate a
binary read in error and no data will be transferred. It is a good idea to
specify a read timeout value when posting binary reads to avoid
problems that can occur if the read does not reach the specified byte
count.
Binary mode is enabled by calling FCONTROL with a controlcode
value of 27 and disabled through FCONTROL with a controlcode
value of 26. With either of these FCONTROL calls the third parameter
has no meaning and should be invoked with a dummy value of 0.
Figure 3-9 provides an example of enabling binary editing mode in a
program. You should note several features of this code fragment, as
explained below, to understand how to use binary mode for your own
programming needs.
Note first that a call to FCONTROL(13) precedes any call to enable
binary mode. FCONTROL(13) disables character echo at the terminal.
If character echo is not disabled prior to transferring data in binary
mode, any ASCII DC3 (XOFF) character in the data (CONTROL S
typed at the terminal) would be echoed by the DTC back to the terminal
and it would appear to the terminal that the DTC had been XOFFed.
This would cause the terminal to hang, since the terminal would
suspend transmission to await on XON signal that would never arrive.
An alternative to disabling character echo is to turn XON/XOFF flow
control off at the terminal. This is a dangerous alternative, however,
since disabling flow control may result in write data being lost at the
terminal.
The next feature of this program you should note is that separate calls
to FCONTROL(27) are posted against a read port and a write port on
the device. FCONTROL(27) is one of several terminal controls that
affect the data transfer characteristics of a specific file, rather than of
the device itself. This makes it necessary to explicitly specify binary
mode for both the read port and the write port opened on the device.