Microsell Systems
(Received 20 July 1984)Dear Joe
I have used your mark-ups to update and expand my Bi-Sync comms documentation and I've enclosed a new copy for your perusal.
I would like to make a few proposals for the implementation of comms between the Epson QX10 and the Microsell till. I would appreciate your reaction to these proposals and any suggestions or modifications you might care to make.
- Since we will be using asynchronous modems, I feel there is no real need to include any SYN characters in the transmitted data stream. SYN can be treated exactly like any other data character.
- A known failing of Bi-sync is the lack of CRC characters on link control messages. It is possible (and we have had it happen) for a data block to be repeated any odd number of times without either end becoming aware of the error. This results from miss-interpretation of link messages AK0, ACK1, NAK, etc. by one or the other ends when using low-grade telephone lines. This has forced us to use sequence numbers on all data transmissions to allow duplicated records to be discarded. By including CRCs on all transmitted messages, this problem should not arise.
- I do not know what character set the BCL uses, but I assume the EPSON uses ASCII. I propose that we use ASCII rather than EBCDIC characters for our data communications, if for no other reason than ease of debugging.
The special characters I am proposing are as follows:
HEX ASCII SOH 01h SOH STX 02h STX ETX 03h ETX ETB 17h ETB ITB 1Eh RS ENQ 05h ENQ EOT 04h EOT DLE 10h DLE - For ease of coding, all transmitted characters (including SOH/STX) are included in the CRC calculation.
- All data will be non-transparent - i.e. printable.
- Software updates will probably be sent directly from Microsell rather than re-distributed as part of normal shop polling. The data formats will conform to the above however, by transmitting object code as two character hex equivalents of each byte.
- Data will be transmitted as eight bit data without parity. The CRC will provide more data integrity than parity bits would. It is necessary to use eight bit data to allow the CRC to be transmitted, since its range is not restricted to 7 bit values.
- Transmitted characters will have their sign bit set to zero, except, as noted above, for the CRC characters.
The actual format of data and update records to be sent is still to be determined by the other programmers who are coding the Staples software. If you have any particular requirements in this area, please do not hesitate to let me know.
Yours sincerely,
Jim Segrave
BI-SYNC (binary synchronous communications) consists of a protocol for transmitting data in blocks with error-checking and recovery procedures. It is a half-duplex protocol in that one machine normally is transmitting data and the other is receiving. A special control sequence (line bidding) is used to reverse the direction of transmission. The protocol uses a set of control characters to format data blocks.
SOH | 01h | Delimits the beginning of a header in a data block. |
STX | 02h | Delimits the start of data in a data block. |
ETX | 03h | Marks the end of data in a block. Data blocks ending with ETX are considered as end-of-file records. |
ETB | 26h | Marks the end of a data block that is not the end of a file. |
ITB | 1Fh | Marks the end of an Intermediate Text (data) Block when more than one data block forms a single transmission record. |
ENQ | 2Dh | In data blocks, marks the end of an aborted data block - i.e. the sender will not be able to complete the transmission of this data block. |
EOT | 37h | Marks the end of transmission by a machine. The receiver may now enter a line bid state to send data back. |
SYN | 32h | A synchronising (pad) character. |
DLE | 10h | An escape character allowing the following character to take on a special meaning. |
Data may be sent in one of two modes - transparent and non-transparent. In non-transparent mode, the special characters STX, SOH, ENQ, ETX, ETB, DLE, ITB, and SYN must not occur as part of the data to be transmitted. Transparent mode provides a mechanism for sending these characters and distinguishing them from control meanings.
The simplest data block contains one single data record:
SYN SYN <STX/SOH> <data - any length including 0> <ETB/ETX> <CRC>
Either STX or SOH may be used to mark the start of data. The CRC is a 16-bit block check character. The CRC is computed on all the data characters and the <ETX/ETB>. SYN characters may occur anywhere within the data portion and are ignored as data and not included in CRC calculation.
A data block may have both a header text and data:
SYN SYN SOH <header text> STX <data> <ETB/ETX> <CRC>
The header and or data text may be empty. SYN characters may be included anywhere within the header or data area and are ignored. The CRC includes all characters after the SOH up to and including the ETX/ETB (except SYNs),
More than one data block may occur within a record:
SYN SYN STX <data> ITB <CRC 1> ... STX <data> <ETX/ETB> CRC-n
Any number of data blocks terminated by ITB's may occur. The first data block CRC is accumulated after the STX through and including the ITB. Subsequent data blocks include their STX/SOH characters.
Data record formats are identical to non-transparent blocks except that:
DLE characters added as escapes are not included in CRC accumulation. CRC characters are never escaped by DLEs.
<ENQ> SYN SYN ENQ | In line bid state | Represents a request by the sending machine to enter the transmit state. |
---|---|---|
In transmit state | Requests the receiving end to repeat its last response to the transmitting end. | |
In receive mode | Never sent. | |
<AK0> SYN SYN DLE 70H | In line bid state | The sending end is ready to enter receive state. |
In transmit state | Never used. | |
In receive state | An acknowledge of the last even numbered data block received the initial line bid <ENQ> is considered as message number 0. | |
<AK1> SYN SYN DLE 71H | In line bid state | Never used. |
In transmit state | Never used. | |
In receive state | An acknowledge of the last odd numbered data block received. | |
<NAK> SYN SYN 3DH | In line bid state | Never used. |
In transmit state | Never used. | |
In receive state | Rejects the last data block received. This message is only sent once for each data block received. Subsequent ENQs from the transmitting end are responded to by repeating the appropriate AK0 or AK1 for the last good data block. | |
<RVI> SYN SYN 7CH | In line bid state | Never used. |
In transmit state | Never used. | |
In receive state | This message is sent by the receiver as an ack of a data block and a request for the transmitting end to stop sending and enter the line bid state to allow the receiving end to transmit some urgent data. The transmitting end takes this message as being either an AK0 or AK1, whichever is expected. The transmitting end is not obliged to honour the line turn around request. This message should only be sent in reply to a single data block. If the transmitting end does not cede the line, the receiver should revert to the AK0 AK1 response sequence for subsequent data blocks. | |
<WAK> SYN SYN 6BH | In line bid state | Never used |
In transmit state | Never used. | |
In receive state | This message is sent by a receiver to acknowledge a data block received and request that the transmitter pause in sending, perhaps because the receivers buffers are all filled. The transmitter then replies with ENQs and the receiver with WAKs until the condition is cleared, at which point the receiver replies to the ENQ with an AK0 or AK1 (appropriate to the data block which caused the buffer full condition). | |
<TTD> SYN SYN STX ENQ | In line bid state | Never used. |
In transmit state | The transmitting end sends this message when it is not ready with the next data block for transmission. It keeps the comms line open while the next data block is being prepared. The receiving end responds to a TTD with a NAK. When the transmitter finally has data ready, it resumes normal sending. | |
In receive state | Never used. | |
<DSC> SYN SYN DLE EOT | In line bid state | Never used. |
In transmit state | Instructs the receiving end to terminate comms immediately. Used at the end of a comms session or as a last resort during fatal errors. | |
In receive state | As transmit state. | |
<ABORT> SYN SYN (DLE) STX/SOH data ENQ | In line bid state | Never used. |
In transmit state | Sent by the transmitting end to indicate that it is unable to complete sending of this data block. Used, for example, if the transmitter discovers a special character in a non-transparent data block. The receiver replies with a NAK. | |
In receive state | Never used. | |
<EOT> SYN SYN EOT | In line bid state | May be sent by the machine that last had transmit status. It indicates that that end has completed transmitting and is expecting the end that was receiving to begin bidding for the line by sending ENQs. |
In transmit state | Indicates that sending end has completed transmission of all its data and is ready to enter line bid state. This only applies if the last data block sent ended with an ETX and not an ETB. ETX is an end-of-file mark and it is assumed that the line will only turn around at the end of files. If the last data block sent ended with an ETB, this indicates an unrecoverable error and comms should be abandoned. A transmitting station which has just gained transmit state from a line bid may send an EOT if it has no data to send. | |
In receive mode | Used to indicate an unrecoverable error at the receiving end. Comms should be abandoned. |
Stations communicating in BI-SYNC are considered to be in one of three states: line bid, transmit, or receive. Comms sessions always begin in line bid state from which one end exits to transmit state, the other to receive state. At the end of transmission from the unit in transmit state, line bid state is re-entered and the unit which was in receive state now bids for transmit state (line turn-around).
The unit which has transmit state has complete control of the comms line. The receive state end only sends messages in reply to data or link control messages from the transmit end. The only exception to this is the unsolicited sending of EOT or DSC to terminate comms on fatal errors. The normal processing consists of the transmit end sending a message and the receive end sending a reply. The transmit end allows the receive end three seconds from sending the message to getting a valid reply. Seven attempts are made to get a successful exchange, then the call is abandoned.
In line bid state, neither end controls the line. Both ends may attempt to assume transmit state by sending ENQs. To resolve this conflict, one station - the called one in switched networks - is designated as a master and the other end as a secondary station. Master stations wait only two seconds for an AK0 to their ENQ bid, secondaries wait three. If a secondary station receives an ENQ after it has sent an ENQ, this indicates that the master station also wants to assume transmit status. The secondary must respond with AK0 and cede transmit status to the master. Up to fifteen bid tries are allowed before abandoning the line - 30 seconds for a master, 45 for a secondary.
SET RETRY COUNT = 15, TIMEOUT = 2 SECONDS
SEND ENQ
RESPONSE:
SET RETRY COUNT = 15. TIMEOUT = 3 SECONDS
SEND ENQ
RESPONSE:
RETRY COUNT = 7. TIMEOUT = 3 SECONDS
EXPECTED AK = AK1
ERROR COUNT = 7, TIMEOUT = 3 seconds.
CURRENT ACK = AK0
Get a message: