LAN-LINK Application Notes Number 3. By Joe Kasser G3ZCZ @ N4QQ PO Box 3419 Silver Spring Md 20918 Flow Control This application note discuses the control of the flow of characters between the Computer and the Terminal Node Controller (TNC). The method of control of the flow of characters between the TNC and the computer is called Flow Control. It is also used to control the flow of characters to the computer's display. Before looking at each of these flows, let's take a quick look at the interface between the computer and the TNC. The Interface. The interface between the computer and the TNC consists of a cable with connectors at each end. It is commonly called an RS- 232 cable, because the signals conform to the RS-232 specification (at least they are supposed to). The cable contains one wire which carries data from the TNC to the computer, one wire which carries data going the other way, and a common or ground wire. This is the minimum cable. Without these three wires, data cannot flow in both directions. As long as the data entering either the computer or the TNC is coming in slower than the device can process it, there is no problem. However when the data comes in faster, it overflows and characters can get lost. For this reason, almost every program and TNC contains a data buffer to catch and store the characters as they come in. This is well and good, but data still has a habit of coming in too fast. In order to stop the overflow from happening, flow control is used. This is a mechanism used between the computer and the TNC whereby one of the devices tells the other to stop sending when it senses that its buffer is full, and then later, when its program has depleted the buffer, tells the other device to start sending again. This flow control can be used in both directions. Hardware Flow Control There are two types of flow control; hardware and software. The RS-232 cable has special wires dedicated to hardware flow control. Thus use of hardware flow control requires extra conductors in the cable. In hardware flow control a 'Clear to Send' voltage level is placed on the wire by the receiver. The sender checks that level before sending any character, and only sends characters as long as that signal is present. Should it change state, the sender will wait until it reverts to the clear to send state. Since the RS-232 cable is bidirectional, there are two such lines, one used by each device. The 'XFLOW' parameter is used to tell the TNC which flow control approach to use. If XFLOW is ON, then software flow control is used, if XFLOW if OFF, hardware flow control is in effect. Software Flow Control In software flow control, the signalling is done by two characters reserved for that purpose. They are usually the Control-S (^S) and Control-Q (^Q) characters. When the receiver has enough data, it sends a ^S (Stop) character to the sender who then stops transmitting and waits for a ^Q (start) character before continuing. When the receiving device is ready for more characters, it send a ^Q, and flow is restored. Binary Data Software flow control has the advantage of only needing the three wires in the cable, but has problems when binary data is being transmitted along that interface. The ^Q and ^S are binary codes. As long as only ASCII text flows along the cable, binary codes are never seen and the ^S/^Q flow control is usable. Once binary characters flow, the receiving device cannot tell if a received ^S is part of the data or is a flow control character. Under these circumstances it stops receiving and waits for a ^Q, which if binary data was flowing, may never come, and the program seems to hang up. The original TNC software designers recognized that such a problem might occur, and put a filter parameter in the TNC instructions to tell the TNC to filter the received characters in the data stream and block various characters from being passed on to the computer. Thus PK-232, TNC2 and MFJ1278 users could set 'MFILTER 19' to block the ^S character from being passed to the PK-232 if it was received while monitoring an on-the-air packet. KAM users could use the 'FILTER ON' command to achieve the same effect. Flow Control in LAN-LINK All versions of LAN-LINK upto and including 1.55 used software flow control. In the early days of packet radio there was little if any binary data flowing on the LAN. A very few stations were using YAPP to transfer binary files. Then along came NET/ROM which signalled the state of the network to other nodes by means of binary information. Stations using LAN-LINK hung up when the binary information contained a ^S, if they had not set their TNC to filter out the ^S before passing the received characters to the computer. LAN-LINK version 1.56 and subsequent versions use hardware flow control, hence they ignore the ^S and ^Q and don't tend to hang up when monitoring packets containing binary data. Display Flow Control The TNC has the capability to echo back characters as they are received on the RS-232 interface. The TNC usually has this facility switched ON when powered up. This facility is controlled by the 'ECHO' parameter. When 'Echo On' is set, the TNC echoes back on the RS-232 interface any character received on the interface. If it is receiving characters on the radio interface at the same time, the characters will be sent down the RA-232 line as they are received, namely mixed together. The first dumb terminals and computer software used to interface the TNC only had one screen or window to display. To stop the characters being typed at the keyboard from appearing on the screen mixed together with the characters coming in from the radio, type-in flow control is used. The type-in flow control parameter is 'FLOW'. If FLOW is ON, any character received on the RS-232 interface (typed at the keyboard) will stop the TNC from sending characters on the RS-232 interface to the computer until you type an 'Enter character'. If you forget about the FLOW parameter and it is ON, The TNC will not send any characters to your screen until the TNC buffer fills up, and the system will appear to have hung up. These days, with LAN-LINK and two separate windows for incoming and outgoing characters, set 'FLOW OFF'. Summary To make everything work properly with both flow control and type- in flow control, make sure the following parameters are present in your LAN-LINK.SYS file, AND THEY ARE LOADED INTO YOUR TNC. FLOW OFF XFLOW OFF STOP 00 START 00 XON 00 XOFF 00 73 Joe G3ZCZ LAN-LINK is available from the author. For an evaluation copy, download it from Compuserve or send $5.00. On the other hand, send $35.00 for a registered copy which will entitle you to at least one free update. When you write in, say where you saw this Application Note.