• Please review our updated Terms and Rules here

RTS/CTS handshaking

Mike_Z

Veteran Member
Joined
Dec 1, 2013
Messages
1,713
Location
Near Milwaukee Wisconsin
I'm interested in finding information about RTS/CTS hand shaking. I'm working on some programming to transmission data from an 8080 machine with a 8251 uart to an IBMXT. I have full control of the RTS/CTS lines on the 8080, but am a little confused with the IBMXT. First, I want to use polling instead of interrupts. I know that this is slow, etc. I've read a lot about that, but I still want to use the polling. I'm not worried about speed or anything else. I want the control.
It's possible that I don't full understand the handshaking either, but this is how I see it. When the 8080 is sending data to the IBM, the 8080 will issue an RTS to the IBM. The IBM receives this information on it's CTS line. If the IBM is ready to receive, it will issue it's RTS, which the 8080 will receive on it's CTS line. RTS and CTS lines are crossed.
I wrote a short program that will cycle the 8080 RTS line and I can see this change at the DB9 pin 8 CTS at the back of the IBM. After opening the com port in the IBM, I figured that the IBM would have responded with changing it's RTS line, but it does not. The IBM is being programmed in Quick Basic 4.5. I have used the rs option in the OPENCOM statement to suppress RTS on channel opening. I have been looking at the fourth bit of the IBM MCR, CTS, but never see a change.
So..... does the IBM automatically respond to an 8080 request to send or do I have to respond programmatically? Can anyone suggest some good document on this. I've been looking quite a bit lately, but have not found what I need.
Thanks
Mike
 
I'm not an expert on the topic, but for what I've played with on PCs, generally RTS isn't used to request a send - tends to be more of a "I'm ready to receive if you want".
So there is no response required - but you could enable the pin in software manually.

If I wanted to send a byte of data, I'd set RTS inactive and check CTS (RTS on the other machine) before sending the byte.
If I wanted to receive data, I'd set RTS active (CTS on the other machine) and read bytes (if buffer fills, set RTS low).

But I'm no expert, perhaps I've been doing it wrong.

Edit: Got me curious, so reading this now, worth a look: http://www.tldp.org/HOWTO/Serial-HOWTO-19.html
 
Last edited:
RTS/CTS are handshake signals originally designed for communication between a DTE (data terminal equipment) and a DCE (data communications equipment). Other signals are involved too. Here's more-or-less the sequence of events:

Power on the modem and terminal
- modem provides DSR and terminal provides DTR which indicates the devices are turned on and operational.

Modem connects to another modem
- modem provides CD (carrier detect) indicating there is an active communications link available.

You hit a key on your keyboard
- terminal raises RTS indicating it want's to send data, and if all is well, modem returns CTS saying OK. At this point the terminal sends the data.

The rs232 standard was designed long ago, and in those days you may have only had a half-duplex modem available, i.e., one modem was a sender while the other was a receiver, and when the roles needed to be reversed the handshaking signals would tell the modems to reverse their roles and send data the other direction (yes, these were a real pita to troubleshoot :)).

There are also secondary handshaking signal lines, and clock signals for synchronous modems. You can find a complete description here: http://en.wikipedia.org/wiki/RS-232

Null modem cables, which basically "fake out" the handshake, are needed when you want a direct DTE - DTE connection, such as a dumb terminal connected to a PC COM port.

Secondary handshaking signals are sometimes used to provide flow control to serial printers.



-
 
If you do not know for fact that the serial port on the XT is good, then I suggest that you first establish whether or not it is good.
Checkit is one diagnostic program that will do that.
To fully test the port, you need to do an external loopback test. Loopback tests are explained on my web site at [here].
 
Thanks for the reply. I have to plead ignorance. So of the information that is available, doesn't come across as plain as it should, It least to me. I appreciate the links and information that you have provided. I know that the IMBXT serial port does work, because I have transmitted data back and forth between the two machines, but I have to control the timing personally, by starting each program in sequence, other wise I get errors and no transfer. So, I want to improve the program so that I do not have intervene. I think that I read to much into handshaking and will try to use what spiderweb mentioned. I have successfully controlled the IBMXT RTS, by using OUT(&HFC), 2 and OUT(&HFC), 0. I have no trouble the 8080 machine. So I'll just change the IBMXT program to withhold RTS until it is ready. The 8080 will not send until the CTS is received from the IBMXT. So as I understand the handshaking is the receiver will control the RTS line and the transmitter will monitor CTS. Should not have trouble getting this to work. I just didn't understand. I appreciate the help.

Mike
 
Just for your information, I got the program to work. I did as spider web mentioned. The IBMXT will control it's RTS line to the 8080, which will sense it on it's CTS line, for transmission from the 8080 to the IBMXT. One odd thing, on the 8080, which has a 8251 UART, I can not sense CTS directly. You have to sense TxRDY which is a combination of Transmitter enabled and CTS and Transmitter buffer not empty. So, the transmitter enable is set during programming of the UART, then I have to load the transmitter buffer with a byte and then wait for the CTS to change. Anyway, it works and all is good with the world again.

Thanks for the help
Mike
 
Back
Top