Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)

Chapter 4 109
Using FDEVICECONTROL
Examples
Enabling Escape Sequence Read Termination
FDEVICECONTROL has the ability to control the interpretation of
escape sequences. Escape sequences are usually generated by function
keys or cursor control keys. The escape sequence read termination
(parm1 = 68) control directive allows your application to react
immediately to a special key when it reads it.
The escape sequence read termination causes a read to terminate when
the escape character is encountered in input data. However, the read
does not terminate immediately.
The DTC starts a timer immediately after it receives the escape
character. The DTC sets the timer to the period of time required to
transmit two characters at the current line speed. Characters that are
automatically transmitted as part of the escape sequence will be
received. When the entire escape sequence is transmitted, the timer
will expire, the read terminates, and your application can respond to
the special meaning of the escape sequence.
NOTE
The escape sequence may contain any number of characters, but the
time between the reception of each character in the sequence cannot
exceed the timer.
Enable/Disable escape sequence read termination (parm1 = 68) should
be accompanied with the enable/disable suppress echo of read
termination characters function (parm1 = 69). This prevents the DTC
from echoing the escape sequence characters and guarantees that your
application always has control of the position of the cursor. For
example, you could design a function key to display a help message and
then return to the point on the input line where the function key was
typed. See Figure 4-9 for escape sequence read termination.