Please enable JavaScript to view this site.

To input from a serial device under Unix or Linux, open it as an input file, e.g.:

OPEN #9, "/dev/cua0", INPUT

Then pass the file channel to XCALL GET just like any other input file channel. Beware, however, that under Unix, such serial ports will be by default set to "line input" mode. Thus, while you may be asking for only two characters, you would not actually "see" them until a line terminator (usually LF) had been received. To avoid this annoyance and get the characters immediately as they are transmitted from the other end, you need to take the port out of "line input" mode. One way to accomplish this is to use HOSTEX with the Unix stty command to turn off "icanon" mode, for example:  

xcall HOSTEX, "stty –icanon < /dev/cua0"

Comments

Use the stty command only after opening the file channel. Otherwise, the settings may be wiped out by the open operation. Also, note that stty and its arguments are case sensitive, usually all in lower case.
If inputting from a serial device under Unix/Linux, you may want to adjust port settings, such as flow control, baud rate, etc, which can be done by executing an stty command (via HOSTEX) after opening the port and before using GET. Consult the Unix stty man page or other documentation for details on the available settings.  
You may need to use chmod 666 on the port device file to allow it to be read and its settings modified by a non-root user.

Created with Help+Manual 9 and styled with Premium Pack Version 5 © by EC Software